Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Different results when threads > 3 with openMP

$
0
0

Hi, I am converting some legacy fortran code into openmp version. It uses some external functions like

interface

  function rotTens(x,mat)

  real,intent(in)::x(6),mat(3,3)

  real:: rotTens(6)

  end function

end interface

...

!$omp parallel do &

!$omp default(shared)&

!$omp private(I,j,x,y) &

do I=1, n_time

do j=1, neighbor(I)

   y = rotTens(x,mat)

end do

end do

Results are same up to threads 1~3, but 4 or more threads yield different answer every time (changes every time). The change is very small but noticeable (~0.01%). I checked variables of the function and it seems that memory is corrupted(? inside of the function, rotTens = x*mat  but printing rotTens and x*mat show different values). Such corruption is not found in all loops but in small fractions, randomly. In other words, error or corruption comes from non-consistent points. Very hard to predict or fix.

I haven't had this kind of experience before, and could anyone give me some advice or tip? The OpenMP loop is quite lengthy  (a few hundreds lines) . I tested ifort 13/14.1 and both yielded similar results. Any comments will be greatly appreciated.

Thanks,

 

ByoungSeon


Viewing all articles
Browse latest Browse all 3270

Trending Articles



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