Hello,
In a program I am writing I am using mostly global variables which has been working great with !$acc directives. However, I have recently added a module to the code that declares and allocates/deallocates it’s own set of variables. This separate module still uses the global variables module. I have been getting the following error when running the code:
NVFORTRAN-W-1054-Module variables used in acc routine need to be in acc declare create() - y_wm_n$dev
This error still occurs after writing !$acc declare create(y_wm_n). I am not sure how to proceed since I am using the declare create directive. For reference, here is how the variables is declared and created:
integer, parameter :: dp = kind(1.0d0)
integer :: n_wm = 25
!$acc declare create(n_wm)
real(dp), dimension(:), allocatable :: y_wm_n
!$acc declare create(y_wm_n)
allocate(y_wm_n(-1:n_wm))
The (dp) attribute is set in a separate module but works globally for all variables.
I appreciate any and all help!
UPDATE:
I feel I was not really clear on this so I will provide more information. I am writing a computational fluid dynamics solver. I have accelerated one of the subroutines using OpenACC. In this subroutine, I am attempting to call another subroutine, such that the structure of this subroutine/call is:
module fluxes
use equilibriumWallModel
contains
subroutine viscous_fluxes
!$acc parallel loop gang vector collapse(3) default(present)
do k = 0,nk
do j = 0,nj
do i = 0,ni
stuff...
call ewm(i,j,k)
end do
end do
end do
end subroutine viscous_fluxes
end module fluxes
The subroutine viscous_fluxes is inside of a module called fluxes (as shown above) and uses the equilibriumWallModel module so that it can call the needed subroutine (ewm is part of equilibriumWallModel). Now, besides for using global variables that the entire solver uses, the equilibriumWallModel module has it’s own variables and associated memory allocation subroutines. The global variables that equilibriumWallModel uses as well as the ones only associated with equilibriumWallModel are the ones that the compiler says I must use acc declare create for. I am confused about this as well since I am using the managed flag when compiling the code.
Anyways, all subroutines inside the equilibriumWallModel module have the !$acc routine directive at the top of the subroutine. None need to be parallelized, all can be done sequentially. However, there seems to be an issue with calling ewm from inside of the collapsed loop in subroutine viscous_fluxes. I tried making all equilibriumWallModel module variables global instead and also using !$acc declare create for all of them. This at least had the code run but would crash immediately. It seems that the output values of the ewm subroutine have a value of zero, which is unlikely/nonphysical - so there may be some memory transfer issue, I really don’t know.
If there is any other information needed I would be more than happy to provide it. I appreciate any help.