Using graphics cards to hand massively parallel tasks can now be realised in python, thanks to PyCuda a module for python which allows interaction with the CUDA libaries/binaries provided by Nvidia. To get this working in ubuntu 10.04 lucid lynx I followed this guide https://wiki.tiker.net/PyCuda/Installation/Linux/Ubuntu.
Prep / Installation:
First install CUDA, most places will tell you that CUDA is incompatible with gcc-4.3 but this is not true if you make a few small changes to the configuration.mk file, please see this post about installing CUDA in ubuntu
Install the required packages (or use package manager):
sudo apt-get install python-numpy -y
sudo apt-get install build-essential python-dev python-setuptools libboost-python-dev -y
Download pycuda from: https://pypi.python.org/pypi/pycuda
Untar the achive:
tar xzvf pycuda-0.94rc.tar.gz
Configure, make and install:
cd pycuda-0.94rc
./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
Problems
I had some problems with the compliation because it was complaining about pytools missing, this was resolved by removing and reinstalling python-setuptools:
sudo apt-get remove python-setuptools
sudo apt-get install python-setuptools
Running the example
You should now be able to run the hellogpu.py demo in the examples folder and use the download-examples-from-wiki.py to download further demos from the pycuda wiki.
Next
I plan to learn how to use PyCuda and aim to make a MD5 cracker as discussed previously (here and here)