WIP add task_local for duplication things for multithreading#1070
WIP add task_local for duplication things for multithreading#1070fredrikekre wants to merge 2 commits intomasterfrom
Conversation
9ca9e44 to
237c1cb
Compare
|
I don't have time to look in detail, but I really like to have this interface! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1070 +/- ##
==========================================
- Coverage 93.57% 93.54% -0.04%
==========================================
Files 39 40 +1
Lines 6071 6086 +15
==========================================
+ Hits 5681 5693 +12
- Misses 390 393 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
termi-official
left a comment
There was a problem hiding this comment.
Is there a sane way to unit test this?
6c767fe to
840b1c9
Compare
|
Thoughts on the name? |
|
I think having |
KnutAM
left a comment
There was a problem hiding this comment.
Nice!
Took a bit deeper look, looks good. Docs/changelog etc of course needed as well, but still just WIP AFAIU.
Should it also be added to InterfaceValues?
| # TODO: For typical use the quadrature rule is read-only, but seems safer to copy anyway? | ||
| # And might even be beneficial with e.g. NUMA? |
There was a problem hiding this comment.
I agree, I think the cost of copying here would always be negligible, and there is a risk when using e.g. PointValues where the quadrature point is changed!
There was a problem hiding this comment.
I would argue that task_local should always be safe and that the caller is responsible to not call task_local on immutable stuff, if he does not want the duplication.
There was a problem hiding this comment.
IIRC, at least in the past, it was beneficial that the thread that used the data was the one allocating it so thats why I thought maybe it is better to duplicate this too.
There was a problem hiding this comment.
I am not sure if that is also true for constant shared memory data. I suggest that we keep the rationale in a doc string here tho, so if we revisit this we have the exact arguments at hand (and also for users).
| # TODO: For typical use the quadrature rule is read-only, but seems safer to copy anyway? | ||
| # And might even be beneficial with e.g. NUMA? |
There was a problem hiding this comment.
I would argue that task_local should always be safe and that the caller is responsible to not call task_local on immutable stuff, if he does not want the duplication.
There was a problem hiding this comment.
Some code paths are not covered yet (see CodeCov result).
5cbdba8 to
b75e345
Compare
b75e345 to
8fd03fb
Compare
|
FWIW, I am not 100% sold on this. What was the issue with the previous way? Also, calling it |
The issue is basically that there isn't a previous way:
The point of this PR is to get something consistent I guess. I am not really fond of the name either, but since it is typically used when you set up a new task the name "looks good", i.e. cv = task_local(cellvalues)
Threads.@spawn assemble!( cv...)Would a name like |
To get the ball rolling on this, in Thunderbolt I have implemented this exact concept some time ago decided for the name |
|
IMO (But I'm also good with |
|
I still think something like this would be nice to have. Can we come up with a better name? I don't think |
What about |
|
Would be good to get this settled I think, and also related to the discussion in #1291. I suggest we make a vote - add 👍 or 👎 for the suggestions you like or don't like below, and ❤️ for your favourite. If not wanting to have a function like this at all, add a 💀 on this comment :) (Hope I didn't miss any suggestions, if so please add) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
No description provided.