Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Incorrect summation of values using openMP threads

$
0
0

Hi,

My openMP thread tries to do the below:

arr(1) = arr(1) + (a(j) + b(j))

Where j corresponds to the each openmp thread being executed and arr(1) being the shared memory location. The above expression being associative, after the completion of thread it should ideally give me arr(1) equal to serial execution. Unfortunately that does not seem to be the case and I get different results in the arr(1)  everytime I execute (and occasionally the correct value as well). I have also verified the contents of a(j) and b(j) are exactly the same. Is there anything that I am missing here?
Any insights to the above issue?

Thanks
Ajay

 


Viewing all articles
Browse latest Browse all 5691


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>