搭建深度学习环境(这里深度学习框架选择caffe)
1、配置方法(Nvidia GPU版)
1.1、Nvidia Drivers
我安装的NVIDIA驱动是nvidia-375
lspci | grep -i nvidia
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt-get update
sudo apt-get install nvidia-375
sudo shutdown -r now
Check to ensure that the correct version of NVIDIA drivers are installed
cat /proc/driver/nvidia/version
安装nvidia-375可能错误
错误1:usr/lib/nvidia-375/libEGL.so.1不是链接
解决方法:
sudo mv /usr/lib/nvidia-375/libEGL.so.1 /usr/lib/nvidia-375/libEGL.so.1.org
sudo mv /usr/lib32/nvidia-375/libEGL.so.1 /usr/lib32/nvidia-375/libEGL.so.1.org
sudo ln -s /usr/lib/nvidia-375/libEGL.so.375.66 /usr/lib/nvidia-375/libEGL.so.1
sudo ln -s /usr/lib32/nvidia-375/libEGL.so.375.66 /usr/lib32/nvidia-375/libEGL.so.1
1.2、CUDA(官网下载cuda对应版本,cd到文件所在文件夹)
sudo dpkg -i cuda-repo-ubuntu1404*amd64.deb
sudo apt-get update
sudo apt-get install cuda
Add CUDA to the environment variables
echo 'export PATH=/usr/local/cuda/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
Check to ensure the correct version of CUDA is installed
nvcc -V
Restart your computer
sudo shutdown -r now
1.3、cuDNN
下载cudnn-8.0-linux-x64-v5.1
cd ~/Downloads/
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*
建立软链接
终端输入
cd /usr/local/cuda/lib64/
sudo rm -rf libcudnn.so libcudnn.so.5
sudo ln -s libcudnn.so.5.1.10 libcudnn.so.5
sudo ln -s libcudnn.so.5 libcudnn.so
输入以下命令,使软连接生效
sudo ldconfig -v
1.3.1安装cuda、cudnn可能错误
错误1:
/sbin/ldconfig.real: /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.5 不是符号连接
解决方法:
/**********暂时不用这里的内容*****************/
将libcudnn.so.5重命名为libcudnn.so.5.org
sudo mv /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.5 /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.5.org
建立软链接
sudo ln -s /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.5.1.10 /usr/local/cuda-8.0/targets/x86_64-linux/lib/libcudnn.so.5
/***********************************************************/
建立软链接
终端输入
cd /usr/local/cuda/lib64/