[PR #224] [MERGED] feat(examples): enrich the colored monitor and support uv run from a URL #223

Closed
opened 2026-10-02 23:15:07 -06:00 by gitea-mirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/XuehaiPan/nvitop/pull/224
Author: @XuehaiPan
Created: 7/10/2026
Status: ✅ Merged
Merged: 7/10/2026
Merged by: @XuehaiPan

Base: main ← Head: feat/examples-improvements


📝 Commits (2)

  • ce3c935 feat(examples/monitor-colored): add host summary and two-column panel
  • 6bd544f feat(examples): run scripts via uv from a URL without a clone (PEP 723)

📊 Changes

17 files changed (+238 additions, -33 deletions)

View changed files

📝 docs/source/spelling_wordlist.txt (+2 -0)
📝 examples/collector-background/README.md (+6 -0)
📝 examples/collector-background/collector_background.py (+11 -1)
📝 examples/collector-csv/README.md (+6 -0)
📝 examples/collector-csv/collector_csv.py (+11 -1)
📝 examples/collector-tensorboard/README.md (+6 -0)
📝 examples/collector-tensorboard/collector_tensorboard.py (+11 -1)
📝 examples/monitor-colored/README.md (+13 -4)
📝 examples/monitor-colored/monitor_colored.py (+102 -18)
📝 examples/monitor-minimal/README.md (+6 -0)
📝 examples/monitor-minimal/monitor_minimal.py (+15 -6)
📝 examples/monitor-web/README.md (+6 -0)
📝 examples/monitor-web/monitor_web.py (+9 -0)
📝 examples/select-devices-api/README.md (+6 -0)
📝 examples/select-devices-api/select_devices_api.py (+11 -1)
📝 examples/take-snapshots/README.md (+6 -0)
📝 examples/take-snapshots/take_snapshots_demo.py (+11 -1)

📄 Description

Issue Type

  • Bug fix
  • Improvement/feature implementation

Runtime Environment

Examples and tooling change; validated in these environments:

  • Operating system and version: Ubuntu (4× NVIDIA H100 80GB HBM3); macOS for lint / format
  • Python version: 3.12.3
  • nvitop version or commit: feat/examples-improvements (this branch)
  • Locale: en_US.UTF-8

Description

Two improvements to examples/, split into two commits.

Enrich the colored monitor (monitor-colored):

  • Host summary line ([Host]: CPU / memory / swap / load) via nvitop.host.
  • Two-column device panel with memory-usage percentages.
  • White device name against green [CUDA/NVML] and total-memory tags.
  • Wider PID column for 7-digit PIDs; CPU% now handles multi-threaded processes (>100%).
  • Per-process GPU memory-bandwidth (GMBW%) column.
  • Title-case the labels in monitor-minimal and drop its redundant total-memory line.

Run scripts via uv from a URL, no clone (all runnable examples):

  • Add PEP 723 inline metadata (requires-python + dependencies) to the 8 runnable examples, so each runs straight from its URL:

    uv run https://github.com/XuehaiPan/nvitop/raw/HEAD/examples/<dir>/<script>.py
    
  • Each script's docstring and README now shows the uv run invocation. For the collector examples this replaces the pip install -r requirements.txt + python3 … steps with a single command.

  • ml-framework-callbacks are Callback classes with no entry point, so they are left untouched.

  • Add uv and tensorboard to the spelling wordlist.

Motivation and Context

Closes #221 — the monitor-colored example now surfaces SM Clock and Memory Clock on dedicated rows that are never truncated, providing the always-visible clock readout that issue asked for. The nvitop TUI's width-based truncation is intentional and left unchanged; this gives users a clock-visible alternative.

uv run support lets anyone try an example with a single command and zero setup — no clone, and no manual pip install for the examples that need extra dependencies.

Testing

  • pre-commit passes on all changed files (ruff, ruff-format, mypy, pylint, codespell).
  • All 8 runnable scripts pass python3 -m py_compile.
  • monitor-colored rendered against mock devices (H100 + GB10 with N/A fields, 7-digit PIDs, >100% CPU) and on a real 4×H100 host.
  • No runtime code outside examples/ changed (plus two spelling-wordlist entries).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/XuehaiPan/nvitop/pull/224 **Author:** [@XuehaiPan](https://github.com/XuehaiPan) **Created:** 7/10/2026 **Status:** ✅ Merged **Merged:** 7/10/2026 **Merged by:** [@XuehaiPan](https://github.com/XuehaiPan) **Base:** `main` ← **Head:** `feat/examples-improvements` --- ### 📝 Commits (2) - [`ce3c935`](https://github.com/XuehaiPan/nvitop/commit/ce3c935d0507c20dc73dbf86f6690848d4bbdb41) feat(examples/monitor-colored): add host summary and two-column panel - [`6bd544f`](https://github.com/XuehaiPan/nvitop/commit/6bd544fab0b8ecee3d4e67dc177fc0fef9de1d98) feat(examples): run scripts via `uv` from a URL without a clone (PEP 723) ### 📊 Changes **17 files changed** (+238 additions, -33 deletions) <details> <summary>View changed files</summary> 📝 `docs/source/spelling_wordlist.txt` (+2 -0) 📝 `examples/collector-background/README.md` (+6 -0) 📝 `examples/collector-background/collector_background.py` (+11 -1) 📝 `examples/collector-csv/README.md` (+6 -0) 📝 `examples/collector-csv/collector_csv.py` (+11 -1) 📝 `examples/collector-tensorboard/README.md` (+6 -0) 📝 `examples/collector-tensorboard/collector_tensorboard.py` (+11 -1) 📝 `examples/monitor-colored/README.md` (+13 -4) 📝 `examples/monitor-colored/monitor_colored.py` (+102 -18) 📝 `examples/monitor-minimal/README.md` (+6 -0) 📝 `examples/monitor-minimal/monitor_minimal.py` (+15 -6) 📝 `examples/monitor-web/README.md` (+6 -0) 📝 `examples/monitor-web/monitor_web.py` (+9 -0) 📝 `examples/select-devices-api/README.md` (+6 -0) 📝 `examples/select-devices-api/select_devices_api.py` (+11 -1) 📝 `examples/take-snapshots/README.md` (+6 -0) 📝 `examples/take-snapshots/take_snapshots_demo.py` (+11 -1) </details> ### 📄 Description #### Issue Type - Bug fix - Improvement/feature implementation #### Runtime Environment Examples and tooling change; validated in these environments: - Operating system and version: Ubuntu (4× NVIDIA H100 80GB HBM3); macOS for lint / format - Python version: `3.12.3` - `nvitop` version or commit: `feat/examples-improvements` (this branch) - Locale: `en_US.UTF-8` #### Description Two improvements to `examples/`, split into two commits. **Enrich the colored monitor** (`monitor-colored`): - Host summary line (`[Host]`: CPU / memory / swap / load) via `nvitop.host`. - Two-column device panel with memory-usage percentages. - White device name against green `[CUDA/NVML]` and total-memory tags. - Wider PID column for 7-digit PIDs; CPU% now handles multi-threaded processes (>100%). - Per-process GPU memory-bandwidth (`GMBW%`) column. - Title-case the labels in `monitor-minimal` and drop its redundant total-memory line. **Run scripts via `uv` from a URL, no clone** (all runnable examples): - Add PEP 723 inline metadata (`requires-python` + `dependencies`) to the 8 runnable examples, so each runs straight from its URL: ```text uv run https://github.com/XuehaiPan/nvitop/raw/HEAD/examples/<dir>/<script>.py ``` - Each script's docstring and README now shows the `uv run` invocation. For the collector examples this replaces the `pip install -r requirements.txt` + `python3 …` steps with a single command. - `ml-framework-callbacks` are `Callback` classes with no entry point, so they are left untouched. - Add `uv` and `tensorboard` to the spelling wordlist. #### Motivation and Context Closes #221 — the `monitor-colored` example now surfaces `SM Clock` and `Memory Clock` on dedicated rows that are never truncated, providing the always-visible clock readout that issue asked for. The `nvitop` TUI's width-based truncation is intentional and left unchanged; this gives users a clock-visible alternative. `uv run` support lets anyone try an example with a single command and zero setup — no clone, and no manual `pip install` for the examples that need extra dependencies. #### Testing - `pre-commit` passes on all changed files (ruff, ruff-format, mypy, pylint, codespell). - All 8 runnable scripts pass `python3 -m py_compile`. - `monitor-colored` rendered against mock devices (H100 + GB10 with `N/A` fields, 7-digit PIDs, >100% CPU) and on a real 4×H100 host. - No runtime code outside `examples/` changed (plus two spelling-wordlist entries). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
gitea-mirror 2026-10-02 23:15:07 -06:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github-starred/nvitop#223
No description provided.