PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

checking for theshold value on whole array with OpenACC

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



Joined: 16 Feb 2011
Posts: 69

PostPosted: Fri Nov 23, 2012 6:03 am    Post subject: checking for theshold value on whole array with OpenACC Reply with quote

Hi,

I want to check for some threshold value on a 3d array. The original fortran code look like that:
Code:

IF (ANY(a(:,:,:)<0.0D0)) ltest=.TRUE.


I've translated this as follows with OpenACC:
Code:

    !$acc parallel vector_length(64) reduction(.or.:ltest)
    do k=1,n3
     !$acc loop gang
     do j=1,n2
        !$acc loop vector
        do i=1,n1
           if (a(i,j,k)<0.0D0) ltest=.TRUE.         
        end do
     end  do
  end do
    !$acc end parallel


Do you have any suggestion for a better implementation ?

Thanks,

Xavier
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Nov 26, 2012 11:35 am    Post subject: Reply with quote

Hi Xavier,

For the basic code, I can't think of anything better. Personally, I'd use the "kernels" construct instead of "parallel" and not set the schedule. After starting testing across multiple devices, letting the compiler set the schedule for each device, allows for greater performance portability.

- 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