Skip to content

Commit 8da0d27

Browse files
committed
COMP: Limit load for macOS 13 Intel builds
The load gets too high and the build is extremely slow.
1 parent d6197eb commit 8da0d27

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ if(ITKPythonPackage_USE_TBB)
2929
)
3030
endif()
3131

32+
if(${CMAKE_GENERATOR} STREQUAL "Ninja")
33+
include(ProcessorCount)
34+
ProcessorCount(n_processors)
35+
set(ep_build_command BUILD_COMMAND ${CMAKE_COMMAND} --build <BUILD_DIR> -- -j${n_processors} -l${n_processors})
36+
endif()
37+
3238
if(ITKPythonPackage_SUPERBUILD)
3339

3440
#-----------------------------------------------------------------------------
@@ -117,6 +123,7 @@ if(ITKPythonPackage_SUPERBUILD)
117123
ExternalProject_add(oneTBB
118124
URL https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.9.0.tar.gz
119125
URL_HASH SHA256=1ce48f34dada7837f510735ff1172f6e2c261b09460e3bf773b49791d247d24e
126+
${ep_build_command}
120127
CMAKE_ARGS
121128
-DTBB_TEST:BOOL=OFF
122129
-DCMAKE_BUILD_TYPE:STRING=Release
@@ -265,6 +272,7 @@ if(ITKPythonPackage_SUPERBUILD)
265272

266273
ExternalProject_add(ITK
267274
DOWNLOAD_COMMAND ""
275+
${ep_build_command}
268276
SOURCE_DIR ${ITK_SOURCE_DIR}
269277
BINARY_DIR ${ITK_BINARY_DIR}
270278
PREFIX "ITKp"

scripts/macpython-build-wheels.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ fi
6363

6464
# Build standalone project and populate archive cache
6565
tbb_dir=$PWD/oneTBB-prefix/lib/cmake/TBB
66+
n_processors=$(sysctl -n hw.ncpu)
6667
# So delocate can find the libs
6768
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:$PWD/oneTBB-prefix/lib
6869
mkdir -p ITK-source
@@ -75,7 +76,7 @@ pushd ITK-source > /dev/null 2>&1
7576
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING=${osx_target} \
7677
-DCMAKE_OSX_ARCHITECTURES:STRING=${osx_arch} \
7778
${SCRIPT_DIR}/../
78-
${NINJA_EXECUTABLE}
79+
${NINJA_EXECUTABLE} -j$n_processors -l$n_processors
7980
popd > /dev/null 2>&1
8081

8182
SINGLE_WHEEL=0
@@ -170,7 +171,7 @@ for VENV in "${VENVS[@]}"; do
170171
${CMAKE_OPTIONS} \
171172
-G Ninja \
172173
${source_path} \
173-
&& ninja\
174+
&& ninja -j$n_processors -l$n_processors \
174175
|| exit 1
175176
)
176177

0 commit comments

Comments
 (0)