如何确定 OpenCL 中的可用设备内存?

发布于 2024-09-16 03:37:33 字数 196 浏览 4 评论 0原文

我想知道在分配缓冲区之前我的设备上有多少可用内存。这可能吗?我知道有 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

聆听风音 2024-09-23 03:37:33

不,没有办法,也没有必要知道,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.

怀里藏娇 2024-09-23 03:37:33

您可以在 nVidia 上使用 GL_NVX_gpu_memory_info

You can use GL_NVX_gpu_memory_info on nVidia.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文