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

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

使用nvidia-smi 工具查看

查看显卡型号nvida-smi -L

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

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

bash 复制代码
$ 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,且版本号不能高于这个。

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

bash 复制代码
$ 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命令弹出图形界面

bash 复制代码
$ navidia-settings

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

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

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

bash 复制代码
$ 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命令,查看所有可用的即推荐的显卡驱动

bash 复制代码
$ 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 命令,可查看支持的最高版本驱动

bash 复制代码
$ nvidia-detector 
nvidia-driver-545
相关推荐
wowocpp8 小时前
ubuntu 22.04 硬件配置 查看 显卡
linux·运维·ubuntu
山河君8 小时前
ubuntu使用DeepSpeech进行语音识别(包含交叉编译)
linux·ubuntu·语音识别
knighthood20018 小时前
解决:ros进行gazebo仿真,rviz没有显示传感器数据
c++·ubuntu·ros
wowocpp19 小时前
ubuntu 22.04 server 安装 anaconda3
linux·运维·ubuntu
wowocpp1 天前
ubuntu 22.04 防火墙 ufw
linux·运维·ubuntu
188_djh1 天前
# Python基础到实战一飞冲天(一)--linux基础(一)
linux·开发语言·python·ubuntu·centos·os·operationsystem
winds~1 天前
ubuntu中安装matplotcpp绘图
linux·运维·ubuntu
UsamaBinLaden1 天前
Ubuntu和Debian系列的Release默认shell解释器变更
linux·ubuntu·debian
探索云原生1 天前
GPU 环境搭建指南:如何在裸机、Docker、K8s 等环境中使用 GPU
ai·云原生·kubernetes·go·gpu
一个处女座的程序猿2 天前
AI之硬件对比:据传英伟达Nvidia2025年将推出RTX 5090-32GB/RTX 5080-24GB、华为2025年推出910C/910D
人工智能·gpu