ubuntu下如何查看显卡及显卡驱动

ubuntu下如何查看显卡及显卡驱动

使用nvidia-smi 工具查看

查看显卡型号nvida-smi -L

$ nvidia-smi -L
GPU 0: NVIDIA GeForce RTX 3050 4GB Laptop GPU (UUID: GPU-4cf7b7cb-f103-bf56-2d59-304f8996e28c)

当然直接使用nvida-smi 命令可以查看更多信息

$ nvidia-smi
Mon Feb 12 18:24:15 2024       
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.154.05             Driver Version: 535.154.05   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| 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  NVIDIA GeForce RTX 3050 ...    Off | 00000000:02:00.0 Off |                  N/A |
| N/A   47C    P8               3W /  40W |    214MiB /  4096MiB |      0%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|    0   N/A  N/A      1854      G   /usr/lib/xorg/Xorg                          161MiB |
|    0   N/A  N/A      2225      G   /usr/bin/gnome-shell                         40MiB |
|    0   N/A  N/A      3199      G   ...irefox/2987/usr/lib/firefox/firefox        2MiB |
|    0   N/A  N/A      9612      G   gnome-control-center                          1MiB |
+---------------------------------------------------------------------------------------+

注意,上图中的 CUDA Version 后面写了一个版本号。该版本号并不是你已经安装了该版本的 CUDA 的意思,而是说此显卡最大支持的CUDA版本号。因此我们仍然需要手动从官网下载CUDA,且版本号不能高于这个。

还可以使用如下命令,查看显卡驱动版本

$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  535.154.05  Thu Dec 28 15:37:48 UTC 2023
GCC version:  gcc version 12.3.0 (Ubuntu 12.3.0-1ubuntu1~22.04) 

也可以使用navidia-settings命令弹出图形界面

$ navidia-settings

ubuntu下如何查看显卡及显卡驱动_第1张图片

安装显卡前查看推荐的显卡

当然,如果没安装显卡驱动,则需要安装驱动,可使用如下命令

首先我们需要看看显卡硬件有没正确安装到计算机,我们可以通过命令lspci查看一下

$ lspci
00:00.0 Host bridge: Intel Corporation Device a706
00:02.0 VGA compatible controller: Intel Corporation Device a7a0 (rev 04)
00:04.0 Signal processing controller: Intel Corporation Device a71d
00:06.0 PCI bridge: Intel Corporation Device a74d
00:06.2 PCI bridge: Intel Corporation Device a73d
00:07.0 PCI bridge: Intel Corporation Device a73f
00:08.0 System peripheral: Intel Corporation Device a74f
00:0d.0 USB controller: Intel Corporation Device a71e
00:0d.2 USB controller: Intel Corporation Device a73e
00:14.0 USB controller: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller (rev 01)
00:14.2 RAM memory: Intel Corporation Alder Lake PCH Shared SRAM (rev 01)
00:14.3 Network controller: Intel Corporation Device 51f1 (rev 01)
00:15.0 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 (rev 01)
00:16.0 Communication controller: Intel Corporation Alder Lake PCH HECI Controller (rev 01)
00:16.3 Serial controller: Intel Corporation Device 51e3 (rev 01)
00:1f.0 ISA bridge: Intel Corporation Device 519d (rev 01)
00:1f.3 Multimedia audio controller: Intel Corporation Device 51ca (rev 01)
00:1f.4 SMBus: Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01)
00:1f.5 Serial bus controller: Intel Corporation Alder Lake-P PCH SPI Controller (rev 01)
01:00.0 Non-Volatile memory controller: KIOXIA Corporation Device 0010 (rev 01)
02:00.0 3D controller: NVIDIA Corporation Device 25ab (rev a1)

使用ubuntu-drivers devices命令,查看所有可用的即推荐的显卡驱动

$ ubuntu-drivers devices
== /sys/devices/pci0000:00/0000:00:06.2/0000:02:00.0 ==
modalias : pci:v000010DEd000025ABsv000017AAsd000050D4bc03sc02i00
vendor   : NVIDIA Corporation
driver   : nvidia-driver-535-open - distro non-free
driver   : nvidia-driver-535-server-open - distro non-free
driver   : nvidia-driver-525-server - distro non-free
driver   : nvidia-driver-535 - distro non-free recommended
driver   : nvidia-driver-525 - distro non-free
driver   : nvidia-driver-535-server - distro non-free
driver   : nvidia-driver-525-open - distro non-free
driver   : nvidia-driver-545-open - distro non-free
driver   : nvidia-driver-545 - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

nvidia-driver-535 - distro non-free recommended 这个即推荐的
使用sudo ubuntu-drivers autoinstall可直接安装推荐的显卡
也可使用sudo apt-get install nvidia-driver-525 制定版本安装

关于ubuntu下的显卡驱动安装详细过程,可以点击这里

nvidia-detector 命令,可查看支持的最高版本驱动

$ nvidia-detector 
nvidia-driver-545

你可能感兴趣的:(ubuntu,gpu,nvidia-smi,显卡查看)