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:
fcalvet 2020-02-11 09:11:33 +01:00 committed by GitHub
parent b6727ad42e
commit 97916d2126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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