PyOpenCL第一次运行时返回错误,然后仅返回“无效程序"错误;例子也行不通 [英] PyOpenCL returns errors the first run, then only 'invalid program' errors; examples also not working
问题描述
我正在尝试使用pyOpenCL
绑定运行OpenCL
内核,以便在GPU上运行.我试图将内核加载到程序中.我运行了一次程序,但出现错误.我不更改代码再次运行,并收到了另一个无效程序"错误.
I am trying to run an OpenCL
kernel using the pyOpenCL
bindings, to run on the GPU. I was trying to load the kernel to my program. I ran my program once and got an error. I ran it again without changing the code and got a different, 'invalid program' error.
在使用pyOpenCL
的我自己的程序以及示例程序中,这种情况一直在发生.我可以在CPU和GPU上通过C++
绑定使用OpenCL
,没有问题.所以我认为这是pyOpenCL
绑定特有的问题.
This keeps happening to my own programs using pyOpenCL
and also on example programs. I am able to use OpenCL
through the C++
bindings, on both the CPU and GPU, with no problems. So I think this is a problem specific to the pyOpenCL
bindings.
我的操作系统是Linux Mint 17.1 64位.我的GPU是Intel HD Graphics 4000第三代处理器.我通过安装beignet
获得了对OpenCL
的支持(请参见此处)) .我正在使用python 2.7
和OpenCL 1.2
.
My OS is Linux Mint 17.1 64 bit. My GPU is an Intel HD graphics 4000 3rd Gen processor. I got the OpenCL
support for it by installing beignet
(see here). I am using python 2.7
and OpenCL 1.2
.
我第一次运行程序时,出现此错误:
The first time I ran my program, I got this error:
File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 463, in kernel_call
self.set_args(*args)
File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 488, in kernel_set_args
% (len(args), self.num_args))
AssertionError: length of argument list (4) and CL-generated number of arguments (9) do not agree
但是随后我再次运行它,并开始出现此不同错误:
But then I ran it again, and started getting this different error:
File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 206, in _build_and_catch_errors
raise err
pyopencl.RuntimeError: clBuildProgram failed: invalid program -
Build on <pyopencl.Device 'Intel HD Graphics Family' on 'Experiment Intel Gen OCL Driver' at 0x7fb77bf21720>:
(options: -I /usr/lib/python2.7/dist-packages/pyopencl/cl)
(source saved as /tmp/tmplLRgy9.cl)
我在此处下载了pyOpenCL示例之一,但我得到了相同的结果问题:我第一次运行它,我得到了:
I downloaded one of the pyOpenCL examples for here but I got the same problem: the first time I ran it, I got:
File "/usr/lib/python2.7/dist-packages/pyopencl/__init__.py", line 436, in __getattr__
return self.event.get_profiling_info(inf_attr)
pyopencl.RuntimeError: clGetEventProfilingInfo failed: profiling info not available
...然后我再次运行它,并且从以前收到了相同的无效程序"错误.
...and then I run it again, and I got the same 'invalid program' error from before.
我不明白为什么第二次运行程序时错误会更改,因为两次运行之间的代码没有更改.
I don't understand why the error changes the second time I run the programs, since I didn't change anything in the code in between runs.
希望这很清楚,谢谢.
推荐答案
我通过卸载beignet
并安装了最新版本beignet 1.1.0
来解决了(某种)问题,找到了
I solved it (sort of) by uninstalling beignet
and installing the latest version, beignet 1.1.0
, found here.
但是,使程序能够检测我的GPU设备并正常工作的唯一方法是以root身份运行它们.可能会针对该特定问题发布不同的问题.
However, the only way to get the programs to detect my GPU device and work with no problems is by running them as root. Will probably post a different question for that specific issue.
这篇关于PyOpenCL第一次运行时返回错误,然后仅返回“无效程序"错误;例子也行不通的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!