使用 JOCL 确定 GPU 上可用的全局内存?

发布于 2024-11-05 16:44:57 字数 561 浏览 0 评论 0原文

我正在编写一个在 GPU 上运行的 JOCl.org(与 jogamps jocl 不同)。我们正在处理足够的数据,我需要小心保持在 GPU 的全局内存限制以下。为此,我需要一种以编程方式确定 GPU 有多少内存的方法。我认为必须有一个简单的 JOCL 方法/变量来执行此操作,但由于某种原因我似乎无法弄清楚它是什么。我查看了 CL.CL_MEM_SIZE 和 CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 但它们都返回 4100 左右的值;我知道我当前使用的显卡应该包含 512 MB。

另外,我似乎无法使用应有的内存。在最坏的情况下,我必须运行一个处理 2^22 浮点帧的内核,并且内部需要两倍于帧大小的数据。如果我尝试缓存两个帧(因此 2 帧 * 2^22 * 2^2 字节/浮点 * 2 开销 = 2^26),我可以毫无困难地缓存,但是当我增加缓存时,我会以时间(或 2^25*3) 我似乎内存不足。然而,我相信我应该只使用 512 MB 全局内存中的大约 100 个。我相信我在不使用时正确释放内存,但显然我要么做错了什么,要么误解了 GPU 宣传的 512 MB。谁能帮我解释一下这种困惑吗?

有没有办法可以分析 GPU 以了解实际内存使用情况?

I'm writing a JOCl.org (which is different then jogamps jocl) running on GPU. Were working with sufficient data that I need to be careful to stay under the GPU's global memory limit. To do this I need a way of programmatically determining how much memory the GPU has. I assume there must be a simple JOCL method/variable to do this, but for some reason I can't seem to figure out what it is. I've looked at the CL.CL_MEM_SIZE and CL_DEVICE_GLOBAL_MEM_CACHE_SIZE but these both return something around 4100; I know I'm currently working with a graphics card that is suppose to contain 512 MB.

Also, I can't seem to use nearly as much memory as I should. In my worst case scenario I have to run a kernel that processes frames of 2^22 floats and will internally require twice as much data as frame size. If I try to cache two frames (so 2 frames * 2^22 * 2^2 bytes/float * 2 for overhead = 2^26) I can cache without difficulty, but when I increase my caching so I process three frames at a time (or 2^25*3) I appear to run out of memory. However, I believe I should only be using ~100 of my 512 MB of global memory. I believe I'm properly freeing memory when not used, but apparently I'm either doing something wrong or am misinterpreting the GPU's advertised 512 MB. Can anyone help explain this confusion to me?

Is there a way I can profile the GPU to get a sense for actual memory usage?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

破晓 2024-11-12 16:44:57

CL.CL_MEM_SIZE 和 CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 是常量值,用作 clGetDeviceInfo 查询设备的参数。

http://www.jocl.org/doc/org/jocl/CL.html#clGetDeviceInfo(org.jocl.cl_device_id, int, long, org.jocl.Pointer, long[])

clGetDeviceInfo 方法是您用来查询设备信息的方法。它返回您在 param_name 中请求的参数值。该链接包含所有可用参数名称的列表以及简要说明。
(CL_DEVICE_GLOBAL_MEM_SIZE 应该是您正在寻找的那个)。

CL.CL_MEM_SIZE and CL_DEVICE_GLOBAL_MEM_CACHE_SIZE are constant values which are used as parameters for clGetDeviceInfo to query the device.

http://www.jocl.org/doc/org/jocl/CL.html#clGetDeviceInfo(org.jocl.cl_device_id, int, long, org.jocl.Pointer, long[])

The method clGetDeviceInfo is the method you use to query the device information. It returns the value of the parameter you asked for in param_name. The link has a list of all the parameter names available with a brief explanation.
(CL_DEVICE_GLOBAL_MEM_SIZE should be the one you are looking for).

韵柒 2024-11-12 16:44:57

看一下 webstart CLInfo 应用程序:
http://jogamp.org/deployment/webstart-next/jocl-demos /clinfo.jnlp
(项目:http://jogamp.org/jocl-demos/www/
或启动命令行版本:

java -jar jocl.jar:gluegen-rt.jar -Djava.library.path="path/to/jocl/libs:path/to/gluegen-rt/libs" com.jogamp.opencl.util.CLInfo

它将显示所有设备属性的完整读数。 CL_DEVICE_GLOBAL_MEM_SIZE 和 CL_DEVICE_MAX_MEM_ALLOC_SIZE 属性可能是您正在寻找的道具。

[编辑]属性记录在此处: http:// /www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetDeviceInfo.html

take a look at the webstart CLInfo application:
http://jogamp.org/deployment/webstart-next/jocl-demos/clinfo.jnlp
(project: http://jogamp.org/jocl-demos/www/)
or start the commandline version:

java -jar jocl.jar:gluegen-rt.jar -Djava.library.path="path/to/jocl/libs:path/to/gluegen-rt/libs" com.jogamp.opencl.util.CLInfo

it will display the full readout of all device properties. The CL_DEVICE_GLOBAL_MEM_SIZE and CL_DEVICE_MAX_MEM_ALLOC_SIZE properties are probably the props you are looking for.

[edit] properties are documented here: http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clGetDeviceInfo.html

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