PGF90-S-0155 Load of NULL symbol

Hi,

I am using the following compiler
pgfortran 15.5-0 64-bit target on Apple OS/X -tp haswell
and getting the following error when porting the function below using OpenAcc.

PGF90-S-0155-Compiler failed to translate accelerator region (see -Minfo messages): Load of NULL symbol (kernel/coordinate_jacobian_mod.F90: 1)
coordinate_jacobian:
32, Generating acc routine gang
53, !$acc loop gang ! blockidx%x
54, !$acc loop worker ! threadidx%y
!$acc loop vector ! threadidx%x
56, !$acc loop vector ! threadidx%x
63, !$acc loop worker ! threadidx%y
!$acc loop vector ! threadidx%x
52, Loop is parallelizable
53, Loop is parallelizable
54, Loop is parallelizable
55, Loop carried reuse of jac prevents parallelization
56, Loop is parallelizable
63, Loop is parallelizable
0 inform, 0 warnings, 1 severes, 0 fatal for coordinate_jacobian
make[2]: *** […/…/build/dynamo/kernel/coordinate_jacobian_mod.mod] Error 2

20 !> @brief Subroutine Computes the element Jacobian of the coordinate transform from
 21 !! reference space \hat{\chi} to physical space \chi assuming the coordinate
 22 !! field is in W0
 23 !! @param[in] ndf        Integer. The size of the chi arrays
 24 !! @param[in] ngp_h      Integer. The number of quadrature points in horizontal direction
 25 !! @param[in] ngp_v      Integer. The number of quadrature points in vertical direction
 26 !! @param[in] chi_1      Real 1-dim array. Holds the chi_1 coordinate field
 27 !! @param[in] chi_2      Real 1-dim array. Holds the chi_2 coordinate field
 28 !! @param[in] chi_3      Real 1-dim array. Holds the chi_3 coordinate field
 29 !! @param[in] diff_basis Real 5-dim array. holds the the grad of W0 basis functions
 30 !! @param[out] jac       Real 5-dim array. Holds the values of the Jacobian on quadrature points
 31 !! @param[out] dj        Real 3-dim array  Holds the values of the determinant of the Jacobian on quadrature points
 32 subroutine coordinate_jacobian(ndf, ngp_h, ngp_v, chi_1, chi_2, chi_3, diff_basis, jac, dj)
 33 !-------------------------------------------------------------------------------
 34 ! Compute the Jacobian J^{i,j} = d chi_i / d \hat{chi_j} and the
 35 ! derterminant det(J)
 36 !-------------------------------------------------------------------------------
 37 !$acc routine gang
 38 integer,          intent(in)  :: ndf, ngp_h, ngp_v
 39 real(kind=r_def), intent(in)  :: chi_1(ndf), chi_2(ndf), chi_3(ndf)
 40 real(kind=r_def), intent(in)  :: diff_basis(3,ndf,ngp_h,ngp_v)
 41 real(kind=r_def), intent(out) :: jac(3,3,ngp_h,ngp_v)
 42 real(kind=r_def), intent(out) :: dj(ngp_h,ngp_v)
 43 
 44 ! Hardwired values for cartesian domain
 45 real(kind=r_def) :: dx = 6000.0_r_def, &
 46                  dy = 1000.0_r_def, &
 47                  dz = 2000.0_r_def
 48 
 49 integer :: i, j, df, dir
 50 
 51 
 52 do j = 1,ngp_v
 53   do i = 1,ngp_h
 54     jac(:,:,i,j) = 0.0_r_def
 55     do df = 1,ndf
 56       do dir = 1,3
 57         jac(1,dir,i,j) = jac(1,dir,i,j) + chi_1(df)*diff_basis(dir,df,i,j)
 58         jac(2,dir,i,j) = jac(2,dir,i,j) + chi_2(df)*diff_basis(dir,df,i,j)
 59         jac(3,dir,i,j) = jac(3,dir,i,j) + chi_3(df)*diff_basis(dir,df,i,j)
 60       end do
 61     end do
 62 ! Hard wired values for cartesian biperiodic domain this needs correcting
 63     jac(:,:,i,j) = 0.0_r_def
 64     jac(1,1,i,j) = dx !6000.0_r_def
 65     jac(2,2,i,j) = dy !1000.0_r_def
 66     jac(3,3,i,j) = dz !2000.0_r_def
 67 
 68     dj(i,j) = jac(1,1,i,j)*(jac(2,2,i,j)*jac(3,3,i,j)        &
 69                           - jac(2,3,i,j)*jac(3,2,i,j))       &
 70             - jac(1,2,i,j)*(jac(2,1,i,j)*jac(3,3,i,j)        &
 71                           - jac(2,3,i,j)*jac(3,1,i,j))       &
 72             + jac(1,3,i,j)*(jac(2,1,i,j)*jac(3,2,i,j)        &
 73                           - jac(2,2,i,j)*jac(3,1,i,j))
 74   end do
 75 end do
 76 
 77 end subroutine coordinate_jacobian

The error goes away if I replace the lines(64,65,66) below by replacing the variables by constants.

 jac(1,1,i,j) = 6000.0_r_def 
 jac(2,2,i,j) = 1000.0_r_def 
 jac(3,3,i,j) = 2000.0_r_def

Hi Karthee_s,

This is a known limitation where global static variables can’t be used in device “routines”. When you use data initialization, it has the side effect of forcing the local variable to have global storage which can’t be referenced on the device. If you can, please send a reproducing example to PGI Customer Service (trs@pgroup.com). We hope to have this supported sometime in the near future, but having addition use cases would be helpful.

The work-around should be to initialize these variables in the body of the routine.

real(kind=r_def) :: dx,dy,dz
dx = 6000.0_r_def
dy = 1000.0_r_def 
dz = 2000.0_r_def

Hope this helps,
Mat