Linux使用命令行找出视频卡GPU内存RAM大小

时间:2020-01-09 10:40:13  来源:igfitidea点击:

在Fedora Linux上如何找出我的NVDIA显示卡的内存大小。
如何在Linux上找到我的VIDEO卡(VGA)内存大小?
您需要使用以下命令来查找Linux上的图形卡(VGA)内存:

  • lspci命令是一个实用程序,用于显示有关系统中所有PCI总线以及与其连接的所有设备的信息。
  • /var/log/Xorg.0.logXorg日志文件。
  • lshw命令列出Linux上的CPU,CPU和其他硬件。
  • glxinfo命令在给定的X显示器上查看有关Linux上GLX实现的信息。

lspci命令示例,用于查找Linux上的视频卡(GPU)内存RAM大小

打开终端,然后执行lspci命令以列出Linux上的PCI设备:

$ lspci

输出:

00:00.0 Host bridge: Intel Corporation 82845G/GL[Brookdale-G]/GE/PE DRAM Controller/Host-Hub Interface (rev 03)
00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) USB2 EHCI Controller (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 82)
00:1f.0 ISA bridge: Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC Interface Bridge (rev 02)
00:1f.1 IDE interface: Intel Corporation 82801DB (ICH4) IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) SMBus Controller (rev 02)
00:1f.5 Multimedia audio controller: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) AC'97 Audio Controller (rev 02)
01:00.0 Network controller: RaLink RT2561/RT61 rev B 802.11g
01:02.0 Multimedia video controller: Brooktree Corporation Bt878 Video Capture (rev 11)
01:02.1 Multimedia controller: Brooktree Corporation Bt878 Audio Capture (rev 11)
01:05.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ (rev 10)

您需要在指定的域00:02.0 VGA中使用称为设备的字符串(以红色突出显示以显示内存信息):

$ lspci -v -s 00:02.0

输出示例:

00:02.0 VGA compatible controller: Intel Corporation 82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 03) (prog-if 00 [VGA])
        Subsystem: Giga-byte Technology Unknown device 2562
        Flags: bus master, fast devsel, latency 0, IRQ 177
        Memory at d0000000 (32-bit, prefetchable) [size=128M]
        Memory at d8200000 (32-bit, non-prefetchable) [size=512K]
        Capabilities:

此列表显示了具有128 MB视频RAM的英特尔视频卡。
如果找不到指定域中的设备,请使用以下命令并查找显示卡名称和内存字段:

$ lspci -v | less

识别Linux上的板载Intel/AMD或Nvidia专用GPU

只需运行以下lshw命令。
它是提取有关Linux机器硬件配置的详细信息的小工具:

$ sudo lshw -C display

Linux使用命令行找出视频卡GPU内存RAM大小

另一种选择是运行以下命令:

$ glxinfo | more

可以如下使用egrep命令来过滤掉信息:

$ glxinfo | egrep -i 'device|memory'

要获取摘要,即简要信息,请运行:

$ glxinfo -B

输出示例:

name of display: :0
display: :0  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: X.Org (0x1002)
    Device: Radeon RX 580 Series (POLARIS10 / DRM 3.25.0 / 4.17.14-041714-generic, LLVM 6.0.0) (0x67df)
    Version: 18.0.5
    Accelerated: yes
    Video memory: 4058MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.5
    Max compat profile version: 3.0
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
Memory info (GL_ATI_meminfo):
    VBO free memory - total: 4058 MB, largest block: 4058 MB
    VBO free aux. memory - total: 4089 MB, largest block: 4089 MB
    Texture free memory - total: 4058 MB, largest block: 4058 MB
    Texture free aux. memory - total: 4089 MB, largest block: 4089 MB
    Renderbuffer free memory - total: 4058 MB, largest block: 4058 MB
    Renderbuffer free aux. memory - total: 4089 MB, largest block: 4089 MB
Memory info (GL_NVX_gpu_memory_info):
    Dedicated video memory: 4058 MB
    Total available memory: 8147 MB
    Currently available dedicated video memory: 4058 MB
OpenGL vendor string: X.Org
OpenGL renderer string: Radeon RX 580 Series (POLARIS10 / DRM 3.25.0 / 4.17.14-041714-generic, LLVM 6.0.0)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.0.5
OpenGL core profile shading language version string: 4.50
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
 
OpenGL version string: 3.0 Mesa 18.0.5
OpenGL shading language version string: 1.30
OpenGL context flags: (none)
 
OpenGL ES profile version string: OpenGL ES 3.1 Mesa 18.0.5
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

Xorg日志文件以获取Linux上的GPU信息

打开命令行终端(选择应用程序>附件>终端),然后执行:

$ grep -i --color memory /var/log/Xorg.0.log

输出示例:

(--) Aug 02 12:16:20 NVIDIA(0): Memory: 1048576 kBytes
(II) Aug 02 12:16:21 NVIDIA: Using 768.00 MB of virtual memory for indirect memory access.
(==) NVIDIA(0): Disabling shared memory pixmaps

以上输出表明我的Nvidia卡的RAM为1024MB。
以下摘自装有Intel GM965视频卡的Macbook。
它共享来自主RAM的内存:

$ grep -i memory /var/log/Xorg.0.log

输出示例:

[2318869.434] (II) intel(0): detected 15868 kB stolen memory.
[2318869.472] (II) intel(0): I830CheckAvailableMemory: 1966080 kB available
[2318869.486] (II) intel(0): Attempting memory allocation with tiled buffers.
[2318870.197] (II) intel(0): Fixed memory allocation layout:
[2318870.197] (II) intel(0): 0x00f7f000:            end of stolen memory
[2318870.197] (II) intel(0): 0x00f7f000-0x0fffffff: DRI memory manager (246276 kB)
[2318870.197] (II) intel(0): BO memory allocation layout:
[2318870.197] (II) intel(0): 0x00f7f000:            start of memory manager
[2318870.197] (II) intel(0): 0x10000000:            end of memory manager