-
Notifications
You must be signed in to change notification settings - Fork 113
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
Fix: Automatically finalize t8code objects when Trixi.jl shuts down #2172
Conversation
Review checklistThis checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging. Purpose and scope
Code quality
Documentation
Testing
Performance
Verification
Created with ❤️ by the Trixi.jl community. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Great that you determined an "under-the-hood" way to handle this finalization process!
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2172 +/- ##
==========================================
- Coverage 96.39% 96.39% -0.00%
==========================================
Files 483 483
Lines 38325 38333 +8
==========================================
+ Hits 36941 36948 +7
- Misses 1384 1385 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
…i-framework/Trixi.jl into fix-t8code-finalize-before-shutdown
Although this fix works nicely in serial Julia sessions it is flawed for MPI-based parallel execution. First, the instances of the garbage collector on each Julia process seem to work independently in terms of when and what to free. This leads to stalling MPI processes waiting for other processes who are not finalizing the t8code object at the moment. A similar effect can happen for the last finalization call while shutting down since the Phew ... |
@andrewwinters5000 @benegee @sloede @ranocha @JoshuaLampert Ready for review. |
…i-framework/Trixi.jl into fix-t8code-finalize-before-shutdown
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.
Only a minor thing, but I'm wondering if we should add something like Base.pointer(fw::ForestWrapper) = fw.pointer
in T8code.jl to avoid explicitly accessing the field here. (Sorry I missed that in the review in T8code.jl.)
Otherwise this looks good to me.
@JoshuaLampert I already thought about doing this similar to PointerWrapper in P4est.jl. But it didn't work right away and I opted for the stupid way of writing it out explicitly. I then found out that you can actually mess with |
Co-authored-by: Joshua Lampert <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
It seems so. Pretty tricky to narrow down the cause for that. On my machine the forest wrapper test runs just fine. |
Do you run them in interactive mode locally? |
Both! Tested in interactive session and in "script" mode. Works as expected on my local machine. |
…i-framework/Trixi.jl into fix-t8code-finalize-before-shutdown
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!
All green, besides CodeCov. Is there anything else to do? |
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!
This PR provides a solution for automatically finalizing all active t8code related objects before Trixi.jl resp. MPI shuts down. Before this PR t8code objects had to be finalized explicitly by hand before shutting down Trixi or nasty segfaults occurred.
This PR is related this discussion: DLR-AMR/t8code#1295.
This PR depends on DLR-AMR/T8code.jl#75 and DLR-AMR/T8code.jl#76.