安裝所需環(huán)境
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get install -y gcc g++ gfortran build-essential git wget linux-image-generic libopenblas-dev
安裝cuda
sudo wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.0-28_amd64.deb
sudo dpkg -i cuda-repo-ubuntu1404_7.0-28_amd64.deb
sudo apt-get update
sudo apt-get install -y cuda
echo -e "\nexport PATH=/usr/local/cuda/bin:$PATH\n\nexport LD_LIBRARY_PATH=/usr/local/cuda/lib64" >> .bashrc
sudo reboot
cuda-install-samples-7.0.sh ~/
cd NVIDIA\_CUDA-7.0\_Samples/1\_Utilities/deviceQuery
make ./deviceQuery
echo -e "\n[global]\nfloatX=float32\ndevice=gpu\n[mode]=FAST_RUN\n\n[nvcc]\nfastmath=True\n\n[cuda]\nroot=/usr/local/cuda" >> ~/.theanorc
安裝python
wget http://repo.continuum.io/archive/Anaconda3-4.0.0-Linux-x86_64.sh
bash http://repo.continuum.io/archive/Anaconda3-4.0.0-Linux-x86_64.sh
pip install keras
安裝cudnn
從這里下所需安裝程序蔬崩。
tar xvzf cudnn-7.0-linux-x64-v4.0-prod.tgz
sudo cp cuda/include/cudnn.h /usr/local/cuda-7.5/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda-7.5/lib64
sudo chmod a+r /usr/local/cuda-7.5/include/cudnn.h /usr/local/cuda-7.5/lib64/libcudnn*
在.bashrc加入:
export CPATH=/usr/local/cuda-7.5/include:$CPATH
export LIBRARY_PATH=/usr/local/cuda-7.5:$LIBRARY_PATH
在~/.theanorc加入:
[nvcc]
optimizer_including=cudnn
測試:
python3.5 -c 'from theano.sandbox.cuda.dnn import version; print(version())'