Installing PyCUDA on Ubuntu Linux

These instructions were written for Ubuntu 9.04. Ubuntu 8.10 works just like this, except for a changed boost version number. You may also look at the generic instructions if you'd like to install manually.

../Debian generally is very similar to Ubuntu, so those instructions might work, too. Bonus: There are pre-built binary packages on that page.

Step 0: Install gcc4.3 (for Ubuntu 9.10)

Ubuntu 9.10 comes with gcc4.4 by default. CUDA 2.3 is incompatible with this version. You'll need to install gcc4.3.

$ sudo apt-get install build-essential gcc-4.3 g++-4.3
$ cd /usr/bin
$ sudo ln -sf gcc-4.3 gcc

Step 1: Install numpy

You may use Ubuntu's built-in numpy package by typing

$ sudo apt-get install python-numpy -y

or you may install from source if you're aiming for peak (CPU) performance.

Step 2: Download, unpack and install PyCUDA

Install the necessary libraries:

$ sudo apt-get install build-essential python-dev python-setuptools libboost-python-dev libboost-thread-dev -y

Download PyCUDA and unpack it:

$ tar xzvf pycuda-VERSION.tar.gz

Configure, make and install PyCUDA:

$ cd pycuda-VERSION
$ ./configure.py --cuda-root=/usr/local/cuda --cudadrv-lib-dir=/usr/lib --boost-inc-dir=/usr/include --boost-lib-dir=/usr/lib --boost-python-libname=boost_python-mt --boost-thread-libname=boost_thread-mt
$ make -j 4
$ sudo python setup.py install

Some notes:

  1. If you are not installing PyCUDA 0.93 or above, remove the --boost-thread-libname=boost_thread-mt

  2. Modify --cuda-root=/usr/local/cuda if cuda is not installed in /usr/local/cuda .

  3. If you get errors about not being able to find -lboost_python-mt or -lboost_thread-mt, but you know they are in /usr/lib or wherever, make sure the symlinks to those files exist. For example, on Ubuntu 9.10, you might need to make a link libboost_python-mt to libboost_python-mt-py26 (alternatively you can just use --boost-python-libname=boost_python-mt-py26:

    • $ sudo ln -s /usr/lib/libboost_python-mt-py26 /usr/lib/libboost_python-mt
  4. On ubuntu releases using the 'nvidia-current' package (e.g. ubuntu 10.04 Lucid Lynx), you will need to add the following link:
    • $ ln -sf /usr/lib/nvidia-current/libcuda.so /usr/lib/libcuda.so

(Instructions by Nicolas Pinto and Vincent Favre-Nicolin. Please go to the ../../../MailingList for support.)


CategoryPyCuda CategoryPyCuda

PyCuda/Installation/Linux/Ubuntu (last edited 2010-07-28 04:22:39 by 196)