为了搭深度学习环境,又装了一遍各种库,在此记录安装版本和流程.
ubuntu16.04+cuda10.0+cudnn7.6+tensorflow_gpu-1.11.0环境安装
- 1 安装NVIDIA显卡
- 2 安装CUDA10.0
- 3 安装CUDNN
- 4 安装tensorflow_gpu-1.11.0
1 安装NVIDIA显卡
查看自己的显卡型号:
lspci |grep -i nvidia
nvidia官网:https://www.nvidia.cn/geforce/drivers/
搜索对应驱动
修改/etc/modprobe.d/blacklist.conf,添加下面内容
sudo gedit /etc/modprobe.d/blacklist.conf
blacklist vga16fb
blacklist nouveau
blacklist rivafb
blacklist rivatv
blacklist nvidiafb
新建blacklist-nouveau.conf文件,添加下面内容
sudo gedit /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
blacklist lbm-nouveau
options nouveau modeset=0
alias nouveau off
alias lbm-nouveau off
sudo update-initramfs -u
reboot
查看nouveau模块是否被加载。若没输出,则执行下一步。
lsmod | grep nouveau
安装
sudo service lightdm stop
sudo ./NVIDIA-Linux-x86_64-xxx.run --no-opengl-files
sudo service lightdm start
nvidia-smi
2 安装CUDA10.0
下载
https://link.csdn.net/?target=https%3A%2F%2Fdeveloper.nvidia.com%2Fcuda-10.0-download-archive
sudo gedit ~/.bashrc
# for CUDA 10.0
export CUDA_10_0_HOME=/usr/local/cuda-10.0
export PATH=$PATH:$CUDA_10_0_HOME/bin
export LD_LIBRARY_PATH=CUDA_10_0_HOME/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
3 安装CUDNN
https://developer.nvidia.com/rdp/cudnn-archive
sudo dpkg -i libcudnn7_7.6.0.64-1+cuda10.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.6.0.64-1+cuda10.0_amd64.deb
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
4 安装tensorflow_gpu-1.11.0
查询cuda,cuDNN与tensorflow的版本对应关系
https://tensorflow.google.cn/install/source_windows?hl=en#gpu
选择安装tensorflow-gpu-1.14.0
pip install tensorflow-gpu==1.14.0