mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2025-09-05 20:19:51 +00:00
Merge pull request #523 from miaooo0000OOOO/main
optimize CMake multi core parallel
This commit is contained in:
commit
94ab2de3b9
1 changed files with 6 additions and 1 deletions
7
setup.py
7
setup.py
|
@ -308,8 +308,13 @@ class CMakeBuild(BuildExtension):
|
||||||
"-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]
|
"-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))]
|
||||||
|
|
||||||
if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ:
|
if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ:
|
||||||
|
cpu_count = os.cpu_count()
|
||||||
|
if cpu_count is None:
|
||||||
|
cpu_count = 1
|
||||||
if hasattr(self, "parallel") and self.parallel:
|
if hasattr(self, "parallel") and self.parallel:
|
||||||
build_args += [f"-j{self.parallel}"]
|
build_args += [f"--parallel={self.parallel}"]
|
||||||
|
else:
|
||||||
|
build_args += [f"--parallel={cpu_count}"]
|
||||||
print("CMake args:", cmake_args)
|
print("CMake args:", cmake_args)
|
||||||
build_temp = Path(ext.sourcedir) / "build"
|
build_temp = Path(ext.sourcedir) / "build"
|
||||||
if not build_temp.exists():
|
if not build_temp.exists():
|
||||||
|
|
Loading…
Add table
Reference in a new issue