OpenACC / CUDA

Hello,

I was wondering if it was yet possible to do OpenACC/CUDA linking? I’m writing up some demo codes/slides to show the various methods of allocating/using memory in OpenACC and an example of getting a deviceptr which is then passed on to CUDA would be handy.

Cheers,
-Nick.

Hi Nick,

CUDA libraries and OpenACC both operate on device arrays. OpenACC provides some mechanisms for interop with library calls: host_data construct gets device address for pointers inside acc data regions; deviceptr data clause passes pre-allocated device data to OpenACC regions and loops.
The same techniques can be used to share device data between OpenACC loops and custom CUDA C/C++/Fortran/etc. device code or any CUDA Library that uses CUDA device pointers.

See http://on-demand.gputechconf.com/gtc/2012/presentations/S0517A-Monday-Programming-GPUs-OpenACC.pdf slide 63+