Hello,
I have some Fortran code where some general parameters are defined in one module, and then in used in a separate module that initializes the data values.
module genParamsMod
real(kind=8) :: pi, twoPi, pid2, degs, rad, logten, fp0, c, earthr, plat, plon
parameter( pi=3.1415926535897932384626433d0, & ! pi
twoPi = 6.283185307179586476925287d0, & ! 2 pi
pid2 = 1.570796326794896619231322d0, & ! pi/2
rad = 0.01745329251994329576923691d0, & ! pi/180
degs = 57.29577951308232087679815d0, & ! 180/pi
logten = 2.302585092994045684017991d0, & ! ln(10)
c = 2.997925d5, & ! speed of light in vacuum, km/s
earthr = 6371.0990d0, & ! earth radius, km
plat = 1.37183d0, & ! magnetic pole latitude
plon = -1.21824d0 ) ! magnetic pole longitude
end module genParamsMod
When i compile the code I am getting the error
Module variables used in acc routine need to be in !$acc declare create()
This seems simple enough to fix with an added directive:
module propMod
use genParamsMod
implicit none
contains
subroutine initArray(var1,var2,var3)
real(kind=8), dimension(:), intent(inout) :: var1, var2, var3
!$acc declare create(pi, twopi)
var1 = 0.0d0
var2 = pi
var3 = twopi
end subroutine
end module
I get the error
PGF90-S-0000-Internal compiler error. memsym_of_ast:unexp.ast 0
In this case I think I’ll have the simple workaround of adding the variables pi and twopi (etc) locally, but my worry is that either 1. this latter error is a bug, and this is the first of a chain of locations where it will pop up as I add the local variable workaround (defeating the point of having module variables) or – and much more likely – 2. I’ve done something else wrong, but can’t yet figure that out based on the current information from the compiler. Perhaps it has something to do with the scalars being parameters?