Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: setup.py develop supports --parallel
  • Loading branch information
yuantailing committed Feb 21, 2025
commit d9c3507ae087ddf7549383f6cd4e3b8955758adb
9 changes: 7 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ def check_cudnn_version_and_warn(global_option: str, required_cudnn_version: int
)


# Patch because `setup.py bdist_wheel` does not accept the `parallel` option
# Patch because `setup.py bdist_wheel` and `setup.py develop` do not support the `parallel` option
parallel = None
if "--parallel" in sys.argv:
idx = sys.argv.index("--parallel")
Expand All @@ -874,6 +874,11 @@ class BuildExtensionSeparateDir(BuildExtension):
build_extension_patch_lock = threading.Lock()
thread_ext_name_map = {}

def finalize_options(self):
if parallel is not None:
self.parallel = parallel
super().finalize_options()

def build_extension(self, ext):
with self.build_extension_patch_lock:
if not getattr(self.compiler, "_compile_separate_output_dir", False):
Expand Down Expand Up @@ -902,6 +907,6 @@ def compile_new(*args, **kwargs):
install_requires=["packaging>20.6"],
description="PyTorch Extensions written by NVIDIA",
ext_modules=ext_modules,
cmdclass={"build_ext": BuildExtensionSeparateDir.with_options(parallel=parallel)} if ext_modules else {},
cmdclass={"build_ext": BuildExtensionSeparateDir} if ext_modules else {},
extras_require=extras,
)