admin管理员组

文章数量:1558062

lspci,顾名思义,就是显示所有的 pci 设备信息。pci 是一种总线,而通过 pci 总线连接的设备就是 pci 设备了。如今,我们常用的设备很多都是采用 pci 总线了,如:网卡、存储。

如果没有 lspci 命令,安装:1

apt-get install pciutils

查看 gpu:1

lspci | grep -i vga

这样就可以显示机器上的显卡信息,比如

1

2

3

4

[root@localhost conf]# lspci | grep -i vga

01:00.0 VGA compatible controller: nVidia Corporation Device 1081 (rev a1)

02:00.0 VGA compatible controller: nVidia Corporation GT215 [GeForce GT 240] (rev a2)

08:05.0 VGA compatible controller: ASPEED Technology, Inc. ASPEED Graphics Family (rev 10)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

如果想看详细的信息,比如 GeForce GT 240,即 02:00.0

[root@localhost conf]# lspci -v -s 02:00.0

02:00.0 VGA compatible controller: nVidia Corporation GT215 [GeForce GT 240] (rev a2) (prog-if 00 [VGA controller])

Subsystem: ASUSTeK Computer Inc. Device 8351

Flags: bus master, fast devsel, latency 0, IRQ 169

Memory at f9000000 (32-bit, non-prefetchable) [size=16M]

Memory at d0000000 (64-bit, prefetchable) [size=256M]

Memory at ce000000 (64-bit, prefetchable) [size=32M]

I/O ports at bc00 [size=128]

[virtual] Expansion ROM at f8f80000 [disabled] [size=512K]

Capabilities: [60] Power Management version 3

Capabilities: [68] MSI: Enable- Count=1/1 Maskable- 64bit+

Capabilities: [78] Express Endpoint, MSI 00

Capabilities: [b4] Vendor Specific Information: Len=14 >

Capabilities: [100] Virtual Channel

Capabilities: [128] Power Budgeting >

Capabilities: [600] Vendor Specific Information: ID=0001 Rev=1 Len=024 >

Kernel driver in use: nvidia

Kernel modules: nvidiafb, nvidia

可以看到 GT240 的显存是 256M

如果没有安装显卡驱动,显示可能如下:1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

root@0765afb5370d:/# lspci | grep -i vga

00:02.0 VGA compatible controller: Intel Corporation Device 3e92

01:00.0 VGA compatible controller: NVIDIA Corporation Device 1c82 (rev a1)

root@0765afb5370d:/# lspci | grep -i 01:00.0

01:00.0 VGA compatible controller: NVIDIA Corporation Device 1c82 (rev a1)

root@0765afb5370d:/# lspci -v -s 01:00.0

01:00.0 VGA compatible controller: NVIDIA Corporation Device 1c82 (rev a1) (prog-if 00 [VGA controller])

Subsystem: ASUSTeK Computer Inc. Device 8609

Flags: bus master, fast devsel, latency 0, IRQ 125

Memory at f6000000 (32-bit, non-prefetchable) [size=16M]

Memory at e0000000 (64-bit, prefetchable) [size=256M]

Memory at f0000000 (64-bit, prefetchable) [size=32M]

I/O ports at e000 [size=128]

Expansion ROM at f7000000 [disabled] [size=512K]

Capabilities:

Kernel driver in use: nouveau

lspci: Unable to load libkmod resources: error -12

查看 nvidia 的 gpu 信息1

nvidia-smi

配合 watch 命令, 让一秒刷新一次

1

watch -n 1 nvidia-smi

查看内存及 cpu 使用情况的命令1

top

htop 工具,更直观1

apt-get install htop

安装完后,直接输入命令1

htop

就可以看到内存或 cpu 的使用情况了。

本文标签: 服务器信息GPU