Quick fix to multithreading issue by refining specialization of contravariant vectors#62
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #62 +/- ##
==========================================
- Coverage 89.46% 89.45% -0.01%
==========================================
Files 20 20
Lines 1803 1802 -1
==========================================
- Hits 1613 1612 -1
Misses 190 190 ☔ View full report in Codecov by Sentry. |
benegee
left a comment
There was a problem hiding this comment.
Great fix. Thanks a lot @tristanmontoya !
I am not super familiar with this either, but obviously your specialization works and it contains NDIMS as well as NDIMS_AMBIENT, so it cannot interfere with Trixi's function anymore. The only concern would be that the type is too specific now and does not cover all your cases. If this not an issue, we could go for it.
Thanks! It covers all the cases we use now, and doesn't have a significant impact on performance. We can look for another solution if needed later on. |
|
It would be great to add some CI tests running an example with multiple threads to ensure that the bug does not occur anymore |
This is an attempt to fix the problem @benegee noted in #61, in which the cases which use "standard" Trixi.jl solvers (i.e. not those for PDEs on surfaces) return an error when multiple threads are used, due to TrixiAtmo.jl's specialized
get_contravariant_vectormethod forPtrArraytypes being called inadvertently. I'm not super familiar with the workings ofPtrArray, but looking at the StrideArraysCore.jl code, I was able to figure out what type parameters would be associated with a 2D mesh in 3D space, and therefore hard-coded the dispatch for those dimensions. With this change, the issues in #61 are no longer encountered.