-
Notifications
You must be signed in to change notification settings - Fork 1
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 race condition in read-modify-write PDF vectors in parallel loop in onesource::generatePDF() #196
Comments
Hello, looking at the code, I'd say it's a simple matter of adding the variables to the list of private reduction variables automatically supported by the OpenMP loop. The resulting pragma would look like this:
This might cause a slight slowdown in the algorithm due to the extra copies required by the private arrays, but it's required if a race condition really exists. |
A possible way to automatically check for data races is by using the Thread Sanitizer library. It works like the Address Sanitizer, integrated with the compiler. I have never used it, so I can't confirm it always catches the races. https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual |
I am pretty sure that these have just been forgotten by mistake. I will add them in a branch soon to be merged. |
Fixed by #209 |
Hello, there seems to be some output variables that are being used with a read-modify-write instruction in the auto parallelized loop without being private to each parallel thread, potentially causing a race condition. The result to the code would be some PDF vectors with certain points with lower probability than calculated sequentially (if the race condition really happens in practice). The variables are:
PDFldustloc
PDFcol1loc
PDFcol2loc
PDFmrefloc
This could be confirmed with a dataset that makes it suitable for the race to happen and two different versions of the library, one multi-threaded and another single-threaded. (and some way to decide that the floating point results differ significantly).
lephare/src/lib/onesource.cpp
Line 894 in dbe015b
lephare version: main branch dbe015b
Before submitting
Please check the following:
The text was updated successfully, but these errors were encountered: