About the indices

This is the code:

!$acc data copyout(out_acc(1:napracc))
!$acc data copyin(xp(1:np),zp(1:np),up(1:np),wp(1:np))
!$acc parallel loop
do ii=1,nparacc
i = link_listacc(ii,1)
j = link_listacc(ii,2)
drx = xp(i) - xp(j)
drz = zp(i) - zp(j)
out_acc(ii)= drxdrx + drzdrz
enddo
!$acc end parallel
!$acc end data
!$acc end data

it will use indices stored in link_listacc.
so, is that allowable?
thanks very much

it will use indices stored in link_listacc.
so, is that allowable?

Sure, especially since you’re just using these indices to look-up values.

Note, if you we’re using them to write to an array, then you’d need to ensure that the look-up indices were unique since it’s something the compiler can’t determine. If they were not unique, you’d run the risk of having a race condition.

Also, you can combine your data regions into a single region, for example:

!$acc data copyout(out_acc(1:napracc))  &
!$acc   copyin(xp(1:np),zp(1:np),up(1:np),wp(1:np))
  • Mat