Commit 768819c
authored
Fix data race in the example
We have a data race on the shared variable `sum` (involving unsynchronized modification `+=`) in `long_computation_omp2`.
Fix:
- `default(none)` - prevents inadvertent data races (`nb` was another potential one when not `const`; adjusted)
- `reduction(+ : sum)` - treats `sum` as a reduction variable (with proper synchronization)1 parent 810b0f9 commit 768819c
1 file changed
+2
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
170 | 170 | | |
171 | 171 | | |
172 | 172 | | |
173 | | - | |
| 173 | + | |
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
| |||
0 commit comments