OpenCL/OpenACC interoperability with Optix


It is well documented that Optix supports interoperability with CUDA:

Is it possible to use an OpenCL (or an OpenACC) program to, using the documentation’s CUDA example, determine which rays to trace without having to move data from an OpenCL created variable in GPU memory to the host system’s main (CPU) memory, transform it into an Optix construct, and then send it back to the GPU?

I ask because we have a number of existing CPU-only libraries that are used in our path generation process (which currently uses Intel Embree as a ray tracer) that we would like to re-implement with GPU acceleration while maintaining CPU fallback if no GPU is present.

Looks like one can use select buffers from OpenGL in both OpenCL and CUDA, but using that as a ‘bridge’ likely isn’t going to be elegant or fast…

As long as you can communicate device pointers between CUDA and {OpenCL,OpenACC}, then it will also work with OpitX. I’ve never tried either myself, but from a quick search it looks like OpenACC-CUDA interop is already supported, and OpenCL-CUDA interop might be tricky.