Data Region across Routines


I have the following setup:

routine A
!$ACC data copyin(arr)
call routine B
!$ACC end data
end routine A

routine B(arr)
!$ACC parallel loop gang present(arr)
do i=1,10
    arr(i) = 1*2
end do
end routine B

The code runs without


but crashes when it is included. The error message is:
FATAL ERROR: data in PRESENT clause was not found on device 1: name=arr
file:/home/karl/code/src/fun.f90 fun line:22

I realise that the present clause isn’t strictly necessary but prefer to be explicit and clearly something weird is going on in this situation.

I’m running tests at the moment to ensure that arr is not being copied every time the kernel in routine B is called.

Thanks in advance,


Additional - Things seem to be working as expected without the present clause - export PGI_ACC_TIME=1 gives the following for the kernel in question:

288: data region reached 50561 times
288: data copyin reached 3 times
device time(us): total=15 max=8 min=0 avg=5

Hi Karl,

This feature is quite mature so I suspect that the error is correct and that “arr” isn’t on the device. Could routine B be called from someplace else outside of a data region? Otherwise, we’d need a reproducing example to determine what’s wrong.

  • Mat

Ah, remind me to use case insensitive greps in the future…

Thanks for the help!