This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

OpenMP and local arrays


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
the same as ifort's '-auto', is it?  It seems to just be the opposite
of '-fno-automatic', but doesn't necessarily make all locally-scoped
variables automatic.  Is there any flag that can be set automatically
by -fopenmp to force local variables to be automatic?


Thanks,
Asher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]