Site icon moneyslow.com

如何利用nvtop命令监控GPU(AMD & Intel)

openai技巧

openai技巧

nvtop 命令是一个基于 ncurses(新的curses 库,在终端中显示信息)的 GPU 状态查看器,适用于 AMD、Intel 和 NVIDIA GPU。换句话说,您可以将此交互式 GPU 进程查看器用于 Linux 上的以下 GPU,需要查看正在压力测试我的 GPU 以及 GPU 温度或风扇转速等关键信息时,我发现 nvtop 非常有用。您可以使用此工具快速终止耗尽所有 GPU 资源的进程,而无需使用 ps 命令/grep 命令然后杀死 PID。大多数现代应用程序(如 Firefox、Chrome 和用 Python 编写的代码)都可以使用专用的 NVIDIA 或 AMD GPU。因此,拥有这个小工具非常有用。不妨试试:

以下是各种linux版本的安装方式

Arch Linux:

pacman -Syu nvtop

Gentoo Linux:

layman -a guru
emerge -av nvtop

Ubuntu Impish (21.10), Debian buster (stable) 

apt update
apt install nvtop
Debian Linux 10+  的用户需要在/etc/apt/sources.list中添加:
deb http://deb.debian.org/debian buster main non-free contrib 
deb http://deb.debian.org/debian buster-updates main non-free contrib 
deb http://deb.debian.org/debian-security/ buster/updates main non-free contrib
然后安装:
apt update
apt search nvtop
apt-cache policy nvtop

Fedora Linux version 36+

 dnf install nvtop

CetOS Stream, RHEL, Rocky, and AlmaLinux version 8/9:

Enable EPEL repo and install the nvtop:
## RHEL 8/9 ##
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %{rhel}).noarch.rpm
sudo dnf install nvtop
## CentOS Stream, Rocky Linux, AlmaLinux ##
sudo dnf install -y epel-release
sudo dnf install nvtop

其他版本,All other Linux distro

snap search nvtop
snap install nvtop
当然在ubuntu下也可以用snap:
root@VM-0-14-ubuntu:~# snap install nvtop
2023-11-22T11:58:20+08:00 INFO Waiting for automatic snapd restart...
nvtop 3.0.2 from Maxime Schmitt (razortealeaf) installed
增加杀死进行的功能命令:
snap connect nvtop:process-control
查看硬件信息:
snap connect nvtop:hardware-observe
系统级别观察模式:
snap connect nvtop:system-observe
查看GPU温度:
snap connect nvtop:kubernetes-support

nvtop 有docker么?有的:

git clone https://github.com/Syllo/nvtop.git
cd nvtop
sudo docker build --tag nvtop .
sudo docker run -it --rm --runtime=nvidia --gpus=all --pid=host nvtop

获取帮助:nvtop -h,下面是命令的英文描述

快捷键说明
Up选择(高亮显示)上一个过程。
Down选择(高亮显示)上一个过程。
Left / Right在进程行中滚动
+按升序排序,即从小到大排序。
-按降序排序,即从大到小排序。
F2进入设置工具以修改接口选项。
F12将当前接口选项保存到持久存储。
F9“Kill”进程:选择要发送到突出显示的进程的信号。
F6排序:选择要排序的字段。当前排序字段会在标题栏中被高亮显示。
F10, q, Esc退出 nvtop 命令。
Exit mobile version