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
CLfolder insideC:/Program Files (x86)/AMD APP SDK/2.9-1/includeand paste it in a separate location such as the directory where you have downloadedpyopencl.zip. - Also copy the
x86_64folder insideC:/Program Files (x86)/AMD APP SDK/2.9-1/liband paste it in the same directory as theCLfolder. - Unzip the folder
pyopencl.zipand go to(location of pyopencl)/src/wrapper - Inside the
wrapperfolder, open the filewrap_cl.hpp. - Change the
#include <CL/cl.h>to#include <cl.h> - Next go to the
CLthat you copied in the first step and open the filecl_platform.h. Repeat step 5 once more. - Next find the
cl_ext.hfile inside theCLfolder and open it. Repeat step 5 again. - Inside a
cmdwindow inadminmode, go to the directory ofpyopencland run the commandpython configure.py. This will generate asiteconf.pyfile that will hold some parameters for installation. - Open the
siteconf.pyfile 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 installfrom thepyopencldirectory and enjoy.
Hope this solution helps you during the installation of PyOpenCL in Windows 8 (x64). Any other suggestions are welcome.