Implement Trixi.Threaded()#3003
Conversation
…e-exporting FastBroadcast Replaces the `const Threaded` alias (which simply forwarded DiffEqBase/FastBroadcast types) with a Trixi-owned function that reads `_PREFERENCE_THREADING`. When the backend is `:serial`, `Trixi.Threaded()` now returns the non-threaded value (`Serial()`/`False()`), so users who have disabled Polyester for Trixi cannot accidentally pass a threading argument that contradicts their preference. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
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. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3003 +/- ##
==========================================
- Coverage 97.13% 97.12% -0.01%
==========================================
Files 625 625
Lines 48514 48518 +4
==========================================
+ Hits 47122 47123 +1
- Misses 1392 1395 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ranocha
left a comment
There was a problem hiding this comment.
My suggestion would be
thread_preference()
Why did you not follow "your" suggestion?
| @static if _PREFERENCE_THREADING === :serial | ||
| @static if isdefined(DiffEqBase, :Threaded) | ||
| Threaded() = DiffEqBase.Serial() | ||
| else | ||
| Threaded() = False() | ||
| end | ||
| else | ||
| @static if isdefined(DiffEqBase, :Threaded) | ||
| Threaded() = DiffEqBase.Threaded() | ||
| else | ||
| Threaded() = True() | ||
| end | ||
| end |
There was a problem hiding this comment.
Shouldn't we check whether Trixi.jl threading uses Polyester.jl instead? I would expect to get problem when using Base threads in Trixi.jl and Polyester.jl threads in the time integrator.
Implements #2997 (comment)
I am not happy with the name
Threadedsince it is the one "owned" by FastBroadcast.jl,but I am also too tired to come up with a better name.
Replaces #2997