無法連接NVIDIA驅動:NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver

NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver

重啓服務器之後就出現連接不上NVIDIA驅動的情況。這個時候tensorflow還是可以運行的,但只是在用cpu跑。安裝gpu版的TensorFlow時,也顯示已安裝。

nvidia-smi

NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

我們在終端輸入 nvcc -V 發現驅動也在。

在這裏插入圖片描述

這就很魔性了。。。查找了很多方法之後,發現下面這個最簡便,只需要兩步,而且還不用重啓,哈哈。

step1:sudo apt-get install dkms

step2: sudo dkms install -m nvidia -v 410.79

再次輸入nvidia-smi時,你熟悉的界面就會回來啦。

在這裏插入圖片描述

(雖然使用率顯示爲99%,但並不影響我們使用)

其中step2 中的410.79是NVIDIA的版本號,當你不知道的時候,進入/usr/src目錄中,可以看到裏面有nvidia文件夾,後綴就是其版本號

cd /usr/src

在這裏插入圖片描述

OK,到此我們就輕鬆愉快的解決了這個問題。(Yeah!)

另:怎麼查看TensorFlow是gpu版本還是cpu版本

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章