We’re trying to run some fortran code using OpenMP and device offloading supported by nvfortran. Most of our code compiles and runs just fine, but a few of the files generate odd errors that won’t go away unless I completely remove the OpenMP directives. I’ve generated a simple test program that replicates the error:
module testmod
use, intrinsic :: iso_fortran_env
IMPLICIT NONE
INTEGER, PARAMETER :: RPREC = REAL64
INTEGER, PARAMETER :: IPREC = INT32
INTEGER, PARAMETER :: ISIZE = 100
INTEGER, PARAMETER :: JSIZE = 100
INTEGER, PARAMETER :: KSIZE = 100
INTEGER, PARAMETER :: ESIZE = 200
REAL (rprec) :: bigArray1(isize, jsize, ksize, esize)
REAL (rprec) :: storage(isize, jsize)
CONTAINS
SUBROUTINE testSubroutine ( )
IMPLICIT NONE
INTEGER (iprec) :: i, j, k
REAL (rprec) :: offset
storage (:,:) = 0.0_rprec
do k=1,ksize
!$OMP PARALLEL DO &
!$OMP schedule(dynamic) &
!$OMP DEFAULT (NONE) &
!$OMP PRIVATE(i,j,offset) &
!$OMP SHARED(k,jsize,isize,storage)
DO j = 1,jsize
DO i = 1,isize
offset = i+j
storage (i, j) = storage (i, j) + offset
ENDDO !i
ENDDO !j
enddo
END SUBROUTINE testSubroutine
end module testmod
If I compile that code with this command:
nvfortran -mp=gpu -g -c testmod.F90
Where the code is in the file named testmod.F90, then it generates this output:
testsubroutine:
29, !$omp parallel
<path>/bin/llc: error: <path>/bin/llc: <path>/nvfortranIWujMoeNmkBA.ll:338:75: error: expected unsigned integer
!75 = !DIExpression(DW_OP_plus_uconst, 0, DW_OP_deref, DW_OP_plus_uconst, -1094967168)
If I try to compile with “-mp” instead of “-mp=gpu”, or without the “-g” flag, then it compiles successfully. Also if I reduce the size of the arrays in the code, for example by reducing the “ESIZE” variable to 100, it will also compile successfully.
In our actual code we can’t reduce the size of the arrays, and we are using device offloading in the same file as code that isn’t offloaded. So we would like to be able to compile the non-offloaded code with debug info if there are any work-arounds possible.
Thanks for any assistance!
Jeff