一、查看顯卡類(lèi)型
lspci | grep -i nvidia
二、查看顯卡對(duì)應(yīng)的驅(qū)動(dòng)版本
三、查看驅(qū)動(dòng)對(duì)應(yīng)的cuda版本?
Release Notes :: CUDA Toolkit Documentation
四、安裝驅(qū)動(dòng)
方式1:sudo apt-get install nvidia-430(根據(jù)自己的版本更改)
方式2:下載.run文件離線安裝
? ? ? ? ? ? ?sudo service lightdm stop
? ? ? ? ? ? ?sudo ./NVIDIA-Linux-x86_64-430.14.run
? ? ? ? ? ? ?sudo service lightdm start
五、卸載驅(qū)動(dòng)
給權(quán)限:chmod a+x NVIDIA-Linux-x86_64-418.67.run
卸載:./NVIDIA-Linux-x86_64-418.67.run --uninstall
問(wèn)題: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
六、安裝新驅(qū)動(dòng)
1、如果出現(xiàn)錯(cuò)誤 ERROR: You appear to be running an X server; please exit X before?installing.
關(guān)閉:systemctl?stop?gdm.service??
2、查看:lsof | grep nvidia.uvm
如果不為空,關(guān)閉docker
systemctl stop docker
systemctl stop nvidia-docker.service
3、給權(quán)限:chmod a+x?NVIDIA-Linux-x86_64-470.57.02.run
安裝:./NVIDIA-Linux-x86_64-470.57.02.run
4、問(wèn)題: 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