1. 问题描述
$ watch -n 1 nvidia-smi
画面不动
而且运行 pytorch 代码时出现问题:
UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 11070). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.)
return torch._C._cuda_getDeviceCount() > 0
2. 查看适合的显卡驱动
$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00002520sv00001558sd000050E2bc03sc00i00
vendor : NVIDIA Corporation
manual_install: True
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-545-open - third-party non-free
driver : nvidia-driver-535 - distro non-free
driver : nvidia-driver-535-server - distro non-free
driver : nvidia-driver-550 - third-party non-free recommended
driver : nvidia-driver-535-open - distro non-free
driver : nvidia-driver-535-server-open - distro non-free
driver : nvidia-driver-470-server - distro non-free
driver : nvidia-driver-550-open - third-party non-free
driver : nvidia-driver-545 - third-party non-free
driver : xserver-xorg-video-nouveau - distro free builtin
安装 nvidia-driver-535
3. 显卡驱动下载
NVIDIA 显卡驱动官网 : https://www.nvidia.cn/geforce/drivers/
选择自己的显卡型号:
选择想要的版本下载:
安装过程参考:
Ubuntu20.04显卡驱动安装
4. 安装出现的问题
An NVIDIA kernel module ‘nvidia-drm‘
参考:
- 安装NVIDIA驱动出现: An NVIDIA kernel module ‘nvidia-drm‘
- 安装 NVIDIA 显卡驱动时报错:An NVIDIA kernel module ‘nvidia-drm‘ appears to already be load
5. 安装成功
$ watch -n 1 nvidia-smi