Skip to content

Commit ab8b7bd

Browse files
committed
Replace hardcoded cmake --build -j flags in docs and scripts
mac: $(sysctl -n hw.ncpu) - 1 linux: $(nproc) - 1
1 parent dfa5dbc commit ab8b7bd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+197
-87
lines changed

.ci/docker/common/install_openssl.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tar xf "${OPENSSL}.tar.gz"
1717
pushd "${OPENSSL}" || true
1818
./config --prefix=/opt/openssl -d "-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)"
1919
# NOTE: openssl install errors out when built with the -j option
20-
make -j6; make install_sw
20+
make -j$((nproc) - 1); make install_sw
2121
# Link the ssl libraries to the /usr/lib folder.
2222
ln -s /opt/openssl/lib/lib* /usr/lib
2323
popd || true

.ci/scripts/build-qnn-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ set_up_aot() {
3535
-DEXECUTORCH_BUILD_EXTENSION_TENSOR=ON \
3636
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
3737
-DPYTHON_EXECUTABLE=python3
38-
cmake --build $PWD --target "PyQnnManagerAdaptor" "PyQnnWrapperAdaptor" -j$(nproc)
38+
cmake --build $PWD --target "PyQnnManagerAdaptor" "PyQnnWrapperAdaptor" -j$((nproc) -1)
3939
# install Python APIs to correct import path
4040
# The filename might vary depending on your Python and host version.
4141
cp -f backends/qualcomm/PyQnnManagerAdaptor.cpython-310-x86_64-linux-gnu.so $EXECUTORCH_ROOT/backends/qualcomm/python

.ci/scripts/build_llama_android.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ install_executorch_and_backend_lib() {
3131
-DXNNPACK_ENABLE_ARM_BF16=OFF \
3232
-Bcmake-android-out .
3333

34-
cmake --build cmake-android-out -j4 --target install --config Release
34+
cmake --build cmake-android-out -j$((nproc) -1) --target install --config Release
3535
}
3636
3737
build_llama_runner() {
@@ -48,7 +48,7 @@ build_llama_runner() {
4848
-DCMAKE_BUILD_TYPE=Release \
4949
-Bcmake-android-out/examples/models/llama examples/models/llama
5050
51-
cmake --build cmake-android-out/examples/models/llama -j4 --config Release
51+
cmake --build cmake-android-out/examples/models/llama -j$((nproc) -1) --config Release
5252
}
5353
install_executorch_and_backend_lib
5454
build_llama_runner

.ci/scripts/setup-openvino.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ git submodule update --init --recursive
1616
sudo ./install_build_dependencies.sh
1717
mkdir build && cd build
1818
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_PYTHON=ON
19-
make -j$(nproc)
19+
make -j$((nproc) -1)
2020
2121
cd ..
2222
cmake --install build --prefix dist

.ci/scripts/test_llama.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ cmake_install_executorch_libraries() {
158158
-DEXECUTORCH_BUILD_QNN="$QNN" \
159159
-DQNN_SDK_ROOT="$QNN_SDK_ROOT" \
160160
-Bcmake-out .
161-
cmake --build cmake-out -j9 --target install --config "$CMAKE_BUILD_TYPE"
161+
cmake --build cmake-out -j$(($(nproc) - 1)) --target install --config "$CMAKE_BUILD_TYPE"
162162
}
163163

164164
cmake_build_llama_runner() {
@@ -173,7 +173,7 @@ cmake_build_llama_runner() {
173173
-DCMAKE_BUILD_TYPE="$CMAKE_BUILD_TYPE" \
174174
-Bcmake-out/${dir} \
175175
${dir}
176-
cmake --build cmake-out/${dir} -j9 --config "$CMAKE_BUILD_TYPE"
176+
cmake --build cmake-out/${dir} -j$(($(nproc) - 1)) --config "$CMAKE_BUILD_TYPE"
177177

178178
}
179179

.ci/scripts/test_llama_torchao_lowbit.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ cmake -DPYTHON_EXECUTABLE=python \
3636
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
3737
-DEXECUTORCH_BUILD_KERNELS_CUSTOM=ON \
3838
-Bcmake-out .
39-
cmake --build cmake-out -j16 --target install --config Release
39+
cmake --build cmake-out -j$(( $(nproc) - 1 )) --target install --config Release
4040

4141
# Install llama runner with torchao
4242
cmake -DPYTHON_EXECUTABLE=python \
@@ -49,7 +49,7 @@ cmake -DPYTHON_EXECUTABLE=python \
4949
-DEXECUTORCH_BUILD_TORCHAO=ON \
5050
-Bcmake-out/examples/models/llama \
5151
examples/models/llama
52-
cmake --build cmake-out/examples/models/llama -j16 --config Release
52+
cmake --build cmake-out/examples/models/llama -j$(($(nproc) - 1)) --config Release
5353

5454
# Download stories llama110m artifacts
5555
download_stories_model_artifacts

.ci/scripts/test_model.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ build_cmake_executor_runner() {
5959
&& cmake -DCMAKE_BUILD_TYPE=Release \
6060
-DEXECUTORCH_BUILD_XNNPACK=ON \
6161
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
62-
cmake --build ${CMAKE_OUTPUT_DIR} -j4
62+
cmake --build ${CMAKE_OUTPUT_DIR} -j$(($(nproc) - 1))
6363
else
6464
cmake -DCMAKE_BUILD_TYPE=Debug \
6565
-DEXECUTORCH_BUILD_KERNELS_OPTIMIZED=ON \
6666
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
6767
-B${CMAKE_OUTPUT_DIR} .
68-
cmake --build ${CMAKE_OUTPUT_DIR} -j4 --config Debug
68+
cmake --build ${CMAKE_OUTPUT_DIR} -j$(($(nproc) - 1)) --config Debug
6969
fi
7070
}
7171

.ci/scripts/test_quantized_aot_lib.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ build_cmake_quantized_aot_lib() {
2323
-DEXECUTORCH_BUILD_KERNELS_QUANTIZED_AOT=ON \
2424
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" ..)
2525

26-
cmake --build ${CMAKE_OUTPUT_DIR} -j4
26+
cmake --build ${CMAKE_OUTPUT_DIR} -j$(($(nproc) - 1))
2727
}
2828

2929
build_cmake_quantized_aot_lib

.ci/scripts/utils.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ build_executorch_runner_cmake() {
141141
else
142142
CMAKE_JOBS=$(( $(nproc) - 1 ))
143143
fi
144-
cmake --build "${CMAKE_OUTPUT_DIR}" -j "${CMAKE_JOBS}"
144+
cmake --build "${CMAKE_OUTPUT_DIR}" -j$((nproc) -1) "${CMAKE_JOBS}"
145145
}
146146
147147
build_executorch_runner() {
@@ -162,7 +162,7 @@ cmake_install_executorch_lib() {
162162
-DCMAKE_BUILD_TYPE=Release \
163163
-DPYTHON_EXECUTABLE="$PYTHON_EXECUTABLE" \
164164
-Bcmake-out .
165-
cmake --build cmake-out -j9 --target install --config Release
165+
cmake --build cmake-out -j$(($(nproc) - 1)) --target install --config Release
166166
}
167167

168168
download_stories_model_artifacts() {

.github/workflows/trunk.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ jobs:
561561
-DEXECUTORCH_BUILD_DEVTOOLS=ON \
562562
-DEXECUTORCH_ENABLE_EVENT_TRACER=ON \
563563
-Bcmake-out .
564-
cmake --build cmake-out -j16 --target install --config Release
564+
cmake --build cmake-out -j$(($(sysctl -n hw.ncpu) - 1)) --target install --config Release
565565
echo "::endgroup::"
566566
567567
echo "::group::Set up Hugging Face"

0 commit comments

Comments
 (0)