前 7 个 Linux GPU 监控和诊断命令行工具 您所在的位置:网站首页 radeontop工具安装 前 7 个 Linux GPU 监控和诊断命令行工具

前 7 个 Linux GPU 监控和诊断命令行工具

2024-05-16 16:28| 来源: 网络整理| 查看: 265

一种 视频卡是一种特殊的电路板,用于控制计算机显示器上显示的内容。 它也称为图形处理单元 (GPU),可为 Linux 游戏和其他用途计算 3D 图像和图形。 让我们看看解决问题的前 7 个 Linux GPU 监控和诊断命令行工具。

以下工具适用于 Linux,用于 GPU 监控和诊断目的,以及其他操作系统(如 FreeBSD)。 如今,大多数 Linux 和 FreeBSD 用户使用 Nvidia、Intel 和 AMD GPU。

我们可以使用以下工具来监视、诊断和检查基于 Linux 或 *BSD 的系统。

在 Linux 上查找有关 GPU 的信息

要获取 GPU 信息,只需运行:sudo lshw -C display -short lspci -v | more

输出如下:

H/W path Device Class Description =============================================================== /0/100/1/0 display TU117M [GeForce GTX 1650 Mobile / Max-Q] /0/100/2 /dev/fb0 display UHD Graphics 630 (Mobile)

想要 在 Linux 上找出显卡 GPU 内存 RAM 大小? 尝试:sudo lspci sudo lshw -C display glxinfo | egrep -i 'device|memory' grep -i --color memory /var/log/Xorg.0.log

1. glmark2 – 在 Linux 上对 GPU 性能进行压力测试

glmark2 是一个 OpenGL 2.0 和 ES 2.0 基准命令行实用程序。 我们可以如下安装:$ sudo apt install glmark2

现在按如下方式运行它:$ glmark2

然后它将按如下方式开始测试,并在 Linux 上对您的 GPU 进行压力测试:

我在 Ubuntu Linux 20.04 LTS 上运行的 Nvidia GeForce GTX 1650 的基准测试结果:

