You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My C++ is poor at best, but complete_count++; is not thread safe, and is executed in #pragma omp parallel
Since the final check if (complete_count == m_childArray.size()) relies on this being the size of the array there is the potential for this to fail, despite actually being successful where multiple threads write to the ULONG.
I have not been able to replicate this so far so no log output, but I can see this happening at scale.
Version
(Ubuntu 2020) v1.0.0-beta
What component are you seeing the problem on?
No response
Relevant log output
No response
Approvals Process
Testing For Issue
Executive Approval
Merge
The text was updated successfully, but these errors were encountered:
Integer increments are atomic operations so are thread safe. However, I'll change it to std::atomic<> to help with cache issues on multi-CPU machines. Good catch!
My C++ is pretty weak these days but last time I checked increments like this are not guaranteed either by the spec or the compiler to be a single operation. So while they can compile down to increment, they can also be load/increment/store. Again that depends on your compiler settings and if the target architecture supports it.
I shall defer to you on this though, its likely it was setup to support this. Nice to see adding atomic though just in case, and it also makes it easier to see it is expected :)
Contact Details
bboyte01@gmail,com
What happened?
There is a race condition in the following code inside
WISE_Project/cpp/Scenario.cpp
lines 774-810My C++ is poor at best, but
complete_count++;
is not thread safe, and is executed in#pragma omp parallel
Since the final check
if (complete_count == m_childArray.size())
relies on this being the size of the array there is the potential for this to fail, despite actually being successful where multiple threads write to the ULONG.I have not been able to replicate this so far so no log output, but I can see this happening at scale.
Version
(Ubuntu 2020) v1.0.0-beta
What component are you seeing the problem on?
No response
Relevant log output
No response
Approvals Process
The text was updated successfully, but these errors were encountered: