Skip to content

Commit c4f0826

Browse files
committed
use ninja
1 parent b88a15f commit c4f0826

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
from torch.utils.cpp_extension import BuildExtension
1111
from torch.utils.cpp_extension import CppExtension, CUDAExtension, CUDA_HOME
1212

13+
major, minor = int(str(torch.__version__)[0]), int(str(torch.__version__)[2])
14+
use_ninja = major >= 2 or (major == 1 and minor >= 8)
15+
1316
WITH_CUDA = torch.cuda.is_available() and CUDA_HOME is not None
1417
suffices = ['cpu', 'cuda'] if WITH_CUDA else ['cpu']
1518
if os.getenv('FORCE_CUDA', '0') == '1':
@@ -96,7 +99,8 @@ def get_extensions():
9699
ext_modules=get_extensions() if not BUILD_DOCS else [],
97100
cmdclass={
98101
'build_ext':
99-
BuildExtension.with_options(no_python_abi_suffix=True, use_ninja=False)
102+
BuildExtension.with_options(no_python_abi_suffix=True,
103+
use_ninja=use_ninja)
100104
},
101105
packages=find_packages(),
102106
)

0 commit comments

Comments
 (0)