PyOpenCL in Ubuntu repositories

Ubuntu Maverick Meerkat (10.10) and later contain PyOpenCL packages for architectures amd64 and i386 in multiverse. Package is called python-pyopencl and depends on NVIDIA drivers.


apt-get install python-pyopencl

or


apt-get install python3-pyopencl

Additional Notes (Dell Inspiron laptop with Intel and Nvidia cards)

I am using Ubuntu 12.04 on a Dell Inspiron laptop. I needed to install bumblebee in order to use the Nvidia graphics card. In order to run tests, I needed to do


optirun python examples/benchmark.py

which gave me the error


clRetainDevice, version OPENCL_1.2 not defined in file libOpenCL.so.1

It turns out optirun redefines my LD_LIBRARY_PATH so now I pick up libOpenCL.so.1 from /usr/lib/nvidia-current/libOpenCL.so.1 where I want the one from /usr/lib/x86_64-linux-gnu/libOpenCL.so.1 Once I moved it, for example with


#mv /usr/lib/nvidia-current/libOpenCL.so.1{,.1}

running the benchmark (under optirun, don't forget) gave me


clGetPlatformIDs failed: platform not found khr

which was solved by


#echo libnvidia-opencl.so.1 >> /etc/OpenCL/vendors/nvidia.icd


CategoryPyOpenCl