Ubuntu18.04 NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
问题描述
某一天使用nvidia-smi查看GPU,突然报错:
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
可是之前跑程序没有问题。检查以后发现是generic发生了更改。检查的命令:
sudo dpkg --get-selections |grep linux-image
可以看到新出现三个install
解决方法:重新装driver
最好装与之前相同版本的driver。
之前的版本我放在了Downloads/文件夹下。
首先禁用图形界面:
sudo systemctl set-default multi-user.target
然后转到Downloads/下
cd Downloads/
我的driver版本是430.14
sudo bash NVIDIA-Linux-x86_64-430.14.run -no-opengl-files -no-x-check -no-nouveau-check
然后后面的选项一般都选no。
安装完后再输入nvidia-smi就发现可以连接了。
最后重启图像界面
sudo systemctl set-default graphical.target
搞定!