PyOpenCL + POCL in Conda

A quick note on the error: clGetPlatformIDs failed: <unknown error -1001>. This error message is quite confusing and various fixes for different possible causes are all over the Internet.

Usually this error message indicates that the OpenCL drivers are not installed properly. Check:

    1. Both pocl and pyopencl are installed from conda-forge
    2. icd files under <conda-env-prefix>/etc/OpenCL

If your situation is just like mine, where everything appeared to be normal, but the issue persists, you may try to set the environment variable OCL_ICD_VENDORS to be what the icd file points to. For example, this fixes the issue for me:

$ OCL_ICD_VENDORS="$HOME/miniconda3/libpocl.so.2.1.0" python

Once this fixes the issue for you, you can also automate the process of setting this environment variable by creating a shell script in the environment’s directory. See https://conda.io/docs/user-guide/tasks/manage-environments.html#macos-and-linux for detailed instructions.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.