PGI accelerator reflected clause with Fortran partial arrays

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:

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:

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

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

Hi,

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

Thanks,

Xavier