Hi,
I used nvfortran-20.9 to compile the following code (nvfortran -acc *.f90 ) and it produces the error:
Module variables used in acc routine need to be in !$acc declare create() - ._dtInit0058
It seems the error is related to the initialization of FaceFluxTest%DiffBb. If I remove the initialization or remove a few variables from the derived type, then there will be no error message.
Did I misuse openacc features? Could you explain what is wrong? Thanks!
module ModAdvance
implicit none
public
integer, parameter:: MinI = -1, MaxI = 4, MinJ = 1, MaxJ = 1, MinK = 1, MaxK = 1, MaxBlock = 2, nVar=2
type, public :: FaceFluxTest
integer :: ii
integer :: iLeft, jLeft, kLeft
integer :: iRight, jRight, kRight
integer :: iBlockFace
real :: r1, r2, r3, r4, r5, r6, r7, r8 ! OK if remove this line
real :: CmaxDt, c1, c2, c3, c4, c5, c6, c7
real :: Area2, AreaX, AreaY, AreaZ, Area
real :: DeltaBnL, DeltaBnR
real :: DiffBb = 0.0 ! OK if no initialization.
end type FaceFluxTest
end module ModAdvance
!===================================================================================
module ModFace
use ModAdvance
implicit none
!-----------------------------------------------------------------
public
contains
subroutine calc_face_value(iBlock)
!$acc routine vector
integer, intent(in):: iBlock
!----------------------------------------------------------------
type(FaceFluxTest) :: FFT
integer:: i,j,k,iVar
!$acc loop vector collapse(3) private(FFT)
do k = MinK, MaxK; do j = MinJ, MaxJ; do i = MinI, MaxI
FFT%ii = k
end do; end do; end do
end subroutine calc_face_value
end module ModFace
!===================================================================================
program main
use ModAdvance
use ModFace, ONLY: calc_face_value
implicit none
integer:: iBlock
!----------------------------------------------------------------
!$acc parallel loop gang
do iBlock = 1, MaxBlock
call calc_face_value(iBlock)
end do
end program main