PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

host array into the kernel in pgi fortran

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



Joined: 28 May 2010
Posts: 17

PostPosted: Thu Aug 05, 2010 9:45 am    Post subject: host array into the kernel in pgi fortran Reply with quote

Hi,

Does anyone know whether it is possible to pass a host array into the kernel and use it within the kernel? If so, how should it be declared within the kernel?

I can make this for scalars by declaring them with the 'value' definition within the kernel, but couldn't figure out how to do the same for the arrays?

I know it is possible to do it by storing the host array into a device array and then pass it to the kernel that way. But I am trying to find an alternative way if there is any.

Thanks
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Aug 05, 2010 10:23 am    Post subject: Reply with quote

Hi bguler,

Quote:
Does anyone know whether it is possible to pass a host array into the kernel and use it within the kernel?
No, you must create a device array and then copy the data.

With scalars, you're just passing a single value so is fine but arrays must be passed by reference. Hence, you must pass a pointer to the array held in the device's memory. Passing a pointer to the host array would not work since the device can't access host memory.

- 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