Skip to content

Commit

Permalink
Check if GPU idx is not space or \n
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-petrenko committed Jan 16, 2023
1 parent 9e508a6 commit 7509cc4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sample_factory/utils/gpu_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_available_gpus() -> List[int]:
Returns indices of GPUs specified by CUDA_VISIBLE_DEVICES.
"""
orig_visible_devices = os.environ[f"{CUDA_ENVVAR}"]
available_gpus = [int(g.strip()) for g in orig_visible_devices.split(",") if g]
available_gpus = [int(g.strip()) for g in orig_visible_devices.split(",") if g and not g.isspace()]
return available_gpus


Expand Down

0 comments on commit 7509cc4

Please sign in to comment.