| View previous topic :: View next topic |
| Author |
Message |
Tuan
Joined: 11 Jun 2009 Posts: 226
|
Posted: Sat Jan 23, 2010 7:57 pm Post subject: random number in Accelerator |
|
|
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 |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Fri Jan 29, 2010 12:55 pm Post subject: |
|
|
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 |
|
 |
Tuan
Joined: 11 Jun 2009 Posts: 226
|
Posted: Mon Feb 01, 2010 12:27 pm Post subject: |
|
|
| 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 |
|
 |
|