-
Notifications
You must be signed in to change notification settings - Fork 213
Optimize elliptic solver (3): Sparse subdomain data #3605
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
Optimize elliptic solver (3): Sparse subdomain data #3605
Conversation
afc11d8 to
7e2a583
Compare
| const std::tuple<FluxesArgs...>& fluxes_args, | ||
| const std::tuple<SourcesArgs...>& sources_args, | ||
| const DirectionMap<Dim, std::tuple<FluxesArgs...>>& fluxes_args_on_faces, | ||
| const std::function<bool(const ElementId<Dim>&)>& data_is_zero = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't looked at any of the code in detail. Note that std::function is pretty slow compared to lambdas or a template parameter. If the std::function is needed in a loop you might want to think about an alternative way of handling this. Basically, std::function does type erasure internally, which is why it's slower
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think making the argument type a template argument will work without having to change anything else. (And all this appears again below.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed in a fixup, please take a look
| const std::tuple<FluxesArgs...>& fluxes_args, | ||
| const std::tuple<SourcesArgs...>& sources_args, | ||
| const DirectionMap<Dim, std::tuple<FluxesArgs...>>& fluxes_args_on_faces, | ||
| const std::function<bool(const ElementId<Dim>&)>& data_is_zero = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think making the argument type a template argument will work without having to change anything else. (And all this appears again below.)
| } | ||
| } | ||
| ASSERT( | ||
| false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ERROR? Evaluating the condition is free, no reason to skip it.
wthrowe
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can squash this change directly.
| << neighbors_neighbor_id | ||
| << " is part of the subdomain, but we didn't find its " | ||
| "overlap ID. This is a bug, so please file an issue."); | ||
| return std::nullopt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove statement after ERROR.
e537b9b to
f9c4868
Compare
|
Timeout fix looks good. Squash. |
454e047 to
1232d58
Compare
nikwit
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Proposed changes
At some point the elliptic solver builds a matrix representation of a Poisson operator by feeding it unit vectors, so most of the data is actually zero (i.e. sparse). This PR makes the DG operator a lot faster when it operates on sparse data.
Upgrade instructions
Code review checklist
make docto generate the documentation locally intoBUILD_DIR/docs/html.Then open
index.html.code review guide.
bugfixornew featureif appropriate.Further comments