I removed everything and used the system package manager. I think the "No module named 'pyopencl._cffi'" and "undefined symbol: clCreateSubDevice" were related to building from source. Using the package manger version seems to avoid these errors.

Which just leaves the "PLATFORM_NOT_FOUND_KHR", and the related CUDA "cuInit failed: no device" error, which is presumably due to misconfiguration.

I don't remember how to fix this. I searched around, and applied commonly reported solutions, but none have worked so far. I'll work on this some more later.

On Thu, May 12, 2016 at 7:56 PM, M.Rule <mrule7404@gmail.com> wrote:
The quick summary:

I get these four errors
  1. Cannot import intern (eminating from six and pytools)
  2. undefined symbol: clCreateSubDevice
  4. No module named 'pyopencl._cffi'
I was able to find forum posts discussing all of the above except the last.

The long story:

System configuration: $ uname -a && cat /etc/lsb-release && lspci | grep NV
  • Linux 3.13.0-24-generic #47-Ubuntu SMP Fri May 2 23:30:00 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
  • DISTRIB_DESCRIPTION="Linux Mint 17.3 Rosa"
  • 01:00.0 VGA compatible controller: NVIDIA Corporation GK208 [GeForce GT 730] (rev a1)
Graphics drivers obtained thusly:
  1. sudo add-apt-repository ppa:xorg-edgers/ppa
  2. sudo apt-get update
  3. sudo apt-get install nvidia-346 nvidia-settings

At first I attempted to install by building the latest OpenCL source from github
  1. sudo apt-get install libboost-all-dev python-setuptools python-numpy libffi-dev nvidia-opencl-dev
  2. git clone --recursive http://git.tiker.net/trees/pyopencl.git
  3. cd pyopencl/
  4. python ./configure.py
  5. make
  6. sudo make install
This runs into trouble when attempting to import "intern" from the package six. The stated resolution to this issue is to modify the pyopencl source to skip this import if it is unavailable. After I did this the same error recurred, this time eminating from pytools. As a workaround, I removed pytools (previously intalled from the system package manager) and reinstalled both it and six for my user using pip:
  1. sudo pip uninstall pytools
  2. sudo pip install six --upgrade --user
  3. sudo pip install pytools --upgrade --user
This resolved the `intern` import error, but then the error `No module named 'pyopencl._cffi'` appeared. I didn't find anyone else with this error via Google, as most people are reporting that they can't find *cffi*, which is in fact installed on my system and imports just fine. Not really knowing what to do, I repeated the install process, this time as described here

I could now import pyopencl without error, but I couldn't run the demos. I got the `PLATFORM_NOT_FOUND_KHR` error. According to the NVidia forums, the solution to this should be to run a script to register the card properly so OpenCL can find it. This doesn't seem to be relevant, as the drivers are already loaded and the appropriate devices are already initialized in /dev.

I rebooted the machine, same error. I cleaned, rebuilt, and reinstalled `pyopencl-2016.1`. I then got a new error: `undefined symbol: clCreateSubDevices`. This post suggested that the workaround is to define `CL_PRETEND_VERSION = "1.1"` in the siteconf.py file within the opencl source directory. I did this and reran `make clean && make && sudo make install`. This did not resolve the issue.

I tried purging the installation and starting again from scratch, but ran into the `No module named 'pyopencl._cffi'` error again. At this point I'm stuck.