In section 3.2.1 of the CUDA Fortran Programming Guide, it says that device variables and arrays may appear in host and device modules. However, the following simple code always gives the error “copyin Symbol Memcpy FAILED: 13”. I’d appreciate any ideas anyone has.
Thanks!
module cudamod
implicit none
integer, device :: int_d(1)
end module cudamod
program fcuda
use cudafor
use cudamod
implicit none
integer :: int_h(1)
int_h = 0
int_d = int_h
end program fcuda
This is a known problem. Currently, the registering of the structure containing module device data is triggered by the presence of device code in the module. We will address this in a near-term future release.
For now, the work-around is to add a global routine. It doesn’t have to do anything.
contains
attributes(global) subroutine foo
end subroutine
end module cudamod