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

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.