Installing PyCuda on Fedora 13 Linux (and partially on 12)

So far I have just run the 'make tests' of PyCuda successfully, so this may not be complete but wanted to document it thus far.

PyCuda has no package for Fedora 13. All the tests pass on Fedora 13, a couple fail on Fedora 12, most likely due to the version of python-py.

Tested systems:

AMD Phenom(tm) II X4 955, GeForce GT 220, Fedora 13

Intel(R) Xeon(R) CPU E5410, Quadro FX 3700, Fedora 12

Prequisites

Software prerequisites:

  1. python and boost rpms

[x@localhost ~]$ sudo yum install python numpy boost boost-python
[x@localhost ~]$ rpm -qa | grep python
...
python-2.6.4-27.fc13.x86_64
python-py
python-pytools
...
[x@localhost ~]$ rpm -qa | grep numpy
...
numpy-1.3.0-9.fc13.x86_64
...
[x@localhost ~]$ rpm -qa | grep boost
...
boost-python-1.41.0-9.fc13.x86_64
...

  1. setup rpmfusion repository in yum (see http://rpmfusion.org/)

  2. install nvidia drivers from rpmfusion (google how to do this, it's not hard, but iirc, you have to change a kernel boot parameter to disable the default drivers that come along with Fedora)


[x@localhost pycuda]$ rpm -qa | grep vidia
nvidia-settings-1.0-4.fc13.x86_64
xorg-x11-drv-nvidia-libs-195.36.31-2.fc13.x86_64
kmod-nvidia-2.6.33.6-147.fc13.x86_64-195.36.31-1.fc13.1.x86_64
kmod-nvidia-195.36.31-1.fc13.1.x86_64
xorg-x11-drv-nvidia-195.36.31-2.fc13.x86_64
nvidia-xconfig-1.0-2.fc13.x86_64

(sorry, I'm not sure which kmod-nvidia rpm is active, maybe both?)

  1. install cuda stuff from nvidia - follow their directions, and remember where these go for later (for this example: ~x/NVIDIA_GPU_Computing_SDK and ~x/cuda)

cudatoolkit_3.0_linux_64_fedora10.run
gpucomputingsdk_3.0_linux.run

  1. to make life easy(er) .bashrc gets:

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${HOME}/cuda/lib64
export PATH=${PATH}:${HOME}/cuda/bin

  1. (you may need to reboot after installing the nvidia drivers.) check that CUDA install is working

[x@localhost pycuda]$ ls ~x/cuda/
bin  cudaprof  doc  include  lib  lib64  man  open64  openclprof  src
[x@localhost pycuda]$ ~x/NVIDIA_GPU_Computing_SDK/C/bin/linux/release/deviceQuery
CUDA Device Query (Runtime API) version (CUDART static linking)
There is 1 device supporting CUDA

Device 0: "GeForce GT 220"
  CUDA Driver Version:                           3.0
  CUDA Runtime Version:                          3.0
...

Installing PyCuda

  1. Download pycuda from git (as of Tue Jul 27, 2010) http://mathema.tician.de/software/pycuda

git clone http://git.tiker.net/trees/pycuda.git

  1. Run pycuda/configure.py. On Fedora 13 (not 12) it complained about setuptools, I ignored this safely (although had to wait 10 seconds every time :P )

[x@localhost pycuda]$ ./configure.py --cuda-root=/home/x/cuda --cudadrv-lib-dir=/usr/lib64/nvidia --boost-python-libname=boost_python-mt --boost-thread-libname=boost_thread-mt
...

  1. Check that the generated pycuda/siteconf.py has something like: (check CUDA_ROOT, disable USE_SHIPPED_BOOST and verify the names of the boost LIBNAMEs)

BOOST_INC_DIR = []
BOOST_LIB_DIR = []
BOOST_COMPILER = 'gcc43'
USE_SHIPPED_BOOST = False
BOOST_PYTHON_LIBNAME = ['boost_python-mt']
BOOST_THREAD_LIBNAME = ['boost_thread-mt']
CUDA_ROOT = '/home/x/cuda/'
CUDA_TRACE = False
CUDA_ENABLE_GL = True
CUDADRV_LIB_DIR = ['/usr/lib64/nvidia/']
CUDADRV_LIBNAME = ['cuda']
CXXFLAGS = []
LDFLAGS = []

  1. Make it and install it (on fedora 13 this automatically installed py and pytools, on fedora 12 I had to do this manually)

[x@localhost pycuda]$ make ; sudo make install
...
install_dir /usr/lib64/python2.6/site-packages/
...
creating build/bdist.linux-x86_64/egg/pycuda
copying build/lib.linux-x86_64-2.6/pycuda/gpuarray.py -> build/bdist.linux-x86_64/egg/pycuda
...
Installed /usr/lib64/python2.6/site-packages/pycuda-0.94rc-py2.6-linux-x86_64.egg
...
Installed /usr/lib64/python2.6/site-packages/decorator-3.2.0-py2.6.egg
...
Installed /usr/lib64/python2.6/site-packages/py-1.3.2-py2.6.egg
...
Installed /usr/lib64/python2.6/site-packages/pytools-10-py2.6.egg
...
Finished processing dependencies for pycuda==0.94rc

  1. Run the tests...

[x@localhost pycuda]$ make tests
echo "running tests"
running tests
find ./test -type f -name "*.py" -exec python {} \;
32768
*** compiler output in /tmp/tmpswRqql
*** compiler output in /tmp/tmpsodsL8
65536
131072
...
============================= test session starts ==============================
platform linux2 -- Python 2.6.4 -- pytest-1.3.2
test path 1: ./test/test_math.py

test/test_math.py ....................

========================== 20 passed in 13.71 seconds ==========================
============================= test session starts ==============================
platform linux2 -- Python 2.6.4 -- pytest-1.3.2
test path 1: ./test/test_gpuarray.py

test/test_gpuarray.py .................................

========================== 33 passed in 31.92 seconds ==========================
============================= test session starts ==============================
platform linux2 -- Python 2.6.4 -- pytest-1.3.2
test path 1: ./test/test_driver.py

test/test_driver.py ..................

========================== 18 passed in 6.78 seconds ===========================

Help

If you have troubles, I'm happy to help debug your install, feel free to email: tesch1@gmail.com


CategoryPyCuda