Can I allocate device memory using OpenCL and use

2019-03-02 20:38发布

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?

2条回答
我命由我不由天
2楼-- · 2019-03-02 20:52

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).

查看更多
劳资没心,怎么记你
3楼-- · 2019-03-02 21:04

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.

查看更多
登录 后发表回答