Dear NVIDIA developer,
I want to use the pinned memory in module. An example is as follows:
program test
use cudafor
use pintest
implicit none
integer::nx,ny,nz
nx=8; ny=8; nz=3
allocate(a(nx,ny,nz))
a=3
call addpin()
write(*,"(8(8i3,/))") a(:,:,1)
end program test
module pintest
integer,allocatable,pinned::a(:,:,:)
contains
subroutine addpin()
implicit none
integer::b
b=1
a=a+b
end subroutine addpin
end module pintest
Then I build it use:
nvfortran pintest.cuf test.cuf
then ./a.out
There is Segmentation fault (core dumped)
However, if I move the pinned in the module, it works well.
So could anyone let me know, how could I use pinned memory in module or in a subroutine?
Thanks a lot!