1 Aug 02:41
OpenMP and local arrays
Asher Langton <langton2 <at> llnl.gov>
2007-08-01 00:41:45 GMT
2007-08-01 00:41:45 GMT
Hi all, Here's a strange problem involving OpenMP and local arrays that are treated as static: program rd implicit none integer id integer omp_get_thread_num !$omp parallel private (id) id = omp_get_thread_num() call foo (id) !$omp end parallel end program rd subroutine foo (id) implicit none integer id real x(100,100) print *,"thread",id,"loc(x)",loc(x) end subroutine foo Using 'ifort -openmp' or 'pgf90 -mp', each thread has its own copy of the array x. However, with 'gfortran -fopenmp', all of the threads are competing for the same copy of x. It appears that ifort's '-openmp' implies '-auto', and pgf90's '-mp' invokes an internal flag called '-nostatic' (equivalent to '-Mrecursive', I think). I couldn't find a comparable flag in gfortran to invoke with '-fopenmp'. The '-fautomatic' flag (which is on by default) is not(Continue reading)
RSS Feed