PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

PGI accelerator reflected clause with Fortran partial arrays

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



Joined: 06 Jul 2010
Posts: 21
Location: Cray Exascale Research Initiative, Edinburgh

PostPosted: Wed Jan 26, 2011 7:12 am    Post subject: PGI accelerator reflected clause with Fortran partial arrays Reply with quote

Hi,

I am trying accelerate an application which passes part of a Fortran array to a subroutine. The example below best explains what I mean. The first half of the array is multiplied by 2 and the second half by 3.

I would like the subroutine to use the data in the GPU memory to avoid data copying overheads. I try to do this using the reflected clause.

The code is correct Fortran (and representative of the original application), but I get compiler error messages of the form:
Code:

PGF90-S-0486-The dummy argument v is REFLECTED; an array element cannot be passed to a REFLECTED argument (t.F90: 35)


Am I using the clause wrongly?

Will I be able to do this using the "device resident" clause, when it is supported?

Cheers,
Alistair.

The code is:
Code:

MODULE mm
CONTAINS
   SUBROUTINE double_part(v,n,f)
      IMPLICIT NONE
      INTEGER, INTENT(in) :: n,f
      INTEGER, INTENT(inout) :: v(n)
!$acc reflected(v)                                                             
      INTEGER :: i

!$acc region                                                                   
      DO i = 1,n
       v(i) = f*v(i)
      ENDDO
!$acc end region                                                               

   END SUBROUTINE double_part
END MODULE mm

PROGRAM test
   USE mm
   IMPLICIT NONE

   INTEGER, PARAMETER :: N = 5
   INTEGER :: u(2*N)

   INTEGER :: i,tot,expected

!$acc data region                                                               
!$acc region                                                                   
   DO i = 1,2*N
    u(i) = i
   ENDDO
!$acc end region                                                               

   CALL double_part(u(1),N,2)
   CALL double_part(u(N+1),N,3)

!$acc region                                                                   
   tot = SUM(u(:))
!$acc end region                                                               
!$acc end data region                                                           

   expected = 2*(N*(N+1)/2) + 3*(2*N*(2*N+1)/2-n*(N+1)/2)
   PRINT *,tot," validated? ",(tot == expected)

END PROGRAM test

Back to top
View user's profile
mkcolg



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

PostPosted: Wed Feb 02, 2011 1:35 pm    Post subject: Reply with quote

Hi Alistair,

Right now, reflected can be used on array sections of elements. I sent a note last week to Michael Wolfe to see if it would be possible to add this support. Unfortunately, he's been traveling so has been able to respond. Once I have more information, I'll post it.

Thanks,
Mat
Back to top
View user's profile
xlapillonne



Joined: 16 Feb 2011
Posts: 69

PostPosted: Wed Feb 16, 2011 1:38 am    Post subject: PGI accelerator reflected clause with Fortran partial arrays Reply with quote

Hi,

Is there any update on this subject ? Will it be possible to use "Reflected" on subpart of an array ?

Thanks,

Xavier
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