一眼看清谁在霸占 GPU — a tiny Linux CLI that prints which user is using how much GPU memory.
Project description
whovidia
一眼看清谁在霸占 GPU。 A tiny Linux CLI that prints which user is using how much GPU memory.
┌─────────┬──────────┬─────────┬─────────────────────────────────────────────┐
│ PID │ 用户 │ 占用 │ 跑的啥 │
╞═════════╪══════════╪═════════╪═════════════════════════════════════════════╡
│ 2422445 │ rui.zhao │ 17.8 GB │ reconstruction_pipeline_node(已经跑 6.0 小时)│
│ 1719272 │ root │ 5.0 GB │ carter.py(已经跑 9.5 小时) │
└─────────┴──────────┴─────────┴─────────────────────────────────────────────┘
安装 / Install
pip install whovidia
需要 Python 3.9+ 和 nvidia-smi(装了 NVIDIA 驱动的 Linux)。
Requires Python 3.9+ and nvidia-smi on PATH. Linux only. Windows is unsupported because nvidia-smi --query-compute-apps on Windows includes graphics processes (DWM, browsers, games) without usable memory accounting, so the table can't be trusted. macOS has no NVIDIA GPUs.
用法 / Usage
whovidia
也可以这么跑 / or run as a module:
python -m whovidia
输出按显存占用从大到小排序,包括: Output is sorted by GPU memory usage (descending) and shows:
- PID — 进程号
- 用户 / user — 占用 GPU 的系统用户
- 占用 / VRAM — 显存占用 (
MB/GB) - 跑的啥 / process — 进程命令名(自动解开
python script.py这种壳),并附上已运行时长
颜色输出在 TTY 下自动启用;可设置 NO_COLOR=1 关闭。
ANSI colors are enabled automatically on a TTY; set NO_COLOR=1 to disable.
工作原理 / How it works
- 调用
nvidia-smi --query-compute-apps=pid,used_memory,process_name拿到所有占用 GPU 的进程; - 用
ps -o user=,etimes=,args=补上用户名、运行时长、命令行; - 渲染成一张 Unicode 表格,按显存排序。
整个工具零运行时依赖 — 只用 Python 标准库。 Zero runtime dependencies — pure Python stdlib.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whovidia-0.1.0.tar.gz.
File metadata
- Download URL: whovidia-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99ddb743eb551e457d7d91e270c69903d8532ac5cdf21368f71df80243b342b3
|
|
| MD5 |
36082f7b6247d5f9efbf039c2024d540
|
|
| BLAKE2b-256 |
cbb5f3e1903483b104b9c1798bb66c18564deb573f3bad142ee5ff8da2a63458
|
File details
Details for the file whovidia-0.1.0-py3-none-any.whl.
File metadata
- Download URL: whovidia-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
956f33923df0768257387f31a091c21d503fd3ff71da7eab2f51400dfee7c1b0
|
|
| MD5 |
19eee8c08775c495f71513679ec91c95
|
|
| BLAKE2b-256 |
d8f8ec9822c3f2b1c600ee633eb2b59c5b1cef543fe970b00d504a35a5f3e9ba
|