mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fixed error with cuda_ver in cpp_extension.py (#113555)
Reported in 71ca42787f (r132390833)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/113555
Approved by: https://github.com/ezyang
This commit is contained in:
parent
4b09b08d2e
commit
a43c757275
|
|
@ -22,7 +22,7 @@ from ._cpp_extension_versioner import ExtensionVersioner
|
|||
from .hipify import hipify_python
|
||||
from .hipify.hipify_python import GeneratedFileCleaner
|
||||
from typing import Dict, List, Optional, Union, Tuple
|
||||
from torch.torch_version import TorchVersion
|
||||
from torch.torch_version import TorchVersion, Version
|
||||
|
||||
from setuptools.command.build_ext import build_ext
|
||||
|
||||
|
|
@ -400,11 +400,12 @@ def _check_cuda_version(compiler_name: str, compiler_version: TorchVersion) -> N
|
|||
if cuda_version is None:
|
||||
return
|
||||
|
||||
cuda_ver = cuda_str_version = cuda_version.group(1)
|
||||
cuda_str_version = cuda_version.group(1)
|
||||
cuda_ver = Version(cuda_str_version)
|
||||
if torch.version.cuda is None:
|
||||
return
|
||||
|
||||
torch_cuda_version = TorchVersion(torch.version.cuda)
|
||||
torch_cuda_version = Version(torch.version.cuda)
|
||||
if cuda_ver != torch_cuda_version:
|
||||
# major/minor attributes are only available in setuptools>=49.4.0
|
||||
if getattr(cuda_ver, "major", None) is None:
|
||||
|
|
@ -1446,8 +1447,8 @@ def _check_and_build_extension_h_precompiler_headers(
|
|||
raise RuntimeError(f"Compile PreCompile Header fail, command: {pch_cmd}") from e
|
||||
|
||||
extra_cflags_str = listToString(extra_cflags)
|
||||
extra_include_paths_str = (
|
||||
"" if extra_include_paths is None else " ".join([f"-I{include}" for include in extra_include_paths])
|
||||
extra_include_paths_str = " ".join(
|
||||
[f"-I{include}" for include in extra_include_paths] if extra_include_paths else []
|
||||
)
|
||||
|
||||
lib_include = os.path.join(_TORCH_PATH, 'include')
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user