I am trying to understand how fortran pointers work in OpenACC.
I know OpenACC keeps separte device and host pointers, but I do not understand how explicitly declared fortran pointers are handled. The following code fails if I comment out the declar present§ in the subroutine, but it works if I don’t. In the code I am working on, always pointers to structures (“type(data), pointer:: p”) is passed to subroutines, and it would be a lot more convenient if i can just declare present that in the beginning.
I also tried to declare create§ and then update device§ during the assignment =>, that also doesn’t work.
program test integer, target :: x !$acc declare create(x) integer, pointer :: p !$acc declare create(p) x = 2 p => x !$acc kernels p => x !$acc end kernels call pr(p) contains subroutine pr(p) integer, pointer :: p !$acc declare present(p) !$acc kernels p = 10 !$acc end kernels print*, p end subroutine end program test