PyOpenCL returns first run errors and then "invalid program" errors; examples also don't work
I try to run the kernel OpenCL
using the bindings pyOpenCL
to run on the GPU. I was trying to load the kernel into my program. I ran my program one day and got an error. I ran it again without changing the code and got another "wrong program" error.
This happens with my own programs using pyOpenCL
as well as sample programs. I can use OpenCL
via bindings C++
, both on CPU and GPU, no problem. So I think this is a bind-specific issue pyOpenCL
.
My OS is Linux Mint 17.1 64 bit. My GPU is an Intel HD HD 4000 3rd Gen processor. I got support OpenCL
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 other 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)
I downloaded one of the pyOpenCL examples for here , but I have 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 ran it again and I had the same "wrong program" error.
I don't understand why the error changed the second time I run the programs, since I didn't change anything in the code between runs.
Hope this is clear enough, thanks.
source to share
I solved it (sort of) by uninstalling beignet
and installing the latest version beignet 1.1.0
, found it here .
However, the only way to get the programs to detect my GPU device and run smoothly is to run them as root. There will probably be another question on this particular issue.
source to share