pyFAI icon indicating copy to clipboard operation
pyFAI copied to clipboard

LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR

Open picca opened this issue 5 years ago • 3 comments

Hello guyes,

I have this issue when using a computer from an ssh connection from a X-terminal whcih has no OpenGL/OpenCL available.

com-diffabs@diffabs6:~$ pyFAI-calib2
ERROR:pyFAI-calib2.UNCAUGHT:clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR
Traceback (most recent call last):
  File "/usr/bin/pyFAI-calib2", line 11, in <module>
    load_entry_point('pyFAI==0.18.0', 'console_scripts', 'pyFAI-calib2')()
  File "/usr/lib/python3/dist-packages/pyFAI/app/calib2.py", line 589, in main
    setup_model(context.getCalibrationModel(), options)
  File "/usr/lib/python3/dist-packages/pyFAI/app/calib2.py", line 311, in setup_model
    import pyFAI.gui.cli_calibration
  File "/usr/lib/python3/dist-packages/pyFAI/gui/cli_calibration.py", line 64, in <module>
    from ..geometryRefinement import GeometryRefinement
  File "/usr/lib/python3/dist-packages/pyFAI/geometryRefinement.py", line 48, in <module>
    from . import azimuthalIntegrator
  File "/usr/lib/python3/dist-packages/pyFAI/azimuthalIntegrator.py", line 182, in <module>
    from .opencl import ocl
  File "/usr/lib/python3/dist-packages/pyFAI/opencl/__init__.py", line 58, in <module>
    from silx.opencl.common import *
  File "/usr/lib/python3/dist-packages/silx/opencl/__init__.py", line 52, in <module>
    from .common import *
  File "/usr/lib/python3/dist-packages/silx/opencl/common.py", line 286, in <module>
    class OpenCL(object):
  File "/usr/lib/python3/dist-packages/silx/opencl/common.py", line 299, in OpenCL
    for idx, platform in enumerate(pyopencl.get_platforms()):
LogicError: clGetPlatformIDs failed: PLATFORM_NOT_FOUND_KHR

picca avatar Jun 28 '19 11:06 picca

Hello again, So the issue is : the screen we are using doesn't have pyopencl or opencl on it. Thus when the script tries using it, we get the error above. The fact is you can import pyopencl even if the screen can't run openCL. Thus the issue should be here :

    try:
        import pyopencl
    except ImportError:
        logger.warning("Unable to import pyOpenCl. Please install it from: http://pypi.python.org/pypi/pyopencl")
        pyopencl = None
    else:
        import pyopencl.array as array
        mf = pyopencl.mem_flags

What do you think about testing pyopencl after importing it before the script runs itself ?

alexmarie78 avatar Jul 05 '19 10:07 alexmarie78

Hi, If I understand well your situation, there is a platform/device on the computer, probably a GPU, one but this device is so tightly bound to the screen that it is not usable when connecting to the computer remotely. This should not be specific to pyFAI or silx and clinfo should crash in a similar way.

If my analysis is correct, this means there is a bug in the driver implementation as any device have a flag called "available" and if the device is unavailable as in your case it should be skipped. Could you please check and report the bug to the OpenCL driver provider then ? thanks in advance.

Don't worry, it is not the first time I see such things and there should be a work-around based on the environment variable "SILX_OPENCL" you have to set to "0" to disable OpenCL.

kif avatar Jul 24 '19 06:07 kif

Hello Jerome,

this is not about OpenCL, but about OpenGL, where an extension is missing.

So it seems to me that the used extensins should be tested , and if not the GUI test using OpenGL should be skipped.

Is it not enough to only check the OpenGL import.

Cheers

picca avatar Jul 24 '19 07:07 picca