Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-up RBF matrix assembly #1320

Merged
merged 9 commits into from Jun 22, 2022
Merged

Speed-up RBF matrix assembly #1320

merged 9 commits into from Jun 22, 2022

Conversation

davidscn
Copy link
Member

@davidscn davidscn commented Jun 8, 2022

Main changes of this PR

Speed up matrix assembly of the RBF matrices by a factor of ~2.2 for compute intensive RBFs and ~6 for simple RBFs (measured for matrix A).

Motivation and additional information

The matrix assembly is a considerable factor in the computeMapping step (depending on the system size). For small systems, the assembly step is dominant, for big system, the decomposition is dominant. These changes lead for the computeMapping step in a speedup of ~2.2 - 6.2 (for 150 vertices) to ~1.13 - 1.06 (for 13.300 vertices). Therefore, the interesting region for partition of unity mapping is accelerated considerably. In addition, there are several considerations to improve the decomposition strategies as well, which will make the overall relevance of an improved assembly more significant (see eg davidscn#3 ).

Depends on #1319.

Author's checklist

  • I added a changelog file with make changelog if there are user-observable changes since the last release.
  • I ran make format to ensure everything is formatted correctly.
  • I sticked to C++14 features.
  • I sticked to CMake version 3.16.3.
  • I squashed / am about to squash all commits that should be seen as one.

Reviewers' checklist

  • Does the changelog entry make sense? Is it formatted correctly?
  • Do you understand the code changes?

@davidscn davidscn added the enhancement A new feature, a new functionality of preCICE (from user perspective) label Jun 8, 2022
@davidscn davidscn self-assigned this Jun 8, 2022
@davidscn davidscn marked this pull request as draft June 8, 2022 13:33
@fsimonis
Copy link
Member

We should consider using Eigen::Index for the iteration instead of hard coding the type.
Alternatively, we could use auto boost irange to hide both the type and the iteration.

@davidscn
Copy link
Member Author

We should consider using Eigen::Index for the iteration instead of hard coding the type.
Alternatively, we could use auto boost irange to hide both the type and the iteration.

Thinking about it: how about using auto (which should in principle resolve to Eigen::Index) ?

@davidscn davidscn marked this pull request as ready for review June 20, 2022 11:50
@davidscn davidscn requested a review from fsimonis June 20, 2022 11:50
@fsimonis
Copy link
Member

The problem with using auto in for loops is that normally the end value has the desired type, but you need the type in the initializer of the for construct.

Defining the end outside the loop and then using decltype is one option.
Using some abstraction that captures the type like boost::irange is another possibility.

@davidscn
Copy link
Member Author

Ah I see (and didn't know that). Then I will use the boost solution, thanks!

@davidscn
Copy link
Member Author

We should consider using Eigen::Index for the iteration instead of hard coding the type.
Alternatively, we could use auto boost irange to hide both the type and the iteration.

For the sake of completeness let me add that we cannot exceed int in the current implementation though, because that's what we use in many places in preCICE, e.g., the mesh data structures.

@davidscn
Copy link
Member Author

@fsimonis had a brief look at it.

@davidscn davidscn merged commit f6c4d97 into precice:develop Jun 22, 2022
@davidscn davidscn deleted the speedup-asm branch June 22, 2022 22:00
@davidscn davidscn added this to the Version 2.5.0 milestone Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature, a new functionality of preCICE (from user perspective)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants