Ubuntu9.04にPyCUDAをインストール

http://d.hatena.ne.jp/trex5/20090606/p1
を参考にさせてもらってUbuntu9.04にPyCUDAをインストールに挑戦してmake testsが通ったのでメモしておく。環境は

  • Ubuntu9.04
  • boost 1.39
  • python2.6.2
  • numpy1.2.1
  • pycuda0.93

まず正常にCUDA環境がセットアップされていること(PATH,LD_LIBRARY_PATHなど)。

boostのインストール

/usr/localにインストールする。

$ wget http://downloads.sourceforge.net/project/boost/boost/1.39.0/boost_1_39_0.tar.gz?use_mirror=jaist
$ tar xvzf boost_1_39_0.tar.gz
$ cd boost_1_39_0
$ ./bootstrap.sh \
--prefix=/usr/local \
--with-python=python2.6 \
--libdir=/usr/local/lib \
--includedir=/usr/local/include
$ ./bjam install

numpyのインストール

$ sudo apt-get install python-numpy

pycudaのインストール

$ wget http://pypi.python.org/packages/source/p/pycuda/pycuda-0.93.tar.gz#md5=83aa8e3e06ba8e484913f2f7b081c60b
$ tar xvzf pycuda-0.93.tar.gz
$ cd pycuda-0.93
$ python configure.py \
--boost-inc-dir=/usr/local/include/boost-1_39 \
--boost-lib-dir=/usr/local/lib \
--boost-python-libname=boost_python-gcc43-mt \
--boost-thread-libname=boost_thread-gcc43-mt \
--cuda-root=/usr/local/cuda \
--cuda-enable-gl
$ make
$ sudo make install

test

$ make tests
echo "running tests"
running tests
find ./test -type f -name "*.py" -exec python {} \;
sample size:  8192
.....................
----------------------------------------------------------------------
Ran 21 tests in 0.612s

OK
..................../usr/local/lib/python2.6/dist-packages/pycuda-0.93-py2.6-linux-x86_64.egg/pycuda/gpuarray.py:601: DeprecationWarning: struct integer overflow masking is deprecated
  result.gpudata, start, step, size)
.
----------------------------------------------------------------------
Ran 21 tests in 7.206s

OK
................
----------------------------------------------------------------------
Ran 16 tests in 0.151s

OK