среда, 13 марта 2013 г.

PyCUDA and PyOpenCL installation on Ubuntu 12.04 with NVIDIA graphics

First install newest NVIDIA driver. 'nvidia-experimental-310' from ppa was good for my laptop's GT220M. For desktop's GTX550Ti I needed to install driver manualy from nvidia.com. Next step is to download CUDA pack from developer.nvidia.com, and latest PyCUDA and PyOpenCL from  https://pypi.python.org/pypi/pycuda and https://pypi.python.org/pypi/pyopencl respectively.

Then in command line:
sudo gedit /etc/environment
and add to PATH line the following ':/usr/local/cuda-5.0/bin'
sudo gedit /etc/ld.so.conf
and add lines: /usr/local/cuda-5.0/lib and /lib
sudo gedit /etc/bash.bashrc
and add lines to the end:
export PATH=/usr/local/cuda-5.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-5.0/lib:$LD_LIBRARY_PATH
sudo ldconfig
sudo apt-get install freeglut3-dev python-opengl python-pytools python-setuptools python-numpy libboost1.48-all-dev
sudo ln -s /usr/lib/i386-linux-gnu/libglut.so.3 /usr/lib/libglut.so
sudo sh cuda_5.0.35_linux_32_ubuntu11.10-1.run
So CUDA is installed.
Unpack PyCUDA and enter the directory:
./configure.py --cuda-root=/usr/local/cuda-5.0 --cudadrv-lib-dir=/usr/lib --boost-inc-dir=/usr/include --boost-lib-dir=/usr/lib --boost-python-libname=boost_python-mt-py27 --boost-thread-libname=boost_thread-mt --no-use-shipped-boost
make -j 4
sudo python setup.py install
Now you can try to run sometheing from /example directory.
Unpack PyOpenCL and enter the directory:
python configure.py   --boost-inc-dir=/usr/include/boost   --boost-lib-dir=/usr/lib   --no-use-shipped-boost   --boost-python-libname=boost_python-mt-py27   --cl-inc-dir=/usr/local/cuda-5.0/include/   --cl-lib-dir=/usr/local/cuda-5.0/lib   --cl-libname=OpenCL
sudo make install
From now PyCUDA and PyOpenCL are installed and you can check out some examples. Enjoy GPU computation.
Instructions for AMD/ATI SDK you can find here http://wiki.tiker.net/PyOpenCL/Installation/Linux/Ubuntu . It maybe necessary to replace boost-python library name as it is in my example.

Комментариев нет:

Отправить комментарий