Skip to content

enh: show the NVIDIA GPU usage in the status bar - #28

Merged
paulmueller merged 2 commits into
DC-analysis:mainfrom
paulmueller-agent:gpu-usage-statusbar
Nov 27, 2026
Merged

paulmueller merged 2 commits into
DC-analysis:mainfrom
paulmueller-agent:gpu-usage-statusbar

Conversation

@paulmueller-agent

@paulmueller-agent paulmueller-agent commented Nov 27, 2026 •

Copy link
Copy Markdown

Change

The status bar label from #24 now also shows the utilization and memory usage of NVIDIA GPUs, next to CPU and RAM:

CPU 76%   RAM 7.7 / 15.7 GiB (49%)   GPU 87% 3.2 / 4.0 GiB
  • The values are read with NVIDIA's management library (NVML), the library nvidia-smi uses, via NVIDIA's Python binding nvidia-ml-py (module pynvml, pure Python, BSD license). The package is added to the gui extra, so the Windows/macOS builds include it.
  • I chose NVML over calling nvidia-smi every 2 s, because that would start a new process each time (and can briefly show a console window on Windows).
  • Several GPUs are shown as GPU0 ... GPU1 ....
  • Memory: NVML's memory info version 2 is used if the driver supports it. Like nvidia-smi, it does not count memory reserved by the driver as used; version 1 showed 3.3 GiB where nvidia-smi showed 3244 MiB.
  • Without nvidia-ml-py, an NVIDIA driver, or an NVIDIA GPU (e.g. macOS, or CI), and if reading the values fails at some point, the GPU part is simply not shown.
  • The utilization is NVML's current sample. With "torchsto", it jumps between 0 % and 100 % because the GPU is fed in batches; nvidia-smi shows the same.

Tests

  • test_gui_sys_usage_gpu (fake pynvml module):
    • one GPU, two GPUs, and memory info version 2
  • test_gui_sys_usage_gpu_error: reading the GPU usage fails, so it is not shown.
  • test_gui_sys_usage_no_nvml: nvidia-ml-py is not installed.
  • test_gui_sys_usage now also accepts an optional GPU part, so that it passes on machines with an NVIDIA GPU.

The new GPU tests fail on main and pass with the change.

Manual check on the lab PC (Windows, RTX 2050) during a "torchsto" analysis: GPU 100% 3.2 / 4.0 GiB, GPU 96% ..., GPU 0% ... in consecutive updates, consistent with nvidia-smi (3244 MiB used).

Follow-up: flaky pause test on macOS (second commit)

The first CI run failed on macOS in test_manager_pause_resume (from #27): assert 'zombie' == 'stopped'. One child process of the test process was a zombie, i.e. it had already exited but was not reaped yet (e.g. a worker process of an earlier test). Such a process is not running, so it does not contradict the pause. The test now ignores zombie processes (and processes that disappear while checking) and still requires at least one stopped worker process. This is unrelated to the GPU usage, but it is in this PR because it blocked its CI.

Lint

lint-compare against main: ruff 0 → 0, pyright 1.1.408 0 → 0, flake8 clean.

🤖 Generated with Claude Code

The status bar label now also shows the utilization and memory usage
of each NVIDIA GPU, e.g. "GPU 87% 3.2 / 4.0 GiB" (several GPUs as
"GPU0 ...   GPU1 ..."). The values are read with NVIDIA's management
library (NVML) via `nvidia-ml-py` (module `pynvml`), which is added to
the `gui` extra. The memory info version 2 is used if available, so
that the memory does not include memory reserved by the driver (like
`nvidia-smi`). Without the package, an NVIDIA driver, or a GPU, and if
reading the values fails, the GPU usage is not shown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.59459% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.07%. Comparing base (8194f0e) to head (27ead4a).

Files with missing lines Patch % Lines
chipstream/gui/sys_usage.py 94.59% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #28      +/-   ##
==========================================
+ Coverage   80.80%   81.07%   +0.27%     
==========================================
  Files          23       23              
  Lines        1688     1723      +35     
==========================================
+ Hits         1364     1397      +33     
- Misses        324      326       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

On macOS CI, a child process of the test process was a zombie (it had
exited, but was not reaped yet, e.g. a worker of an earlier test), so
the check that all child processes are stopped failed. Zombie
processes are not running and are ignored now; at least one stopped
worker process is still required.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulmueller
paulmueller merged commit 4d6672b into DC-analysis:main Nov 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants