-
Notifications
You must be signed in to change notification settings - Fork 109
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
Sort unstructured boundary conditions #583
Sort unstructured boundary conditions #583
Conversation
…d information, printing still works in all dimensinos
…ndary condition types
Codecov Report
@@ Coverage Diff @@
## main #583 +/- ##
==========================================
- Coverage 93.14% 93.14% -0.01%
==========================================
Files 138 139 +1
Lines 14082 14111 +29
==========================================
+ Hits 13117 13143 +26
- Misses 965 968 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
Thanks for working on this! Please find below some comments. Feel free to ping me here or on Slack to discuss anything further.
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 in general, with a minor comment. Once the other comments by @ranocha are resolved, this can be reviewed once more and then merged I think.
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.
Looks already quite good. Just a minor comment and we can merge it from my side.
A general comment: Please consider using the GitHub feature to apply proposed changes directly. You would have saved both of us quite some time by doing that for #570 (comment) where I already fixed the problematic allocations I fixed in 875ad6c
Co-authored-by: Hendrik Ranocha <[email protected]>
Okay, I will start using this feature. I used to like and combine the changes into a single commit to avoid cluttering the git log. But now that we use squash merge for PRs this is no longer an issue |
You can go to the "Files changed" section at the top and select something like "Add suggestion to batch" for all of them. Then, you can commit them in one batch/commit. |
Good to know. I will make sure I use this in the future |
# recursively call this method with the unprocessed boundary types | ||
calc_boundary_flux_by_type!(cache, t, remaining_boundary_conditions, | ||
remaining_boundary_condition_indices, mesh, equations, dg) |
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.
TBH, I don't really like these fancy lisp-style iterations unless explicitly required for performance reasons. I am not sure if this was benchmarked or not, but it makes the code harder to read and understand (IMHO, almost always does). No objections against using it here, but if we can get away without these constructs except for some extremely critical cases, I'd appreciate it.
It actually improves the performance, according to some benchmarks shown to me by @andrewwinters5000 |
The high-level overview: The first version implemented by @andrewwinters5000 payed the price of dynamic (runtime) dispatch (type instability) for every node on every boundary when at least two different BCs were used. My PR reduced that to runtime dispatch once per boundary. This PR fixed the underlying type instability completely, removing the cost of dynamic dispatch. |
I'm still surprised though that you can see the difference between the second and third versions. Intuitively, I would've thought this should be negligible. |
It had less impact, that's true. A bigger performance improvement came from
Nevertheless, I think it's good to avoid type instabilities and train people to get used to some of these design choices. |
Improve the performance and type stability of the
calc_boundary_flux
of the unstructured solver. Addresses part of #542