-
Notifications
You must be signed in to change notification settings - Fork 95
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
(potential?) data-races #1255
Comments
KrisThielemans
added a commit
to KrisThielemans/STIR-1
that referenced
this issue
Sep 17, 2023
Add missing `atomic write` statements. It might not resolve all problems though, see UCL#1255. Also add an optional compilation variable to guarantee thread-safe operations, but it is slow.
sure, I'll put the second one on my list |
@KrisThielemans : can this be closed? |
I haven't re-run Intel inspector, but as we are not experiencing any problems, I agree we concluse this now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running Intel Inspector (with the Intel compiler) gives me a few data-races. Of course, I'm not sure if these are false positives or not
when checking internal ProjDataInfo data-structures were initialised
STIR/src/include/stir/ProjDataInfoGenericNoArcCorr.inl
Lines 43 to 44 in 9e40811
conflicts with
STIR/src/buildblock/ProjDataInfoCylindricalNoArcCorr.cxx
Line 228 in 9e40811
(and equivalent for Generic).
This implementation of the Double-Checked-Locking(DCL) pattern was suggested at http://stackoverflow.com/questions/27975737/how-to-handle-cached-data-structures-with-multi-threading-e-g-openmp.
I see that I didn't use the
atomic write
in the .cxx [Edit: this is now fixed by #1256], but adding that doesn't seem to make Intel Inspector happy.I can make these disappear by initialising these tables in the constructor, i.e. commenting out lines like
STIR/src/buildblock/ProjDataInfoCylindricalNoArcCorr.cxx
Lines 73 to 74 in 9e40811
However, that causes a slow-down as these tables take a while to construct. For example,
before
after
detector position access in `DetectorCoordinateMap::get_coordinate_for_det_pos`
STIR/src/include/stir/DetectorCoordinateMap.h
Lines 91 to 93 in 9e40811
conflicts with some internal randoms stuff.
This will be because std random generators are not thread-safe.
I think we need one generator per thread (probably a vector of size
get_max_num_threads()
. @markus-jehl feel like looking at that one?The text was updated successfully, but these errors were encountered: