fix: satisfy ruff format and import lint in setup.py
- Merge nested if for CUDA version mismatch check - Convert try-except-pass to return None (S110) - Apply ruff format
This commit is contained in:
@@ -62,14 +62,17 @@ class _CMakeBuildExt(_build_ext):
|
|||||||
|
|
||||||
nvcc_ver = _cuda_toolkit_version()
|
nvcc_ver = _cuda_toolkit_version()
|
||||||
torch_cuda = _torch_cuda_version()
|
torch_cuda = _torch_cuda_version()
|
||||||
if nvcc_ver is not None and torch_cuda is not None:
|
if (
|
||||||
if nvcc_ver[0] != int(torch_cuda.split(".")[0]):
|
nvcc_ver is not None
|
||||||
warnings.warn(
|
and torch_cuda is not None
|
||||||
f"CUDA version mismatch: nvcc is {nvcc_ver[0]}.{nvcc_ver[1]} "
|
and nvcc_ver[0] != int(torch_cuda.split(".")[0])
|
||||||
f"but torch was built with CUDA {torch_cuda}. "
|
):
|
||||||
f"Install a matching torch wheel.",
|
warnings.warn(
|
||||||
stacklevel=2,
|
f"CUDA version mismatch: nvcc is {nvcc_ver[0]}.{nvcc_ver[1]} "
|
||||||
)
|
f"but torch was built with CUDA {torch_cuda}. "
|
||||||
|
f"Install a matching torch wheel.",
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
cmake = shutil.which("cmake")
|
cmake = shutil.which("cmake")
|
||||||
if cmake is None:
|
if cmake is None:
|
||||||
@@ -92,9 +95,7 @@ class _CMakeBuildExt(_build_ext):
|
|||||||
if arch:
|
if arch:
|
||||||
cfg.append(f"-DASTRAI_CUDA_ARCH={arch}")
|
cfg.append(f"-DASTRAI_CUDA_ARCH={arch}")
|
||||||
subprocess.run(cfg, check=True)
|
subprocess.run(cfg, check=True)
|
||||||
subprocess.run(
|
subprocess.run([cmake, "--build", str(build_dir), "-j", parallel], check=True)
|
||||||
[cmake, "--build", str(build_dir), "-j", parallel], check=True
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _cuda_toolkit_version():
|
def _cuda_toolkit_version():
|
||||||
|
|||||||
Reference in New Issue
Block a user