PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Issue with if statment and pgi 13.2

 
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: Mon Mar 04, 2013 6:16 am    Post subject: Issue with if statment and pgi 13.2 Reply with quote

Hi,

We have some utility fonctions which may be either run on the CPU or on the GPU. In oder to distinguish between the 2 cases we introduced some logical so as to ignore the directives or not. This use to work with PGI 12.10 but not anymore with 13.2 (I didn't try 13.1).

I've made a reproducible example:
Code:

module data_field
  implicit none
  real*8, allocatable :: a(:,:,:),b(:,:,:)
END module data_field

module computation
  implicit none 
contains

! compute a=a+b
subroutine my_add(n1,n2,n3,a,b,lgpu)
  integer, intent(in) :: n1,n2,n3
  real*8, intent(inout)  :: a(n1,n2,n3)
  real*8, intent(in) :: b(n1,n2,n3)
  logical, intent(in) :: lgpu
  integer :: i,j,k


  !$acc data present(a,b) if(lgpu)
  !$acc parallel vector_length(64) if(lgpu)
  DO k=1,n3
     !$acc loop gang
     DO j=1,n2
        !$acc loop vector
        DO i=1,n1
           a(i,j,k)=a(i,j,k)+b(i,j,k)
        END DO
     END DO
  END DO
  !$acc end parallel

  !$acc end data
 
end subroutine my_add

end module computation
 
program main
  USE data_field, only: a,b
  USE computation, only: my_add
  implicit none
  integer :: nargs
  character*10 arg
  integer :: n1,n2,n3

  nargs = command_argument_count()
 
  n3=60
  if( nargs == 2 ) then
     call getarg( 1, arg )
     read(arg,"(I8)") n1
     call getarg( 2, arg )
     read(arg,"(I8)") n2
  else
     print*, 'usage ./test n1 n2'
     STOP
  endif
 
 
 
 allocate(a(n1,n2,n3),b(n1,n2,n3))

 !init
 a(:,:,:)=0.1D0
 b(:,:,:)=0.2D0

 !some computation on the CPU
 !a,b are not allocated on the GPU
 !at this point
 call my_add(n1,n2,n3,a,b,.FALSE.)


 !some computation on the GPU
 !$acc data copy(a), copyin(b)
 !a,b are on the GPU
 call my_add(n1,n2,n3,a,b,.TRUE.)
 !$acc end data
 

 write(*,'(A,F10.1)') 'Result: ', sum(a)

 DEALLOCATE(a,b)

end program main




With pgi 12.10 I get:
Code:

> pgf90 -acc -ta=nvidia -o test_if test_if.f90
Result:   491520.0


With pgi 13.2:
Code:

> pgf90 -acc -ta=nvidia -o test_if test_if.f90
FATAL ERROR: data in PRESENT clause was not found on device 1: name=b
 file:/users/lapixa/GPU/test_openacc/PGI_bug/test_if.f90 my_add line:23



This looks to me like a bug ? Or is it not a valide way of using if statment with OpenACC directives ?

Best regards,

Xavier
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Mar 04, 2013 10:51 am    Post subject: Reply with quote

Hi Xavier,

Looks to me like a bug with the "if" clause. The error is occurring on the first call. Let me get this reported and we'll see what engineer has to say.

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



Joined: 30 Jun 2004
Posts: 445

PostPosted: Tue May 14, 2013 6:25 pm    Post subject: Reply with quote

Xavier,

TPR 19175 has been fixed in the 13.5 release.

regards,
dave
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