clGetPlatformIDs 调用中出现错误 -1001!
我正在尝试开始使用 OpenCL。我有两个 NVidia 显卡,我安装了“开发者驱动程序”以及 NVidia 网站上的 SDK。我编译了演示,但是当我运行
./oclDeviceQuery
时,我看到:
OpenCL 软件信息:
clGetPlatformIDs 调用中出现错误 -1001 !!!
我该如何修复它?这是否意味着我的 nvidia 卡无法被检测到?我正在运行 Ubuntu 10.10,X 服务器可以与 nvidia 驱动程序一起正常工作。
我很确定这个问题与文件权限无关,因为它也不适用于 sudo。
I am trying to start working with OpenCL. I have two NVidia graphics card, I installed "developer driver" as well as SDK from NVidia website. I compiled the demos but when I run
./oclDeviceQuery
I see:
OpenCL SW Info:
Error -1001 in clGetPlatformIDs Call
!!!
How can I fix it? Does it mean my nvidia cards cannot be detected? I am running Ubuntu 10.10 and X server works properly with nvidia driver.
I am pretty sure the problem is not related to file permissions as it doesn't work with sudo either.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
就我而言,我通过安装 ubuntu (utopic/multiverse) 中可用的 nvidia-modprobe 包解决了这个问题。驱动程序本身(v346)是从
https://launchpad.net/ 安装的~mamarley/+archive/ubuntu/nvidia
具体来说,我安装了 nvidia-opencl-icd-346、nvidia-libopencl1-346、nvidia-346-uvm、nvidia-346 和 libcuda1-346。不确定 OpenCL 是否都需要它们。
In my case I have solved it by installing nvidia-modprobe package available in ubuntu (utopic/multiverse). And the driver itself (v346) was installed from
https://launchpad.net/~mamarley/+archive/ubuntu/nvidia
Concretely, I have installed nvidia-opencl-icd-346, nvidia-libopencl1-346, nvidia-346-uvm, nvidia-346 and libcuda1-346. Not sure if they are all needed for OpenCL.
这是由于未安装 Nvidia openCL 运行时的 ICD 部分造成的。 ICD 配置文件将指导您的应用程序安装在系统上的不同 openCL 实现,因为来自不同供应商的多个实现可以共存。当您的应用程序找不到 ICD 信息时,它会给出错误 -1001。
This is a result of not installing the ICD portion of Nvidia's openCL runtime. The ICD profile will instruct your application of the different openCL implementations installed on the system as multiple implementations from different vendors can coexist. Whe your application does not find the ICD information it gives the Error -1001.
我在 Linux 系统上也遇到同样的问题。解决方案是将用户添加到视频组:
Same problem for me on a Linux system. Solution is to add the user to the video group:
以 root 身份运行您的程序。如果成功:您在使用 cl_khr_icd- 扩展加载供应商驱动程序时遇到问题。
如果您不运行 X11,则必须手动或通过(引导)脚本创建设备文件:
运行 OpenCL 代码 (Linux) 时出现错误:clGetPlatformIDs -1001
Run your program as root. In case of success: you have trouble with cl_khr_icd- extension to load the vendor driver.
If you not running X11, you have to create device files manually or by (boot-)script:
ERROR: clGetPlatformIDs -1001 when running OpenCL code (Linux)
由于我只花了几个小时,所以我想我会分享:
我收到错误是因为我是通过远程桌面 (mstsc) 连接到计算机的。在机器本身上一切正常。
顺便说一句,我被告知它应该与 TeamViewer 一起使用。
Since I just spend a couple of hours on this, I thought I would share:
I got the error because I was connected to the machine per remote desktop (mstsc). On the machine itself everything worked fine.
I have been told that it should work with TeamViewer by the way.
不知道您是否解决过这个问题,但我遇到了同样的问题并在这篇文章中解决了它: 错误:运行 OpenCL 代码 (Linux) 时出现 clGetPlatformIDs -1001
希望有帮助!
Dont know if you ever solved this problem, but I had the same issue and solved it in this post: ERROR: clGetPlatformIDs -1001 when running OpenCL code (Linux)
Hope it helps!
我已经通过创建链接在 Ubuntu 13.10 saucy for intel opencl 中解决了这个问题:
I have solved it in Ubuntu 13.10 saucy for intel opencl by created link:
我刚刚在 ubuntu 14.04 上遇到了这个问题,我在网上找不到任何有效的答案,包括这个线程(尽管这是第一个出现在谷歌上的)。最终对我有用的是删除所有以前的 nvidia 软件,然后使用 nvidia 网站上提供的 .run 文件重新安装它。由于某种原因,通过 apt-get 安装组件似乎失败了。
1) 下载 CUDA .run 文件: https://developer.nvidia.com/cuda-downloads
2) 清除所有以前的 nvidia 软件包
3) 安装所有运行文件组件(您可能必须停止 X 或在恢复模式下重新启动才能运行此组件)
I just ran into this problem on ubuntu 14.04 and I could not find ANY working answers anywhere online including this thread (though this was the first to show up on google). What ended up working for me was to remove ALL previous nvidia software and then to reinstall it using the .run file provided on the nvidia website. Installing the components through apt-get seems to fail for some reason.
1) Download CUDA .run file: https://developer.nvidia.com/cuda-downloads
2) Purge all previous nvidia packages
3) Install all run file components (you will likely have to stop X or restart in recovery mode to run this)
这是因为 OpenCL 与 OpenGL 一样,每个供应商设置一个库,都会造成大脑损伤。 -1001 错误的一个可能原因是您使用的库与链接器尝试动态加载的库不同。
所以看看这是否是运行的问题:
Does the path point to the NVidia-provided libOpenCL.so.1 file?如果没有,您应该使用指向包含 NVidia 的 libOpenCL.so.1 的目录的
-L
参数重新编译程序。如果你不能这样做,你可以像这样覆盖链接器的路径:This is because OpenCL has the same brain damaged one library per vendor setup that OpenGL has. A likely reason for the -1001 error is that you have compiled with a different library than the linker is trying to dynamically load.
So see if this is the problem run:
Does the path point towards the NVidia-provided libOpenCL.so.1 file? If it doesn't, you should recompile the program with an
-L
parameter pointing towards the directory containing NVidia's libOpenCL.so.1. If you can't do that, you can override the linker's path like this:对我来说,我缺少 CUDA OpenCL 库,运行 sudo apt install cuda-opencl-dev-12-0 解决了它。
For me, I was missing the CUDA OpenCL library, Running
sudo apt install cuda-opencl-dev-12-0
solved it.您应该获取平台数量,为平台分配内存,再次获取该平台,然后从该平台创建上下文。有一个很好的例子:
http://developer.amd.com/support/KnowledgeBase /Lists/KnowledgeBase/DispForm.aspx?ID=71
You should get number of platforms, allocate the memory for platforms, again get this platforms and then create context from this platform. There is good example:
http://developer.amd.com/support/KnowledgeBase/Lists/KnowledgeBase/DispForm.aspx?ID=71
这可能是由于多个线程同时查询 clGetPlatformIDs
This might be due to querying clGetPlatformIDs by multiple threads at the same time