|
| View previous topic :: View next topic |
| Author |
Message |
HuWei39533
Joined: 06 Dec 2012 Posts: 7
|
Posted: Tue May 07, 2013 11:48 pm Post subject: 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)= drx*drx + drz*drz
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 |
|
| Back to top |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Wed May 08, 2013 9:40 am Post subject: |
|
|
| Quote: | 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:
| Code: | !$acc data copyout(out_acc(1:napracc)) &
!$acc copyin(xp(1:np),zp(1:np),up(1:np),wp(1:np)) |
- Mat |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2002 phpBB Group
|