PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

debug pgi cuda fortran code

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



Joined: 09 Jan 2013
Posts: 9

PostPosted: Tue Jan 15, 2013 5:07 pm    Post subject: debug pgi cuda fortran code Reply with quote

Hi,

It appears that pgi cuda fortran does not allow "print" in gpu. So I tried to use emulate mode -Mcuda=emu to compile the code. However, when I ran my code, I got this error message:


Error in cudaMemcpy ... 1



This is the subroutine containing such error message:

*******

subroutine wrap_cudaMemcpyHostToDevice(dstPtr, srcPtr, n)
c input parameters
real, device, allocatable, dimension(:) :: dstPtr
real, dimension(:) :: srcPtr
integer :: n

c temporary
integer error

c cudaMemcpy
error = cudaMemcpy(dstPtr, srcPtr, n, cudaMemcpyHostToDevice)

c error checking
if (error.ne.0) then
print *, "Error in cudaMemcpy ... 1"
c print *, "Error in cudaMemcpy ...", cudaGetErrorString(error)
stop
endif
end subroutine

********

I used pgi-12.4.0 compiler.

Can you suggest the cause for this error message?

Thanks,

SJZ
Back to top
View user's profile
mkcolg



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

PostPosted: Tue Jan 15, 2013 5:27 pm    Post subject: Reply with quote

Hi SJZ,

I'm not sure why you're getting this error since we support cudaMemcpy in emulation mode. I'd need a reproducing example to tell. Though, I'd remove the "allocatable" argument from the definition of "dstPtr" since this can cause problems (in general not just for CUDA Fortran).

Also, I'm wondering why you're using cudaMemcpy at all. You can simply use the assignment operator "dstPtr = srcPtr" to do the same thing.

FYI, we did add printing from device kernels in a later compiler version (though you need a cc20 device or newer).

- Mat
Back to top
View user's profile
sjz



Joined: 09 Jan 2013
Posts: 9

PostPosted: Wed Jan 23, 2013 1:12 pm    Post subject: Reply with quote

Hi,

I used dstPtr=srcPtr as you suggestion (see the code below). It passed that point but crashed.

What is the place I can post the whole code to make this emulation mode work?

Thanks a lot,

SJZ




pass dstPtr=srcPtr, Error in cudaMemcpy ... 1
pass dstPtr=srcPtr, Error in cudaMemcpy ... 1
pass dstPtr=srcPtr, Error in cudaMemcpy ... 1
pass dstPtr=srcPtr, Error in cudaMemcpy ... 1
pass dstPtr=srcPtr, Error in cudaMemcpy ... 1
before calling soluvGPU
Segmentation fault



c-----------------------------------------------
c cudaMemcpy wrapper
c-----------------------------------------------
subroutine wrap_cudaMemcpyHostToDevice(dstPtr, srcPtr, n)
c input parameters
c real, device, allocatable, dimension(:) :: dstPtr
real, device, dimension(:) :: dstPtr
real, dimension(:) :: srcPtr
integer :: n

c temporary
integer error

c cudaMemcpy
c error = cudaMemcpy(dstPtr, srcPtr, n, cudaMemcpyHostToDevice)
dstPtr=srcPtr

print *, "pass dstPtr=srcPtr, Error in cudaMemcpy ... 1"

c error checking
c if (error.ne.0) then
c print *, "Error in cudaMemcpy ... 1"
c print *, "Error in cudaMemcpy ...", cudaGetErrorString(error)
c stop
c endif
end subroutine
Back to top
View user's profile
mkcolg



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

PostPosted: Wed Jan 23, 2013 2:00 pm    Post subject: Reply with quote

Hi sjz,

Send it to PGI Customer Service (trs@pgroup.com) or FTP it to us (https://www.pgroup.com/support/ftp_access.php). If you ftp, just let us know so we know when to get the package.

- Mat
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