I am new to OpenACC and need some help with the data clauses.
I have a program that copies in some variables and modifies their values on the accelerator, but need not copy them back to the host. The code segment is something like below:
!$acc data copyin(var1)
!$acc end data
!$acc kernels loop present(var1)
var1 = xxxxx
!$acc end kernels
Now I got some strange results and want to check the intermediate value of var1. I have no debugger that supports accelerator, so I thought of copying the intermediate values to the host and print out there. I tried to replace “!$acc kernel loop present(var1)” with the following:
!$acc kernels loop copyout(var1)
!$acc kernels loop present_or_copyout(var1)
then I printed out var1 at end of sub1, I always got the initial value of var1. It seems that the changed var1 was never copied back to the host.