Skip to content

Commit 239ce5a

Browse files
committed
Only need first line of --query-gpu=count
1 parent d3f89d3 commit 239ce5a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

cwltool/cuda.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def cuda_device_count() -> str:
1919
except Exception as e:
2020
_logger.warning("Error checking number of GPUs with nvidia-smi: %s", e)
2121
return "0"
22-
return proc.stdout.decode("utf-8")
22+
# NOTE: On a machine with N GPUs the query return N lines, each containing N.
23+
return proc.stdout.decode("utf-8").split("\n")[0]
2324

2425

2526
def cuda_version_and_device_count() -> Tuple[str, int]:

0 commit comments

Comments
 (0)