安装nvidia显卡驱动:
- bios下disable secure boot
- 禁用nouveau
sudo gedit /etc/modprobe.d/blacklist.conf
在最后一行加上: blacklist nouveau
sudo update-initramfs -u
- roboot后执行命令
lsmod | grep nouveau,若没有输出则禁用成功(可在无图形界面的命令模式查看) - ubuntu-drivers devices
若没有输出,则执行sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt update - 卸载原有驱动:
sudo apt-get purge nvidia* - 确保 gcc、g++ 版本在4.9及以上
- sudo ubuntu-drivers autoinstall
- 如果安装后发现是 CUDA Version: N/A,如图
此时torch会无法使用gpu,如图
需要到官方网站下载驱动,通过bash命令安装
sudo bash Downloads/NVIDIA-Linux-x86_64-450.57.run --no-x-check –no-nouveau-check –no-opengl-files
过程中遇到:
Would you like to run the nvidia-xconfig utility to automatically update your X configuration file so that the NVIDIA X driver will be used when you restart X? Any pre-existing X configuration file will be backed up.
选No,其他的一路yes
.bashrc文件添加的是
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
Error:
- 安装驱动出现
Bad return status for module build on kernel: 4.15.0-109-generic- 查看下一行的log文件,来百度具体的error,很有可能是gcc、g++版本问题
- there is enough space in /tmp
.run文件没下完整,重下一遍即可 - Missing recommended library: libGLU.so
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev
- cannot find Toolkit in /usr/local/cuda-8.0 参考
mkdir cuda-8
sudo sh cuda_8.0.61_375.26_linux.run --noexec --target cuda-8
cp cuda-8/InstallUtils.pm /usr/share/perl5
卸载cuda
在/usr/local/cuda/bin 目录下,有cuda 自带的卸载工具uninstall_cuda_9.1.pl
cd /usr/local/cuda/bin
sudo ./uninstall_cuda_9.1.pl
查看当前cuda版本
nvcc --version
查看当前cudnn版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

