如何确定OpenCL中的可用设备内存? [英] How do I determine available device memory in OpenCL?
问题描述
我想知道在分配缓冲区之前设备上有多少可用内存.这可能吗?我知道有CL_DEVICE_GLOBAL_MEM_SIZE
表示总内存,而CL_DEVICE_MAX_MEM_ALLOC_SIZE
表示单个对象的最大大小,但是我想知道当前的内存状态.
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.
就目前情况而言,我可能不得不使用OpenGL供应商特定的扩展.
As it stands I'm probably going to have to use OpenGL vendor-specific extensions.
推荐答案
不,没有办法,也不需要知道,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.
这篇关于如何确定OpenCL中的可用设备内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!