Please follow below steps,
1)conda create -n opencl_env python=3
2)source activate opencl_env
3)conda install -c conda-forge pyopencl
4)try importing pyopencl
>>> import pyopencl
thank you for your quick answer! I tried out the method you suggested. However, I am not sure whether that fixed the issue.
I can import pyopencl without issues. However, running the following line gives me an error:
>>> import pyopencl as cl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/u13515/.conda/envs/opencl_env/lib/python3.6/site-packages/pyopencl/cffi_cl.py", line 691, in get_platforms
File "/home/u13515/.conda/envs/opencl_env/lib/python3.6/site-packages/pyopencl/cffi_cl.py", line 664, in _handle_error
pyopencl.cffi_cl.LogicError: clGetPlatformIDs failed: <unknown error -1001>
From what I understand this is because the OpenCL driver/runtime for cpu is not correctly configured.
This is what I found from PyOpenCL wiki: https://wiki.tiker.net/OpenCLHowTo#Installing_the_Intel_CPU_ICD
The driver/runtime that the article is referring to is found on this intel page: OpenCL™ Drivers and Runtimes for Intel® Architecture | Intel® Software
I would love to just go ahead and install the drivers/runtimes. However, because they are .rpm, it prompts me to install as a root user.
And so I was unable to install them.
Any idea how to proceed from here?
can you please follow below steps
2)pip install pyopencl --user
3)And before using the module (add to two lines to ~/.bashrc):
4) . ~/.bashrc
after executing all the above steps please try importing pyopencl module