Python LogicError: clGetPlatformIDs failed: platform not found khr

Irina Fateeva picture Irina Fateeva · Aug 16, 2012 · Viewed 9.4k times · Source

While making nosetests for the set of Python programs in Ubuntu an error occurs:

devices = [ d for d in cl.get_platforms()[0].get_devices() if
LogicError: clGetPlatformIDs failed: platform not found khr


File "/home/fateeva/prog/deflectometry/SGMFMeasurement/_PhaseShifts.py", line 30, in <module>
    devices = [ d for d in cl.get_platforms()[0].get_devices() if
LogicError: clGetPlatformIDs failed: platform not found khr

How it's possible to fix it?

Answer

Serhii Yaskovets picture Serhii Yaskovets · Oct 23, 2018

It seems you have pyopencl installed but none of the actual device drivers. Please consult the documentation at https://documen.tician.de/pyopencl/misc.html.

Here is the description of such a behaviour:

Note that PyOpenCL is no fun (i.e. cannot run code) without an OpenCL device driver (a so-called “ICD”, for “installable client driver”) that provides access to hardware through OpenCL. If you get an error message like pyopencl.cffi_cl.LogicError: clGetPlatformIDs failed: , that means you have no OpenCL drivers installed.

Basically, the next command should be enough to get it running on a CPU:

[pip]conda install pocl

For proper installation of AMD and Nvidia devices look for vendor supplied OpenCL drivers.