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
相关推荐
读书,代码与猫37 分钟前
【裸机装机系列】10.kali(ubuntu)-安装nvidia独立显卡步骤
ubuntu·kali·nvidia·linux安装nvidia显卡·ubuntu安装nvidia·裸机安装linux
厨 神6 小时前
vmware中的ubuntu系统扩容分区
linux·运维·ubuntu
鸡鸭扣9 小时前
虚拟机:3、(待更)WSL2安装Ubuntu系统+实现GPU直通
linux·运维·ubuntu
Jouzzy11 小时前
【Android安全】Ubuntu 16.04安装GDB和GEF
android·ubuntu·gdb
安得权11 小时前
Ubuntu 20.04 部署 NET8 Web - Systemd 的方式 达到外网访问的目的
linux·前端·ubuntu
iHero11 小时前
【Ubuntu】在 Ubuntu 22.04.3 LTS 安装 davfs2 通过 Nextcloud WebDAV 挂载到 Ubuntu 的目录上
linux·ubuntu·nextcloud
清园暖歌11 小时前
Ubuntu 不重装系统增加交换空间大小
linux·运维·ubuntu·交换空间
黎相思11 小时前
操作系统迁移(CentOs -> Ubuntu)
linux·ubuntu·gitee·centos
写bug如流水12 小时前
在Ubuntu 20.04上安装pgAdmin 4
linux·运维·ubuntu
WW、forever12 小时前
【VMvare虚拟机-Ubuntu】解决内存不足问题
ubuntu