%%%how to install anaconda,chainer, cuda and cuDNN at first time
%ubuntu 14.04
#installing anaconda
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86_64.sh
chmod +x Anaconda-2.3.0-Linux-x86_64.sh
./Anaconda-2.3.0-Linux-x86_64.sh
#installing chainer
pip install chainer
%installing cuda
sudo wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda
vi .bashrc
%export PATH=/usr/local/cuda-7.5/bin:$PATH
%export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
sudo reboot
%installing anaconda theano
sudo apt-get install g++ libopenblas-dev git
%cuDNN
tar zxvf cudnn-7.0-linux-x64-v4.0-prod.tgz
cd cuda
sudo cp include/cudnn.h /usr/local/cuda/include
sudo cp lib64/libcudnn.so.4.0.7 /usr/local/cuda/lib64/
sudo cp lib64/libcudnn_static.a /usr/local/cuda/lib64/
cd /usr/local/cuda/lib64/
sudo ln -s libcudnn.so.4.0.7
sudo ln -s libcudnn.so.4.0.7 libcudnn.so.4
sudo ln -s libcudnn.so.4 libcudnn.so
% we have to reinstall chainer after installing cuDNN
pip uninstall chainer
pip install chainer
%%%how to install chainer on the pc installed cuda and cuDNN
#installing anaconda
wget https://3230d63b5fc54e62148e-c95ac804525aac4b6dba79b00b39d1d3.ssl.cf1.rackcdn.com/Anaconda-2.3.0-Linux-x86_64.sh
chmod +x Anaconda-2.3.0-Linux-x86_64.sh
./Anaconda-2.3.0-Linux-x86_64.sh
# connecting the path of cuda
vi .bashrc
%export PATH=/usr/local/cuda-7.5/bin:$PATH
%export LD_LIBRARY_PATH=/usr/local/cuda-7.5/lib64:$LD_LIBRARY_PATH
#restart terminal
#installing chainer
pip install chainer
THEANO_FLAGS=floatX=float32,device=gpu
895 thoughts on “GPU(chainer)の使い方”