在Ubuntu上安装NVIDIA GPU驱动
类别: GPU 标签: Linux Ubuntu GPU NVIDIA目录
在一台新安装的 Ubuntu20.04 系统上安装 NVIDIA GPU 驱动。
安装 gcc make 工具
$ sudo apt-get install gcc make
禁用系统默认驱动 nouveau
- 编辑配置文件
$ sudo nano /etc/modprobe.d/blacklist-nouveau.conf blacklist nouveau options nouveau modeset=0
## 另一种方法 # cat << EOF >/etc/modprobe.d/blacklist-nouveau.conf blacklist nouveau options nouveau modeset=0 EOF
- 更新 initramfs
$ sudo update-initramfs -u
- 重启系统
$ sudo reboot
- 验证 nouveau 是否禁用成功(当什么也不显示出来时代表成功)
$ lsmod | grep nouveau
安装 NVIDIA 驱动
- 查看显卡型号
$ lspci | grep -i nvidia 0000:43:00.0 3D controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1) 0000:47:00.0 3D controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1) 0000:8e:00.0 3D controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1) 0000:92:00.0 3D controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1)
- 到NVIDIA 驱动程序下载页面下载对应型号的驱动
$ wget https://cn.download.nvidia.com/tesla/450.80.02/NVIDIA-Linux-x86_64-450.80.02.run
- 安装驱动
$ sudo sh NVIDIA-Linux-x86_64-450.80.02.run
查看 GPU 的运行状态
$ nvidia-smi
Tue Nov 3 08:10:14 2020
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 450.80.02 Driver Version: 450.80.02 CUDA Version: 11.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 Tesla T4 Off | 00000000:43:00.0 Off | 0 |
| N/A 67C P0 31W / 70W | 0MiB / 15109MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 Tesla T4 Off | 00000000:47:00.0 Off | 0 |
| N/A 68C P0 31W / 70W | 0MiB / 15109MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 2 Tesla T4 Off | 00000000:8E:00.0 Off | 0 |
| N/A 65C P0 30W / 70W | 0MiB / 15109MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 3 Tesla T4 Off | 00000000:92:00.0 Off | 0 |
| N/A 63C P0 25W / 70W | 0MiB / 15109MiB | 6% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+