After searching a lot for solutions to this problem, I found that this particular error has not been documented properly for Windows. So I have decided to post this issue along with the solution. Sorry if I am posting this in the wrong section. I hope this solution will help users with the PyOpenCL installation error in the future. Please note that the examples used here are for ATI Radeon GPUs
that supports the AMD OpenCL SDK
SDK. For other GPUs
, please refer to their respective parameters and implement them as necessary. Also do not attempt to install using pip
if the installation fails. Instead download a zipped copy of pyopencl
from here.
So the error message while installing PyOpenCL is:
In file included from src/wrapper/wrap_cl.cpp:1:0:
src/wrapper/wrap_cl.hpp:27:19: fatal error: CL/cl.h: No Such File or Directory
error: command 'gcc' failed with exit status 1
In order to solve this, one must know that the default CL/cl.h is usually stored in:C:/Program Files (x86)/.../include/CL
. But since, (x86) is not identifiable by the gcc
compiler, what you can do is this:
- Copy the
CL
folder insideC:/Program Files (x86)/AMD APP SDK/2.9-1/include
and paste it in a separate location such as the directory where you have downloadedpyopencl.zip
. - Also copy the
x86_64
folder insideC:/Program Files (x86)/AMD APP SDK/2.9-1/lib
and paste it in the same directory as theCL
folder. - Unzip the folder
pyopencl.zip
and go to(location of pyopencl)/src/wrapper
- Inside the
wrapper
folder, open the filewrap_cl.hpp
. - Change the
#include <CL/cl.h>
to#include <cl.h>
- Next go to the
CL
that you copied in the first step and open the filecl_platform.h
. Repeat step 5 once more. - Next find the
cl_ext.h
file inside theCL
folder and open it. Repeat step 5 again. - Inside a
cmd
window inadmin
mode, go to the directory ofpyopencl
and run the commandpython configure.py
. This will generate asiteconf.py
file that will hold some parameters for installation. - Open the
siteconf.py
file and replace theCL_INC_DIR = []
withCL_INC_DIR = [r'(path to the new location of the CL folder)']
and replaceCL_LIB_DIR = []
withCL_LIB_DIR = [r'(path to the new location of the x86_64 folder)']
. - Finally in
cmd
, runpython setup.py install
from thepyopencl
directory and enjoy.
Hope this solution helps you during the installation of PyOpenCL
in Windows 8 (x64). Any other suggestions are welcome.