Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow restriction of number of threads when building pytket using cmake. #1180

Merged
merged 2 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions build-without-conan.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,3 +255,7 @@ This needs the shared `tklog` and `tket` libraries to be installed.
cd ${TKET_DIR}/pytket
NO_CONAN=1 pip install -v -e .
```

(You can use the environment variable `PYTKET_CMAKE_N_THREADS` to restrict the
number of threads used in the above command; otherwise one thread per CPU is
used.)
7 changes: 6 additions & 1 deletion pytket/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ def run(self):
["cmake", f"-DCMAKE_INSTALL_PREFIX={install_dir}", os.pardir], cwd=build_dir
)
subprocess.run(
["cmake", "--build", os.curdir, f"-j{multiprocessing.cpu_count()}"],
[
"cmake",
"--build",
os.curdir,
f"-j{os.getenv('PYTKET_CMAKE_N_THREADS', multiprocessing.cpu_count())}",
],
cwd=build_dir,
)
subprocess.run(["cmake", "--install", os.curdir], cwd=build_dir)
Expand Down
Loading