简体   繁体   English

是否可以使用OpenCL分配设备内存并使用指向CUDA中内存的指针?

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

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). 假设我使用OpenCL来管理内存(以便GPU / CPU之间的内存管理使用相同的代码),但是我的计算使用了优化的CUDA和CPU代码(不是OpenCL)。 Can I still use the OpenCL device memory pointers and pass them to CUDA functions/kernels? 我仍然可以使用OpenCL设备内存指针并将其传递给CUDA函数/内核吗?

AFAIK this is not possible, but there is no technical reason why you shouldn't be able to. AFAIK这是不可能的,但是没有技术原因使您不应该这样做。

NVIDIA could build an extension to the OpenCL API to interoperate with CUDA, much like the interoperability provisions for Direct3D and OpenGL. NVIDIA可以构建对OpenCL API的扩展以与CUDA进行互操作,就像Direct3D和OpenGL的互操作性条款一样。

Since both CUDA and OpenCL can interop with OpenGL you might explore that as a middle ground. 由于CUDA和OpenCL都可以与OpenGL互操作,因此您可以将其作为中间立场。 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). 我已经能够从OpenCL(作为图像)和CUDA成功访问相同的OpenGL纹理,因此您可能能够对数据缓冲区执行相同的操作(我不太肯定OpenGL表示什么) 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM