Installing PyOpenCL on Linux

You're looking at the generic, distribution-independent instructions for installing OpenCL. You may be able to save a fair bit of work by using these distribution-specific instructions:

This tutorial will walk you through the process of building PyOpenCL. To follow, you really only need four basic things:

In addition, PyOpenCL's installation process will automatically download py.test 1.0.2 or newer and pytools. If you are installing without web access, you need to download these packages manually and stick them in the package's root directory before installing.

Step 1: Download and unpack PyOpenCL

Download PyOpenCL and unpack it:

$ tar xfz pyopencl-VERSION.tar.gz

Step 2: Install Numpy

PyOpenCL is designed to work in conjunction with numpy, Python's array package. Here's an easy way to install it, if you do not have it already:

$ cd pyopencl-VERSION
$ su -c "python ez_setup.py" # this will install setuptools
$ su -c "easy_install numpy" # this will install numpy using setuptools

(If you're not sure, repeating these commands will not hurt.)

Step 3: Build PyOpenCL

Next, just type:

$ cd pyopencl-VERSION # if you're not there already
$ python configure.py
$ su -c "make install"

On most systems, your OpenCL headers and libraries should be found automatically. If that's not the case, you may specify their locations using

$ cd pyopencl-VERSION # if you're not there already
$ python configure.py \
  --cl-inc-dir=/opencl-install-location/include \
  --cl-lib-dir=/opencl-install-location/lib \
  --cl-libname=OpenCL
$ su -c "make install"

Once that works, congratulations! You've successfully built PyOpenCL.

Note that this step may automatically look for and, if necessary, install a number of Python packages from the Python package index. These packages are listed under install_requires in PyOpenCL's install control file.

Optional: Boost C++ Libraries

As of version 0.92, the Boost C++ libraries are no longer a dependency of PyOpenCL.

If you would like to use multiple packages that use Boost.Python (e.g. both PyCUDA and PyOpenCL), you can still build PyOpenCL against a separate Boost installation. If so, follow the BoostInstallationHowto. Continue here when you're done.

You may use the following configure/build snippet to specify where you installed Boost:

$ cd pyopencl-VERSION # if you're not there already
$ python configure.py \
  --boost-inc-dir=$HOME/pool/include/boost-1_39 \
  --boost-lib-dir=$HOME/pool/lib \
  --boost-python-libname=boost_python-gcc42-mt \
  --cl-inc-dir=/opencl-install-location/include \
  --cl-lib-dir=/opencl-install-location/lib \
  --cl-libname=OpenCL
$ su -c "make install"

Note that gcc42 is a compiler tag that depends on the compiler with which you built boost. Check the contents of your boost library directory to find out what the correct tag is.


CategoryPyOpenCl

PyOpenCL/Installation/Linux (last edited 2013-05-23 01:27:54 by AndreasKloeckner)