OpenCL+NVidia 的专有计算模式
我对 NVidia+OpenCL 的独占计算模式有疑问。
我可以在 nvidia-gpu 上使用 nvidia-smi 设置独占计算模式(cuda 编程指南 3.0 第 74 页)。这意味着只有一个程序可以在 GPU 上进行计算。
cuda运行时比应用程序自动安排。
但在这种情况下我对 opencl 程序有一个问题: 如果一个应用程序在设置了独占计算模式的 GPU 上运行,并且第二个 opencl 程序使用同一 GPU 调用 clGetDeviceInfo(..., CL_DEVICE_AVAILABLE, ...),则结果 == CL_TRUE 。之后,如果 opencl-app 尝试在此设备上创建上下文,则会导致正在运行的应用程序崩溃(两者)。
如何通过 OpenCL 找到可用的 GPU?
谢谢。
I have a question to exclusive compute mode with NVidia+OpenCL.
I can set up exclusive compute mode (page 74 from cuda programming guide 3.0) with nvidia-smi on a nvidia-gpu . that means, only one program can compute on gpu.
cuda runtime schedules than app automatically.
but I have a problem with opencl-programs in this case:
if one application runs on a gpu with setted exclusive compute mode and second opencl-program calls clGetDeviceInfo(..., CL_DEVICE_AVAILABLE, ...)
with the same GPU is the result == CL_TRUE
. After that if opencl-app tries to create a context on this device, than crashes the running app (both).
How can i find out an available GPU with OpenCL?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
clGetDeviceIds 返回设备数量及其设备 ID。然后您可以检查每个设备是否可用。我不确定它是否能解决崩溃问题。
clGetDeviceIds returns the number of devices and their device Ids. Then you can check if each of the device is available or not. Iam not sure if it would resolve the crash though.
我也遇到过类似的问题,我想在列表中找到最好的 OpenCL 设备。我找不到解决方案,所以我自己写了一个。它将尝试在设备上创建上下文。如果不能,它将尝试下一个。
它还支持多个 OpenCL 平台。您可以选择 nvidia(仅限 GPU)、amd(gpu 和 cpu)、intel(cpu)和 apple(gpu 和 cpu)。
可以在 github 上找到它: https://github.com/nbigaouette/oclutils/
您 但仍在寻找更好的锁定机制。
I've had a similar issue where I wanted to find the best OpenCL device in a list. I couldn't find a solution so I've wrote one myself. It will try to create a context on a device. If it can't, it will try the next one.
It also supports multiple OpenCL platforms. You can choose between nvidia (gpu only), amd (gpu & cpu), intel (cpu) and apple (gpu & cpu).
You can find it on github: https://github.com/nbigaouette/oclutils/
I'm still looking for a better locking mechanism though.