2

I've been trying to get PyOpenCL and PyCUDA running on a Linux Mint machine. I have things installed but the demo scripts fail with the error:

pyopencl.cffi_cl.LogicError: clgetplatformids failed: PLATFORM_NOT_FOUND_KHR

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)

Relevant installed packages:

libcuda1-352-updates
libcudart5.5:amd64
nvidia-352-updates
nvidia-352-updates-dev
nvidia-cuda-dev
nvidia-cuda-toolkit
nvidia-opencl-icd-352-updates
nvidia-profiler
nvidia-settings
ocl-icd-libopencl1:amd64
ocl-icd-opencl-dev:amd64
opencl-headers
python-pycuda
python-pyopencl
python3-pycuda
python3-pyopencl

Research

Because I cannot post all the appropriate links here, please see the associated stack overflow post for links reflecting my previous attempts to resolve this issue.

One post described a scenario in which the package-manager installed opencl/cuda implementation don't set up some symlinks correctly. That issue doesn't seem to be present on my system.

There was a version number mismatch between the graphics drivers (were nvidia-340) and the nvidia-opencl package (352). I update the graphics drivers to nvidia-352-updates-dev but the issue remains.

There is a bug in Arch linux that seems to revolve around the necessary device files not being created. However, I've verified that the /dev/nvidia0 and /dev/nvidiactl exist and have permissions 666, so they should be accessible.

Another Stackoverflow post suggests running the demos as root. I have tried this and the behavior does not change.

Older installation instructions for cuda/opencl say to download drivers directly from the NVidia website. Please see an update about the result of this at the end of the post (it was catestrphic)

The same error has been reported for ATI cards on a different linux system, and was resolved by putting proper files in /usr/lib/OpenCL/vendors. That path isn't used on my system, However, I do have /etc/OpenCL/vendors/nvidia.icd which contains the line libnvidia-opencl.so.1, suggesting my issue is dissimilar.

This error has been observed on OSX, but for unrelated reasons. Similar error messages for PyCUDA on OSX also appear to be unrelated.

This error can occur under remote access since the device files are not initialized if X is not loaded. However, I'm testing this in a desktop environment. Furthermore, I've run the manual commands suggested in that thread just to be sure, and they are redundant since the relevant /dev entries already exist.

Some people suggest to run the examples a few times, or run them as sudo, to get things started. This doesn't seem to help.

One post described how the similar cuInit failed: no device CUDA error was caused by not having the user in the video group. To check, I ran usermod -a -G video $USER, but it did not resolve my issue.

In the past, routine updates have broken CUDA support. I have not taken the time to explore every permutation of package version numbers, and it's possible that downgrading some packages may change the situation. However, without further intuition about the source of the issue, I'm not going to invest time in doing that since I don't know whether it will work.

The most common google search result for this error, appearing four times from different sites on the first pages of search results, is a short and unresolved email thread on the PyOpenCL list. Checking the permissions bits for /dev/nvidia0 and /dev/nvidiactl is suggested. On my machine user/group/other all have read and write access to these devices, so I don't think that's the source of the trouble.

I've also tried building and installing PyOpenCL form the latest source, rather than using the version in the repositories. This is failing at an earlier phase which suggests to me it is not building correctly.

Summary

The issue would appear to be that PyCUDA/PyOpenCL cannot locate the graphics card. There are several known issues that can cause this, but none of them seem to apply here. I'm missing something, and I'm not sure what else to do.

Further updates

I tried reinstalling from the deb cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb, downloaded directly from NVidia, but it doesn't seem to install -- I haven't even been able to find the command deviceQuery. I attempted to reinstall from the runfile cuda_7.5.18_linux.run. The installer noted that my machine's configuration was unsupported. I proceeded anyway as a last-ditch effort. Indeed, now the X configuration is completely broken and the machine cannot boot to the login screen. I have not been able to repair this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.