Skip to content
Snippets Groups Projects
Commit 90fd75bb authored by Frederik Hennig's avatar Frederik Hennig
Browse files

use nvcc again to get cuda version

parent 9e3e8af0
No related branches found
No related tags found
1 merge request!436Introduce Nox for Local and CI Test Automation. Start Writing a Contributors Guide.
Pipeline #71872 failed
......@@ -4,21 +4,26 @@ from typing import Sequence
import os
import nox
import subprocess
import re
nox.options.sessions = ["lint", "typecheck", "testsuite"]
def get_cuda_version() -> None | tuple[int, ...]:
smi_args = ["nvidia-smi", "--version"]
query_args = ["nvcc", "--version"]
try:
result = subprocess.run(smi_args, capture_output=True)
query_result = subprocess.run(query_args, capture_output=True)
except FileNotFoundError:
return None
smi_output = str(result.stdout).splitlines()
cuda_version = smi_output[-1].split(":")[1].strip()
return tuple(int(v) for v in cuda_version.split("."))
matches = re.findall(r"release \d+\.\d+", str(query_result.stdout))
if matches:
match = matches[0]
version_string = match.split()[-1]
return tuple(int(v) for v in version_string.split("."))
else:
return None
def editable_install(session: nox.Session, opts: Sequence[str] = ()):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment