8 Replies Latest reply on May 24, 2010 1:16 PM by zzblac

    openmp bug? in openf95

    zzblac

      When compiling with -mp, I get an abort when executed with the message:

      zzblac@monster:~/md_dir> Assertion Failed at ../../libopenmp/omp_thread.c:457 Can not create more pthread

      The compiler options are -O3 -IPA:linear=ON -mcpu=barcelona -march=barcelona -OPT:early_intrinsics=ON, -mp, although the results are the same when using only -mp.  The environmental variables are OMP_NUM_THREADS=16 and OMP_SLAVE_STACK_SIZE=4G as anything less, in 1G steps, results in a segfault.  The openmp section of the code is listed below.  This compiles and executes properly on the intel and sun compilers.  I'd really like to use openf95 as I can tune the serial executable to run much faster, at least with the serial version.  The machine has 4 quad core opterons with 64 GB of memory and the OS is opensuse 10.2.  Is this a bug?  If so, any idea when a fix may be available?

       

      SUBROUTINE computeforces (ndim, ra, r, region, regionh, rcut, &
      natom, usum, virsum, nebrtab, nebrtabmax, usumshift, nebrtablen)
      IMPLICIT none
      INTEGER ndim, natom, nebrtabmax, nebrtablen
      REAL(KIND=8) :: rcut, usum, virsum, usumshift, f, fcval, rrcut, &
      rr, rri, rri3, dr (ndim), ra (ndim, natom), r (ndim, natom), &
      region (ndim), regionh (ndim)
      INTEGER :: nebrtab (2, nebrtabmax), j1, j2, k, n
      rrcut = rcut * rcut
      ra = 0.0D0
      usum = 0.0D0
      virsum = 0.0D0
      !$OMP PARALLEL DO DEFAULT (NONE), SCHEDULE(STATIC), &
      !$OMP SHARED (nebrtablen,ndim,regionh,region,rrcut,usumshift,nebrtab,r),&
      !$OMP PRIVATE (n,k,j1,j2,dr,rr,rri,rri3,fcval,f), &
      !$OMP REDUCTION (+:ra,usum,virsum)
      DO 30 n = 1, nebrtablen
      j1 = nebrtab (1, n)
      j2 = nebrtab (2, n)
      DO 50 k = 1, ndim
      dr (k) = r (k, j1) - r (k, j2)
      IF (abs (dr (k) ) >regionh (k) ) then
      dr (k) = dr (k) - sign (region (k), dr (k) )
      ENDIF
      50 END DO
      ! the following line must match the dimensions
      rr = dr (1) * dr (1) + dr (2) * dr (2) + dr (3) * dr (3) &
      + dr (4) * dr (4)
      IF (rr
      rri = 1.0D0 / rr
      rri3 = rri * rri * rri
      fcval = 48.0D0 * rri3 * (rri3 - 0.5D0) * rri
      DO 60 k = 1, ndim
      f = fcval * dr (k)
      ra (k, j1) = ra (k, j1) + f
      ra (k, j2) = ra (k, j2) - f
      60 END DO
      usum = usum + 4.0D0 * rri3 * (rri3 - 1.0D0) + usumshift
      virsum = virsum + fcval * rr
      ENDIF
      30 END DO
      !$OMP END PARALLEL DO
      END SUBROUTINE computeforces