Can I allocate device memory using OpenCL and use pointers to the memory in CUDA?

雨燕双飞 提交于 2019-12-20 04:19:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!