PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Reduction not recognized in Fortran
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
mkcolg



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

PostPosted: Fri Jun 01, 2012 10:46 am    Post subject: Reply with quote

Hi Sayan,

Quote:
Is there a way that the compiler would be able to recognize the array reduction inside the acc region and make it parallel?
Yes, the compiler will automatically detect reductions and generate an optimal parallel reduction code. Though, the reduction variable must be a scalar and the reduction performed across the outer loop.

For example:
Code:
sum =0
!$acc region
    do k=k0,k1
   do j=j0,j1
      do i=i0,i1
          sum = sum + u(i,j,k)
       enddo
      enddo
   enddo
  !$acc end region


As part of our OpenACC implementation were working on adding support for inner loop reductions.

Code:

!$acc parallel
!$acc loop gang
    do k=k0,k1
    sum = 0
!$acc loop vector(32), reduction(+:sum)
   do j=j0,j1
          sum = sum + u(j,k)
      enddo
     array(k) = sum
   enddo
  !$acc end parallel


- Mat
Back to top
View user's profile
_sayan_



Joined: 07 Apr 2012
Posts: 29

PostPosted: Fri Jun 01, 2012 11:06 am    Post subject: Reply with quote

Thanks, great info.
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
Goto page Previous  1, 2
Page 2 of 2

 
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