summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfcalvet <38648518+fcalvet@users.noreply.github.com>2020-02-11 09:11:33 +0100
committerGitHub <noreply@github.com>2020-02-11 09:11:33 +0100
commit97916d2126eb575d37ad8ed7eccaaa30f9c65f4f (patch)
tree976bc46b384a84c533fe80009b8b82b42109283a
parentb6727ad42e6d315a208902070cb239af884dc96c (diff)
fix GPU memory consumption reporting
Reverting changes in d434333dfe8f377989537ddad2296215fd6f78b5 which displayed something else than memory usage. Old calculation with new py3nvml module still aligns with nvidia-smi output
-rw-r--r--glances/plugins/glances_gpu.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/glances/plugins/glances_gpu.py b/glances/plugins/glances_gpu.py
index cf588216..9fd1c292 100644
--- a/glances/plugins/glances_gpu.py
+++ b/glances/plugins/glances_gpu.py
@@ -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