PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

About the indices

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
HuWei39533



Joined: 06 Dec 2012
Posts: 9

PostPosted: Tue May 07, 2013 11:48 pm    Post subject: About the indices Reply with quote

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
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6124
Location: The Portland Group Inc.

PostPosted: Wed May 08, 2013 9:40 am    Post subject: Reply with quote

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
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
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 © phpBB Group