I have a fortran90 code that use chemical species properties (i.e. molecular weight, viscosity, etc.) for calculations.
To easily swap in and out groups of chemical species, we keep module files that store all the relevant data in 1D arrays. I.e. we have 4 species, the viscosity array is 4 elements long, one entry for each species and so on.
The relevant subroutines that need this data can then use
this module, and the chemical data is available as needed.
We have ported a majority of the code to GPU offloading with openMP 4.5 and at the point of porting over these chemical calculations.
What I would like to do is just place the entire module onto the GPU, so that any subroutines that use
these module variables have access to them on the target device.
My initial though was to just !$omp declare target
the module like we do functions or other subroutines, but that doesn't seem to be accepted by the compiler.
Do I really have to !$omp declare target(variable_x, y,z,a,b,c......)
for the entire module?
And if I do that, what is the scope then of these variables? Are they accessible to everything on the device now even if a subroutine doesn't use
the module? Or is the compiler smart enough to keep them within the module scope of the subroutine using them?
Lastly, is there anything special that needs to be done to a subroutine that use
s these modules when I am just creating target regions within the subroutine? For example:
subroutine test
use chem_module
implicit none
integer :: i
!$omp parallel do
do i=1,100
*do some calcs with module data
*do I need to tell the compiler about the chem_module module?
end do
!$omp end parallel do
end subroutine
Thanks for taking a look!
Turns out that just part of the Fortran API... it requires a list and you can't do an encompassing
!$omp declare target
declare stuff...
!$omp end declare target
So yes, you need a massive list as far as I know.