======================================================= glmark2 2014.03+git20150611.fa71af2d ======================================================= OpenGL Information GL_VENDOR: NVIDIA Corporation GL_RENDERER: GeForce GTX 1650 with Max-Q Design/PCIe/SSE2 GL_VERSION: 4.6.0 NVIDIA 450.80.02 ======================================================= [build] use-vbo=false: FPS: 4980 FrameTime: 0.201 ms [build] use-vbo=true: FPS: 6927 FrameTime: 0.144 ms [texture] texture-filter=nearest: FPS: 5144 FrameTime: 0.194 ms [texture] texture-filter=linear: FPS: 4979 FrameTime: 0.201 ms [texture] texture-filter=mipmap: FPS: 4030 FrameTime: 0.248 ms [shading] shading=gouraud: FPS: 6358 FrameTime: 0.157 ms [shading] shading=blinn-phong-inf: FPS: 5810 FrameTime: 0.172 ms [shading] shading=phong: FPS: 6425 FrameTime: 0.156 ms [shading] shading=cel: FPS: 5720 FrameTime: 0.175 ms [bump] bump-render=high-poly: FPS: 4772 FrameTime: 0.210 ms [bump] bump-render=normals: FPS: 7187 FrameTime: 0.139 ms [bump] bump-render=height: FPS: 6724 FrameTime: 0.149 ms [effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 5278 FrameTime: 0.189 ms [effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 3649 FrameTime: 0.274 ms [pulsar] light=false:quads=5:texture=false: FPS: 5793 FrameTime: 0.173 ms [desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 2776 FrameTime: 0.360 ms [desktop] effect=shadow:windows=4: FPS: 3913 FrameTime: 0.256 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 1555 FrameTime: 0.643 ms [buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 1703 FrameTime: 0.587 ms [buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: FPS: 1800 FrameTime: 0.556 ms [ideas] speed=duration: FPS: 5480 FrameTime: 0.182 ms [jellyfish] : FPS: 4283 FrameTime: 0.233 ms [terrain] : FPS: 746 FrameTime: 1.340 ms [shadow] : FPS: 4878 FrameTime: 0.205 ms [refract] : FPS: 1580 FrameTime: 0.633 ms [conditionals] fragment-steps=0:vertex-steps=0: FPS: 5081 FrameTime: 0.197 ms [conditionals] fragment-steps=5:vertex-steps=0: FPS: 4556 FrameTime: 0.219 ms [conditionals] fragment-steps=0:vertex-steps=5: FPS: 5293 FrameTime: 0.189 ms [function] fragment-complexity=low:fragment-steps=5: FPS: 5048 FrameTime: 0.198 ms [function] fragment-complexity=medium:fragment-steps=5: FPS: 4602 FrameTime: 0.217 ms [loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 4744 FrameTime: 0.211 ms [loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 4515 FrameTime: 0.221 ms [loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 4948 FrameTime: 0.202 ms ======================================================= glmark2 Score: 4584 ======================================================= 2. glxgears – 简单的 Linux GPU 性能测试工具

它将显示一组旋转齿轮并定期打印出帧速率。 作为 Linux 和类 Unix 系统(如 FreeBSD)的基本基准测试工具,它已经变得非常流行。 安装并运行如下:$ apt install mesa-utils $ glxgears

每五秒测量一次 GPU 帧速率并在屏幕上发布一次。 最终结果如下:

Running synchronized to the vertical refresh. The framerate should be approximately the same as the monitor refresh rate. 299 frames in 5.0 seconds = 59.416 FPS 299 frames in 5.0 seconds = 59.731 FPS 300 frames in 5.0 seconds = 59.940 FPS 300 frames in 5.0 seconds = 59.968 FPS 300 frames in 5.0 seconds = 59.943 FPS 300 frames in 5.0 seconds = 59.967 FPS 299 frames in 5.0 seconds = 59.742 FPS 300 frames in 5.0 seconds = 59.951 FPS ..... ... ...3. gpustat – 在 Linux 和 FreeBSD Unix 上获取 Nvidia GPU 统计数据的简单工具

它是用 Python 编写的,是 CLI 用户,尤其是 ML/AI 开发人员的完美工具。 可以使用以下方法安装它 画中画$ pip install gpustat $ pip3 install gpustat

运行如下:$ gpustat $ gpustat -cp

在这里,我们看到运行进程的名称及其在 Nvidia GPU 上运行的 PID:

nixcraft-wks01 Tue Nov 24 15:46:37 2020 450.80.02 [0] GeForce GTX 1650 with Max-Q Design | 39'C, ?? %, 2 % | 962 / 3911 MB | Xorg/2454(100M) Xorg/3504(325M) gnome-shell/3689(181M) firefox/4614(1M) firefox/5036(1M) firefox/5143(1M)

查看帮助:$ gpustat -h

4. intel_gpu_top – 在 Linux 上显示类似 top 的英特尔 GPU 使用情况摘要

首先安装该工具,运行:$ sudo apt install intel-gpu-tools ## CentOS/RHEL/Fedora Linux user try the dnf command ## $ sudo dnf install intel-gpu-tools Fedora, RHEL 和 CentOS Linux 用户可以使用 podman 命令如下进行安装:$ podman run --rm --priviledged registry.freedesktop.org/drm/igt-gpu-tools/igt:master

该工具使用 i915 公开的性能计数器 (PMU) 和其他平台驱动程序(如 RAPL(电源)和 Uncore IMC(内存带宽))收集数据。 在Linux系统上运行如下:$ sudo intel_gpu_top

5. nvidia-smi – NVIDIA 系统管理接口程序

nvidia-smi 为来自 Fermi 和更高架构系列的 NVIDIA Tesla、Quadro、GRID 和 GeForce 设备提供监控和管理功能。 大多数功能都支持 GeForce Titan 系列设备,但为 Geforce 品牌的其余部分提供的信息非常有限。 NVSMI 是一个跨平台工具,支持所有标准 NVIDIA 驱动程序支持的 Linux 和 FreeBSD。 在 Ubuntu Linux 上安装 Nvidia 驱动程序后,请按如下方式安装:$ apt install nvidia-smi

打开终端,然后运行:$ nvidia-smi -q -g 0 -d UTILIZATION -l 1 $ sudo nvidia-smi $ nvidia-smi --help

这是我们看到的:

Tue Nov 24 15:57:43 2020 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 450.80.02 Driver Version: 450.80.02 CUDA Version: 11.0 | |-------------------------------+----------------------+----------------------+ | 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 GeForce GTX 165... Off | 00000000:01:00.0 On | N/A | | N/A 40C P8 3W / N/A | 1011MiB / 3911MiB | 2% Default | | | | N/A | +-------------------------------+----------------------+----------------------+ +-----------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=============================================================================| | 0 N/A N/A 2454 G /usr/lib/xorg/Xorg 100MiB | | 0 N/A N/A 3504 G /usr/lib/xorg/Xorg 357MiB | | 0 N/A N/A 3689 G /usr/bin/gnome-shell 179MiB | | 0 N/A N/A 4614 G /usr/lib/firefox/firefox 1MiB | | 0 N/A N/A 5036 G /usr/lib/firefox/firefox 1MiB | | 0 N/A N/A 5143 G /usr/lib/firefox/firefox 1MiB | | 0 N/A N/A 6406 G ...AAAAAAAA== --shared-files 225MiB | | 0 N/A N/A 14462 G ...AAAAAAAA== --shared-files 131MiB | +-----------------------------------------------------------------------------+ 6. nvtop – NVIDIA GPU 顶级

另一个适用于 NVIDIA GPU 的奇特但非常有用的工具。 它是一个基于 ncurses 的 GPU 状态查看器,用于 NVIDIA GPU,类似于 htop 命令或 top 命令。 我们可以在 Debian 或 Ubuntu Linux 上使用 apt 命令/apt-get 命令按如下方式安装它:$ apt install nvtop ## RUN the tool ## $ nvtop

当 nvtop 出现在屏幕上时,以下命令可用:

向上 – 选择(突出显示)上一个过程。向下 – 选择(突出显示)下一个过程。左/右 – 在流程行中滚动。+ – 排序越来越多。– – 递减排序。F1 – 选择要发送到突出显示的进程的信号。F2 – 选择要排序的字段。 当前排序字段在标题栏中突出显示。F3, q, Esc – Exit nvtop 并返回到你的 shell7. radeontop – 在 Linux 上显示 AMD GPU 利用率的工具

查看您的 AMD GPU 利用率,包括 Linux 上的总活动百分比和单个块。 安装如下:$ sudo apt install radeontop $ sudo radeontop

它适用于 R600 及更高版本的 GPU,即使是南部岛屿也应该可以正常工作。 适用于开源 AMD 驱动程序和 AMD Catalyst 闭源驱动程序:

结论

您了解了用于在 Linux 和基于 BSD 的系统上进行监控和诊断的各种 Linux GPU 命令和工具。 如果我错过了下面评论部分中您最喜欢的工具,请告诉我。



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有