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

Use BitSet in apply_analytical! and reshape_to_nodes #660

Merged
merged 1 commit into from
Mar 31, 2023

Conversation

fredrikekre
Copy link
Member

This patch uses BitSet in apply_analytical! and reshape_to_nodes for MixedDofHandler. The benefit here is twofold: computing the intersection is much faster (basically just bitwise &) and the subsequent looping over the cells are done in ascending cell order.

This closes the performance gap between MixedDofHandler and DofHandler in benchmarks from #629 of apply_analytical!, reshape_to_nodes, and vtk_point_data. For example, here is the benchmark results for apply_analytical!:

387.853 ms (72 allocations: 34.50 MiB)  # MixedDofHandler master
 55.262 ms (38 allocations: 553.45 KiB) # MixedDofHandler patch
 41.861 ms (14 allocations: 2.27 KiB)   # DofHandler master/patch

@codecov-commenter
Copy link

codecov-commenter commented Mar 31, 2023

Codecov Report

Patch coverage: 80.00% and project coverage change: -0.02 ⚠️

Comparison is base (32bcb4d) 92.99% compared to head (56e826d) 92.97%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #660      +/-   ##
==========================================
- Coverage   92.99%   92.97%   -0.02%     
==========================================
  Files          30       30              
  Lines        4497     4500       +3     
==========================================
+ Hits         4182     4184       +2     
- Misses        315      316       +1     
Impacted Files Coverage Δ
src/iterators.jl 92.95% <ø> (ø)
src/Dofs/apply_analytical.jl 98.18% <75.00%> (-1.82%) ⬇️
src/Dofs/MixedDofHandler.jl 91.78% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@KnutAM KnutAM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how it affects performance in a mixed case with sparse cellsets though, but I also don't think this function is very performance critical so more important to not decrease single-fieldhandler performance.

Found one extra performance boost option for single field...

src/Dofs/apply_analytical.jl Outdated Show resolved Hide resolved
This patch uses `BitSet` in `apply_analytical!` and `reshape_to_nodes`
for `MixedDofHandler`. The benefit here is twofold: computing the
intersection is much faster (basically just bitwise `&`) and the
subsequent looping over the cells are done in ascending cell order.

This closes the performance gap between `MixedDofHandler` and
`DofHandler` in benchmarks from #629 of `apply_analytical!`,
`reshape_to_nodes`, and `vtk_point_data`. For example, here is the
benchmark results for `apply_analytical!`:
```
387.853 ms (72 allocations: 34.50 MiB)  # MixedDofHandler master
 55.262 ms (38 allocations: 553.45 KiB) # MixedDofHandler patch
 41.861 ms (14 allocations: 2.27 KiB)   # DofHandler master/patch
```
@fredrikekre fredrikekre merged commit be83f2f into master Mar 31, 2023
@fredrikekre fredrikekre deleted the fe/apply_analytical branch March 31, 2023 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants