Skip to content

Commit

Permalink
Only need first line of --query-gpu=count
Browse files Browse the repository at this point in the history
  • Loading branch information
jfennick committed Oct 3, 2023
1 parent daaa7e7 commit df408bd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cwltool/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Check warning on line 23 in cwltool/cuda.py

View check run for this annotation

Codecov / codecov/patch

cwltool/cuda.py#L23

Added line #L23 was not covered by tests


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

0 comments on commit df408bd

Please sign in to comment.