PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Confusion whilst copying from host to device

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



Joined: 28 Jul 2010
Posts: 68

PostPosted: Thu Jun 28, 2012 7:04 am    Post subject: Confusion whilst copying from host to device Reply with quote

Hello there,

I found an interesting error whilst attempting to copy data from a host array to a device array.

If the host and device arrays are declared to be of different extents i.e.

Code:

   integer,dimension(1000,2000)::host
   integer,allocatable,device,dimension(:,:)::device

   allocate(device(10,31))



and then an attempt is made to copy the relevant host array elements to the device array i.e.

Code:

   device(1:10,1:31)=host(1:10,1:31)


it seems that the cpu is incapable of putting the correct array elements in the correct device array elements on the gpu. All the array elements get muddled up resulting in a segfault or WORSE!

Is there some restriction here that I'm missing or is this a compiler problem? Presumably it's because of the conversion to C when the CUDA memcpy function is called in the background which makes me think there might be a way around it???

Thanks in advance,
Crip_crop
Back to top
View user's profile
toepfer



Joined: 04 Dec 2007
Posts: 47

PostPosted: Fri Jun 29, 2012 2:50 pm    Post subject: Reply with quote

I tried to recreate your example in a small test program, however, I was never able to get the example code to fail. I used a number of different compiler(11.1 - 12.5) and they all worked correctly. If you have a failing case that you can post, and what version of the compiler used, that would be very helpful.
Back to top
View user's profile
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Wed Jul 04, 2012 6:35 am    Post subject: Reply with quote

Hi sorry for the late reply. I managed to fix the problem.... definitely my fault. I had a very well disguised mapping bug but it's fixed now and the copy from host to device works a treat.

Cheers anyways,
Crip_crop
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