Skip to content

Commit

Permalink
Allow restriction of number of threads when building pytket using cma…
Browse files Browse the repository at this point in the history
…ke. (#1180)
  • Loading branch information
cqc-alec authored Jan 3, 2024
1 parent 9a2e346 commit a9cc4e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
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

0 comments on commit a9cc4e9

Please sign in to comment.