PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

Apparent bug in Fortran device-to-host copies above 2GB

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
PaulDellar



Joined: 13 Apr 2013
Posts: 5

PostPosted: Sat Apr 13, 2013 5:40 am    Post subject: Apparent bug in Fortran device-to-host copies above 2GB Reply with quote

The code below generates an unspecified launch failure when compiled using the version 13.3 Fortran compiler:

array size = 2.000000000000000 GB
0: copyout Memcpy (host=0x2b25cc386020, dev=0xf00100000, size=-2147483648) FAILED: 4(unspecified launch failure)

The array size appears to have been passed to Memcpy as a 32 bit integer.
The same code works correctly with the 12.9 compiler, and with smaller
arrays using the 13.3 compiler.

implicit none
integer, parameter :: mx=256*1024**2
integer i
real*8, device, dimension(mx) :: A,B
real*8, allocatable, dimension(:) :: Ahost
allocate(Ahost(mx))
write (6,*) "array size = ",mx*8d0/1024**3," GB"
B = 42d0
!$cuf kernel do(1) <<< *, * >>>
do i=1,mx
A(i)=B(i)
enddo
Ahost = A
write (6,*) Ahost(4)
end
Back to top
View user's profile
mkcolg



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

PostPosted: Mon Apr 15, 2013 8:17 am    Post subject: Reply with quote

Thanks Paul. I've recreated the problem here and have sent a report (TPR#19285) to engineering for further investigation. You can work around this issue by using allocatable instead of fixed size device arrays.

Code:
% cat testWA.f90
implicit none
integer, parameter :: mx=256*1024**2
integer i
real*8, device, allocatable, dimension(:) :: A,B
real*8, allocatable, dimension(:) :: Ahost
allocate(Ahost(mx))
allocate(A(mx))
allocate(B(mx))
write (6,*) "array size = ",mx*8d0/1024**3," GB"
B = 42d0
!$cuf kernel do(1) <<< *, * >>>
do i=1,mx
A(i)=B(i)
enddo
Ahost = A
write (6,*) Ahost(4)
end
% pgf90 -Mcuda testWA.f90 -V13.3 -Mlarge_arrays ; a.out
 array size =     2.000000000000000       GB
    42.00000000000000     


Best Regards,
Mat
Back to top
View user's profile
jtull



Joined: 30 Jun 2004
Posts: 445

PostPosted: Tue May 14, 2013 5:31 pm    Post subject: TPR 19285 has been corrected in the 13.5 release. Reply with quote

Out now.

dave
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling 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