-
Notifications
You must be signed in to change notification settings - Fork 92
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
Make default assembler thread safer #1067
base: master
Are you sure you want to change the base?
Conversation
This patch make the assembler thread safe by using TaskLocalValue for the buffers. This simplifies writing multi-threaded assembly since there is no need to create multiple assemblers to put in scratch spaces.
How much overhead does this cause for large problems? |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1067 +/- ##
=======================================
Coverage 93.72% 93.73%
=======================================
Files 39 39
Lines 6011 6015 +4
=======================================
+ Hits 5634 5638 +4
Misses 377 377 ☔ View full report in Codecov by Sentry. |
But I just realized that Ok, 140μs and 123ns after making it concrete. Hmm. |
On the one hand, its nice to make the assemblers thread safe. But is this, i.e. trying to make as much as possible thread safe, the way to go for facilitating multithreading? Couldn't one argue, from a user-perspective, that even I think I'd rather want a clear interface wrt. making copies for multithreading (currently, |
I just find it a bit weird that you have to call The assembler is a global object like the dofhandler/grid/stiffness matrix and doesn't feel as "scratchy" as cellvalues. |
Agreed - that's why I would like a
True, but e.g. a And a side-note: Calling the assembler thread-safe could be dangerous, since coloring is still normally required? |
I still think it is a bit different because we don't modify it |
You mean that we don't modify the global parts of the But I don't want to stop this efforts by being negative off course! |
I do like that you don't need to duplicate the assembler in the scratch value as done now. Imo I think we should go with this assuming the overhead can be considered negligible for normal problems that are run without threading. |
As an alternative, or maybe in addition to this PR, #1070 introduces something like this. |
This patch make the assembler thread safe by using TaskLocalValue for the buffers. This simplifies writing multi-threaded assembly since there is no need to create multiple assemblers to put in scratch spaces.