PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

random number in Accelerator

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



Joined: 11 Jun 2009
Posts: 233

PostPosted: Sat Jan 23, 2010 7:57 pm    Post subject: random number in Accelerator Reply with quote

I want to generate random numbers using ACML library. I have a loop to be a kernel, each iteration generate N random numbers. My question is whether DRANDUNIFORM can be used to generate random number directly on the device memory or not? If not, is there a way to do that.

I hope someone can tell me how to avoid copy these random numbers from host to device every iteration of the loop.

Thank you,
Tuan
Back to top
View user's profile
mkcolg



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

PostPosted: Fri Jan 29, 2010 12:55 pm    Post subject: Reply with quote

Hi Tuan,

If you're using ACML, then you would need to copy the data to the device. Though, since you're using CUDA Fortran, you should be able to find a CUDA C version (there's one in the CUDA sdk example code) and call it's kernel from your host code.

For an example on how to call Cuda C from Cuda Fortran, please take a look at the example "$PGI/linux86-64/10.1/etc/samples/test_cublasSgemm.F90". This example show how to create the interface block with iso_c_binding to the kernel you're calling.

Hope this helps,
Mat
Back to top
View user's profile
Tuan



Joined: 11 Jun 2009
Posts: 233

PostPosted: Mon Feb 01, 2010 12:27 pm    Post subject: Reply with quote

mkcolg wrote:
Hi Tuan,

If you're using ACML, then you would need to copy the data to the device. Though, since you're using CUDA Fortran, you should be able to find a CUDA C version (there's one in the CUDA sdk example code) and call it's kernel from your host code.

For an example on how to call Cuda C from Cuda Fortran, please take a look at the example "$PGI/linux86-64/10.1/etc/samples/test_cublasSgemm.F90". This example show how to create the interface block with iso_c_binding to the kernel you're calling.

Hope this helps,
Mat


Appreciated for this valuable information.

Tuan.
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