问题
Say I use OpenCL to manage memory (so that memory management between GPU/CPU uses the same code), but my calculation uses optimized CUDA and CPU code (not OpenCL). Can I still use the OpenCL device memory pointers and pass them to CUDA functions/kernels?
回答1:
AFAIK this is not possible, but there is no technical reason why you shouldn't be able to.
NVIDIA could build an extension to the OpenCL API to interoperate with CUDA, much like the interoperability provisions for Direct3D and OpenGL.
回答2:
Since both CUDA and OpenCL can interop with OpenGL you might explore that as a middle ground. I was successfully able to access the same OpenGL texture both from OpenCL (as an image) and CUDA, so you might be able to do the same thing for a buffer of data (I'm not positive what the OpenGL representation would be though).
来源:https://stackoverflow.com/questions/29669780/can-i-allocate-device-memory-using-opencl-and-use-pointers-to-the-memory-in-cuda