Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit df408bd

Browse files
committedOct 3, 2023
Only need first line of --query-gpu=count
1 parent daaa7e7 commit df408bd

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)
Please sign in to comment.