Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions nvitop/api/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,13 +985,21 @@ def memory_info(self) -> MemoryInfo: # in bytes
memory_info = NA
if libnvml.nvmlCheckReturn(memory_info):
if memory_info.total > 0:
return MemoryInfo(
total=memory_info.total,
free=memory_info.free,
used=memory_info.used,
reserved=getattr(memory_info, 'reserved', NA),
)
has_unified_memory = True
# Detect coherent unified-memory platforms (e.g. GB10 Grace Blackwell):
# nvmlDeviceGetMemoryInfo returns NVML_SUCCESS with total == system MemTotal (~121GB).
# If total >= 90% of system RAM, treat as unified memory and use MemAvailable instead.
vm = host.virtual_memory()
if vm.total > 0 and memory_info.total >= vm.total * 9 // 10:
has_unified_memory = True
else:
return MemoryInfo(
total=memory_info.total,
free=memory_info.free,
used=memory_info.used,
reserved=getattr(memory_info, 'reserved', NA),
)
else:
has_unified_memory = True
if has_unified_memory:
# Device with unified memory
# Use system virtual memory as these devices share host memory
Expand Down