Fix the model "solution" of the previous exercise that still contains a race condition (sum.cpp or sum.F90).
-
Use
reduction
clause to compute the sum correctly. -
(Bonus) Implement an alternative version where each thread computes its own part to a private variable and the use a
critical
section after the loop to compute the global sum.
Try to compile and run your code also without OpenMP.