HI, I would like to ask for some help for compiling my OpenACC program. The program is simplified and shown below:
module gulemath
contains
SUBROUTINE pnmcc (A,N,Ifct,fct)
!$acc routine seq
IMPLICIT NONE
INTEGER*4 N,Ifct(:)
COMPLEX*16 A(:)
DOUBLE PRECISION fct(:)
! INTEGER4 N,Ifct(6N+150)
! COMPLEX16 A(N)
! DOUBLE PRECISION fct(6N+150)
INTEGER*4 K,J
DO K=1,N
A(K)=N
ENDDO
END
end module gulemath
program gule
use gulemath
implicit none
integer(kind=4)::i,j,n_east,n_north,num_grid,nmax
real(kind=8),allocatable::fct(:),gravobv(:)
integer,allocatable:: ifct(:)
complex*16,allocatable:: pnmdata_cpx(:)
write(*,*) "n_east,n_north,num_grid,nmax"
read(*,*) n_east,n_north,num_grid,nmax
allocate(gravobv(num_grid))
allocate(pnmdata_cpx(n_east))
allocate(ifct(6*n_east+150))
allocate(fct(6*n_east+150))
!$acc kernels create(pnmdata_cpx)
!$acc loop private(pnmdata_cpx)
do i=1, n_north
pnmdata_cpx=dcmplx(0.D0,0.D0)
!$acc loop independent
do j=1, n_east
pnmdata_cpx(j)=dcmplx(gravobv((i-1)*n_east+j))
end do
call pnmcc(pnmdata_cpx,n_east,ifct,fct)
end do ! loop i
!$acc end kernels
end ! the main program
In the acc kernel region, I would like to define the array pnmdata_cpx as private array for each loop. However, the program could not be compiled successfully. The compile command is:
mpif90 -acc -gpu=cc70 -gpu=cuda11.0 -Minfo ggt.f90 -o ggt
and the error informations are shown below:
pnmcc:
5, Generating acc routine seq
Generating Tesla code
13, Memory set idiom, loop replaced by call to __c_mset16
NVFORTRAN-S-0155-Compiler failed to translate accelerator region (see -Minfo messages): No device symbol for address reference (ggt.f90: 40)
gule:
40, Generating create(pnmdata_cpx(:)) [if not already present]
42, Generating Tesla code
42, !$acc loop seq
43, !$acc loop vector(128) ! threadidx%x
45, !$acc loop vector(128) ! threadidx%x
43, Loop is parallelizable
45, Loop is parallelizable
48, Reference argument passing prevents parallelization: n_east
NVFORTRAN-F-0704-Compilation aborted due to previous errors. (ggt.f90)
NVFORTRAN/x86-64 Linux 20.9-0: compilation aborted
However, the program could be successfully if I remove the clause to define pnmdata_cpx as private:
!$acc kernels create(pnmdata_cpx)
!$acc loop
do i=1, n_north
end do ! loop i
!$acc end kernels
or if I define the arguemnts in the subroutine like this:
SUBROUTINE pnmcc (A,N,Ifct,fct)
!$acc routine seq
IMPLICIT NONE
INTEGER*4 N,Ifct(6*N+150)
COMPLEX*16 A(N)
DOUBLE PRECISION fct(6*N+150)
INTEGER*4 K,J
END
Could you please tell me the reason behind and give me an suggestion for this problem?
Many thanks!