mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-30 04:32:00 +03:00
fix GPU memory consumption reporting
Reverting changes in d434333dfe
which displayed something else than memory usage.
Old calculation with new py3nvml module still aligns with nvidia-smi output
This commit is contained in:
parent
b6727ad42e
commit
97916d2126
@ -292,7 +292,8 @@ def get_device_name(device_handle):
|
||||
def get_mem(device_handle):
|
||||
"""Get GPU device memory consumption in percent."""
|
||||
try:
|
||||
return pynvml.nvmlDeviceGetUtilizationRates(device_handle).memory
|
||||
memory_info = pynvml.nvmlDeviceGetMemoryInfo(device_handle)
|
||||
return memory_info.used * 100.0 / memory_info.total
|
||||
except pynvml.NVMLError:
|
||||
return None
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user