一、查看显卡类型
lspci | grep -i nvidia
二、查看显卡对应的驱动版本
三、查看驱动对应的cuda版本
Release Notes :: CUDA Toolkit Documentation
四、安装驱动
方式1:sudo apt-get install nvidia-430(根据自己的版本更改)
方式2:下载.run文件离线安装
sudo service lightdm stop
sudo ./NVIDIA-Linux-x86_64-430.14.run
sudo service lightdm start
五、卸载驱动
给权限:chmod a+x NVIDIA-Linux-x86_64-418.67.run
卸载:./NVIDIA-Linux-x86_64-418.67.run --uninstall
问题:If you plan to no longer use the NVIDIA deriver, you should make sure that no X screens are configured to use the NVIDIA X driver X driver in your X configuration file. If you used nvidia-xconfig to configure X, it may have created a backup of your original configuration. Would you like to run 'nvidia-xconfig --restore-original-backup' to attempt restoration of the original X configuration file?
回答:no
六、安装新驱动
1、如果出现错误 ERROR: You appear to be running an X server; please exit X before installing.
关闭:systemctl stop gdm.service
2、查看:lsof | grep nvidia.uvm
如果不为空,关闭docker
systemctl stop docker
systemctl stop nvidia-docker.service
3、给权限:chmod a+x NVIDIA-Linux-x86_64-470.57.02.run
安装:./NVIDIA-Linux-x86_64-470.57.02.run
4、问题: Install NVIDIA's 32-bit compatibility libraries? 回答:No
七、如果docker不能用gpu
把旧的提交为image,用image新建容器就可以使用gpu
nvidia-docker run -tid --name mynew -v /home/username:/home image:v1