fix unittest process crash

where the tests for tests?..
This commit is contained in:
Sergey Krashevich 2023-05-03 14:51:50 +03:00
parent e33c87e9fe
commit b56265e377
No known key found for this signature in database
GPG Key ID: 625171324E7D3856

View File

@ -925,9 +925,10 @@ def try_get_info(f, h, default="N/A"):
def get_nvidia_gpu_stats() -> dict[int, dict]:
results = {}
try:
nvml.nvmlInit()
deviceCount = nvml.nvmlDeviceGetCount()
results = {}
for i in range(deviceCount):
handle = nvml.nvmlDeviceGetHandleByIndex(i)
meminfo = try_get_info(nvml.nvmlDeviceGetMemoryInfo, handle)
@ -947,7 +948,8 @@ def get_nvidia_gpu_stats() -> dict[int, dict]:
"gpu": gpu_util,
"mem": gpu_mem_util,
}
except:
return results
return results