如何确定 OpenCL 中的可用设备内存?
我想知道在分配缓冲区之前我的设备上有多少可用内存。这可能吗?我知道有 CL_DEVICE_GLOBAL_MEM_SIZE
表示总内存,CL_DEVICE_MAX_MEM_ALLOC_SIZE
表示单个对象的最大大小,但我想知道当前的内存状态。
按照目前的情况,我可能不得不使用 OpenGL 供应商特定的扩展。
I would like to know how much free memory there is on my device before allocating buffers. Is this possible? I know there's CL_DEVICE_GLOBAL_MEM_SIZE
for total memory, and CL_DEVICE_MAX_MEM_ALLOC_SIZE
for max size of a single object, but I would like to know the current memory state.
As it stands I'm probably going to have to use OpenGL vendor-specific extensions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不,没有办法,也没有必要知道,GPU 内存可以虚拟化,驱动程序会在需要/不需要时从 GPU 换入/换出内存。
No, there is no way, and there is no need to know it, GPU memory can be virtualized and the driver will swap in/out memory from the GPU when it is/not needed.
您可以在 nVidia 上使用 GL_NVX_gpu_memory_info。
You can use GL_NVX_gpu_memory_info on nVidia.