I learned that PGI compiler has support for manual deep copying of derived datatypes. I wrote a simple test program to verify this. It compiles cleanly but gives me an error at run time. Where am I making a mistake ?
program Test implicit none type dt integer :: n real, dimension(:), allocatable :: xm end type dt type(dt) :: grid integer :: i grid%n = 10 allocate(grid%xm(grid%n)) !$acc enter data copyin(grid) !$acc enter data pcreate(grid%xm) !$acc kernels do i = 1, grid%n grid%xm(i) = i * i enddo !$acc end kernels print*,grid%xm end program Test
The errors are
call to cuStreamSynchronize returned error 700: Illegal address during kernel execution call to cuMemFreeHost returned error 700: Illegal address during kernel execution
Compiler is PGf90 16.10
Update: Commenting out the line
!!$acc enter data pcreate(grid%xm)
gives the correct result. Does this mean that PGI already supports deep-copying in fortran and I don’t have to create pointers and allocatables on the gpu directly ?