mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-10-23 08:07:34 -06:00
[PR #234] fix(api/device): correct shared-memory accounting on N1X and DGX Spark #233
Labels
No labels
api
bug
bug
cli / tui
dependencies
documentation
documentation
documentation
duplicate
enhancement
exporter
invalid
pull-request
pynvml
question
question
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github-starred/nvitop#233
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/XuehaiPan/nvitop/pull/234
Author: @johnnynunez
Created: 10/25/2026
Status: 🔄 Open
Base:
main← Head:fix/unified-memory-available📝 Commits (1)
1f39a73fix(api/device): correct unified-memory available capacity📊 Changes
4 files changed (+155 additions, -1 deletions)
View changed files
📝
.github/workflows/lint.yaml(+3 -0)📝
nvitop/api/device.py(+11 -1)➕
tests/__init__.py(+1 -0)➕
tests/test_device_memory.py(+140 -0)📄 Description
Issue Type
Description
Correct the existing unified-memory fallback in
Device.memory_info():psutil.virtual_memory().availableas free shared memory, including reclaimable cache.total - availableas used shared memory so used + free equals total.NVML_ERROR_NOT_SUPPORTEDand successful zero-total fallback triggers, and reserved memory asN/A.Positive-total NVML responses, per-process GPU memory, and other NVML error handling are unchanged. No new dependencies, GPU-name checks, or RAM-size detection heuristics.
Motivation and Context
On coherent shared-memory machines,
freeexcludes reclaimable cache and can severely understate allocatable memory. Combiningvm.freewithvm.usedalso gives an inconsistent total on Linux. In the live cache-heavy DGX Spark sample below, the old mapping would report 24.37 GiB free while the OS reports 113.61 GiB available.Related: #193, #195, #208. This is a narrow accounting correction to the existing fallback, not the positive-total detection change proposed in #208. Raw NVML returned
NVMLError_NotSupportedon all three tested machines.Runtime Environment and Hardware Validation
All machines: Linux aarch64, Python 3.14.4,
nvidia-ml-py12.550.89, psutil 7.1.0.The patched source tree was exercised on all three machines using temporary copies; no system packages or driver configuration were changed.
Testing
python -m unittest discover -s tests -v: 11/11 pass locally and on both DGX Sparks.python -m nvitop --once --readonly: exit 0 on all three; numeric memory totals displayed.--monitor --readonly --interval 1in 120x40 PTYs: start, refresh, and quit withq, exit 0 on all three; no tracebacks.Tests cover both fallback triggers, reclaimable cache, dynamic available capacity and boundaries, derived metrics and oneshot consistency, preserved discrete-GPU v1/v2 results, unavailable results, missing handles, and permission/lost-GPU/unknown errors.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.