Fix GPU monitoring on Windows machines

This commit is contained in:
allegroai 2020-08-08 14:43:25 +03:00
parent e4111c830b
commit ce6831368f

View File

@ -200,6 +200,9 @@ class GPUStatCollection(object):
GPUStatCollection.global_processes[nv_process.pid] = \
psutil.Process(pid=nv_process.pid)
ps_process = GPUStatCollection.global_processes[nv_process.pid]
process['pid'] = nv_process.pid
# noinspection PyBroadException
try:
process['username'] = ps_process.username()
# cmdline returns full path;
# as in `ps -o comm`, get short cmdnames.
@ -217,7 +220,9 @@ class GPUStatCollection(object):
process['cpu_memory_usage'] = \
round((ps_process.memory_percent() / 100.0) *
psutil.virtual_memory().total)
process['pid'] = nv_process.pid
except Exception:
# insufficient permissions
pass
return process
if not GPUStatCollection._gpu_device_info.get(index):