From db7dc3b5df8eda9ef93225c64ae598c0d0fd87d2 Mon Sep 17 00:00:00 2001 From: Jake Fennick Date: Tue, 3 Oct 2023 13:18:49 -0600 Subject: [PATCH] Only need first line of --query-gpu=count --- cwltool/cuda.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cwltool/cuda.py b/cwltool/cuda.py index 7217434e6..2fd884aed 100644 --- a/cwltool/cuda.py +++ b/cwltool/cuda.py @@ -19,7 +19,8 @@ def cuda_device_count() -> str: except Exception as e: _logger.warning("Error checking number of GPUs with nvidia-smi: %s", e) return "0" - return proc.stdout.decode("utf-8") + # NOTE: On a machine with N GPUs the query return N lines, each containing N. + return proc.stdout.decode("utf-8").split("\n")[0] def cuda_version_and_device_count() -> Tuple[str, int]: