-
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
WIP add task_local for duplication things for multithreading #1070
base: master
Are you sure you want to change the base?
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. |
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.
Is there a sane way to unit test this?
6c767fe
to
840b1c9
Compare
Thoughts on the name? |
I think having |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some code paths are not covered yet (see CodeCov result).
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.
Still.
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 |
No description provided.