Ubuntu14.04 CUDA8.0 CUDN4.0 NVIDIA1080 多种深度框架(懒人三步装) - 从入门到放弃

这是一个懒人快速安装教程,1080卡有点麻烦,因为cuda需要8.0。为了安装方便直接把命令写成三个shell脚本。

代码基本是http://blog.csdn.net/langb2014/article/details/51579491,但是不完全一样。

首先准备的工作官网下载

cuda-repo-ubuntu1404-8-0-local_8.0.44-1_amd64.deb.44-1_amd64-deb.deb

cudnn-7.0-linux-x64-v40.tgz

然后就是在/home/name/下建一个soft的文件夹里面放上面两个安装包和三个.sh文件(step1.sh,step2.sh,step3.sh见后面)

由于驱动和CUDA安装完之后需要重启所以必须分成三个脚本执行,只要每次分别按顺序运行.sh脚本。

脚本中包括所有依赖库、安装框架、自带源加速、注释一些内容、修改一些内容、添加一些内容。

言归正传

前面工作准备好之后在终端运行

sudo sh ~/soft/step1.sh
sudo sh ~/soft/step2.sh
sudo sh ~/soft/step3.sh

三个文件: step1.sh

sudo apt-get update    
sudo apt-get upgrade    
sudo apt-get install build-essential    
sudo apt-get autoremove
sudo apt-get install git   
lspci | grep -i nvidia
sudo add-apt-repository ppa:graphics-drivers/ppa  
sudo apt-get update
sudo apt-get install nvidia-367
sudo shutdown -r now

step2.sh

cat /proc/driver/nvidia/version
cd ~/soft
sudo dpkg -i cuda-repo-ubuntu1404*amd64*.deb 
sudo apt-get update  
sudo apt-get install cuda
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc  
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc  

source ~/.bashrc
nvcc -V
sudo shutdown -r now

step3.sh

/usr/local/cuda/bin/cuda-install-samples-8.0.sh ~/cuda-samples  
cd ~/cuda-samples/NVIDIA*Samples  
make -j $(($(nproc) + 1))
bin/x86_64/linux/release/deviceQuery
cd ~/soft/
tar xvf cudnn*.tgz  
cd cuda
sudo cp */*.h /usr/local/cuda/include/ 
sudo cp */libcudnn* /usr/local/cuda/lib64/  
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
nvidia-smi
sudo apt-get install python-pip python-dev
sudo pip install six --upgrade --target="/usr/lib/python2.7/dist-packages"
export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-0.12.0-cp27-none-linux_x86_64.whl
export URL1=http://pypi.douban.com/simple
sudo pip install --upgrade $TF_BINARY_URL -i $URL1
mkdir ~/git  
cd ~/git  
git clone https://github.com/xianyi/OpenBLAS.git  
cd OpenBLAS ####  
sudo apt-get install gfortran  
make FC=gfortran -j $(($(nproc) + 1))  
sudo make PREFIX=/usr/local install
echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
sudo apt-get install -y libfreetype6-dev libpng12-dev
sudo pip install aws-shell -i $URL1
sudo pip install -U matplotlib ipython jupyter pandas scikit-image  -i $URL1
sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler  
sudo apt-get install --no-install-recommends libboost-all-dev  
sudo apt-get install python-skimage ipython python-pil python-h5py ipython python-gflags python-yaml  
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev  
cd ~/git  http://www.90168.org/
git clone https://github.com/BVLC/caffe.git  
cd caffe
cp Makefile.config.example Makefile.config
sed -i 's/# USE_CUDNN := 1/USE_CUDNN := 1/' Makefile.config
sed -i 's/# WITH_PYTHON_LAYER := 1/WITH_PYTHON_LAYER := 1/' Makefile.config
sed -i 's/BLAS := atlas/BLAS := open/' Makefile.config
sudo pip install -r python/requirements.txt -i $URL1
make all -j $(($(nproc) + 1))
make test -j $(($(nproc) + 1))  
make runtest -j $(($(nproc) + 1))  
make pycaffe -j $(($(nproc) + 1))
echo 'export CAFFE_ROOT=$(pwd)' >> ~/.bashrc  
echo 'export PYTHONPATH=$CAFFE_ROOT/python:$PYTHONPATH' >> ~/.bashrc  
source ~/.bashrc
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ python-pygments python-sphinx python-nose  
sudo pip install Theano -i $URL1
sudo pip install keras -i $URL1

git clone https://github.com/torch/distro.git ~/git/torch --recursive  
cd ~/git/torch
bash install-deps 
./install.sh
source ~/.bashrc

sudo apt-get update  
sudo apt-get install -y build-essential git libatlas-base-dev libopencv-dev
git clone --recursive https://github.com/dmlc/mxnet  
cd ~/soft/mxnet
cp ./make/config.mk ./
sed -i 's/USE_CUDA = 0/USE_CUDA = 1/' config.mk
sed -i '/USE_CUDA_PATH = NONE/s#NONE#/usr/local/cuda#' config.mk
make -j $(($(nproc) + 1)) 
posted @ 2016-12-23 16:24  天师符  阅读(376)  评论(0编辑  收藏  举报