Fix NVIDIA_VISIBLE_DEVICES=all env var value will result in no GPU metrics being reported

This commit is contained in:
allegroai 2024-02-15 19:05:25 +02:00
parent 8746f34409
commit 7362955983

View File

@ -52,7 +52,7 @@ class ResourceMonitor(BackgroundMonitor):
try:
active_gpus = os.environ.get('NVIDIA_VISIBLE_DEVICES', '') or \
os.environ.get('CUDA_VISIBLE_DEVICES', '')
if active_gpus:
if active_gpus != "all":
self._active_gpus = [g.strip() for g in active_gpus.split(',')]
except Exception:
pass