From 6056fd8e89d62a85057d2ff08e2732148254e2d7 Mon Sep 17 00:00:00 2001 From: Lingkai Dong Date: Thu, 13 Aug 2026 13:26:58 +0100 Subject: [PATCH] Improve FeedSim build parallelism on Ubuntu Use the same parallelism as on CentOS. --- .../feedsim/install_feedsim_aarch64_ubuntu.sh | 16 ++++++++++++---- packages/feedsim/install_feedsim_ubuntu.sh | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/packages/feedsim/install_feedsim_aarch64_ubuntu.sh b/packages/feedsim/install_feedsim_aarch64_ubuntu.sh index ae82c2a93..430713f84 100755 --- a/packages/feedsim/install_feedsim_aarch64_ubuntu.sh +++ b/packages/feedsim/install_feedsim_aarch64_ubuntu.sh @@ -96,7 +96,7 @@ if ! [ -d "fast_float" ]; then cd fast_float mkdir build && cd build cmake .. - make + make -j"$(nproc)" make install cd ../../ fi @@ -125,7 +125,7 @@ if ! [ -d "gflags-2.2.2" ]; then cd "gflags-2.2.2" mkdir -p build && cd build cmake -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ../ - make -j8 + make -j"$(nproc)" make install cd ../../ else @@ -139,7 +139,7 @@ if ! [ -d "glog-0.4.0" ]; then cd "glog-0.4.0" mkdir -p build && cd build cmake -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release ../ - make -j8 + make -j"$(nproc)" make install cd ../../ else @@ -331,7 +331,15 @@ cmake -G Ninja \ -DTorch_DIR="${FEEDSIM_THIRD_PARTY_SRC}/libtorch/share/cmake/Torch" \ ../ -ninja -v -j1 +# Third-party deps (fmt, folly, fizz, wangle, mvfst, fbthrift) are built by this +# ninja step via ExternalProject_Add. Their build order is declared in +# third_party/src/CMake/build-*.cmake via add_dependencies() and +# ExternalProject_Add_StepDependencies(), so ninja respects the DAG under -jN. +# Use nproc/2 to avoid OOM during heavy template-instantiation steps. +NINJA_JOBS="${BP_NINJA_JOBS:-$(( $(nproc) / 2 ))}" +[ "$NINJA_JOBS" -lt 1 ] && NINJA_JOBS=1 +msg "Building FeedSim with ninja -j${NINJA_JOBS} (set BP_NINJA_JOBS to override)" +ninja -j"${NINJA_JOBS}" msg "" msg "=== FeedSim Installation Complete ===" diff --git a/packages/feedsim/install_feedsim_ubuntu.sh b/packages/feedsim/install_feedsim_ubuntu.sh index 4237ea6b2..166feef18 100755 --- a/packages/feedsim/install_feedsim_ubuntu.sh +++ b/packages/feedsim/install_feedsim_ubuntu.sh @@ -115,7 +115,7 @@ if ! [ -d "fast_float" ]; then cd fast_float mkdir build && cd build cmake .. - make + make -j"$(nproc)" make install cd ../../ fi @@ -155,7 +155,7 @@ if ! [ -d "gflags-2.2.2" ]; then cd "gflags-2.2.2" mkdir -p build && cd build cmake -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ../ - make -j8 + make -j"$(nproc)" make install cd ../../ else @@ -169,7 +169,7 @@ if ! [ -d "glog-0.4.0" ]; then cd "glog-0.4.0" mkdir -p build && cd build cmake -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 ../ - make -j8 + make -j"$(nproc)" make install cd ../../ else @@ -326,7 +326,15 @@ cmake -G Ninja \ -DCMAKE_PREFIX_PATH="${FEEDSIM_THIRD_PARTY_SRC}/libtorch" \ ../ -ninja -v -j1 +# Third-party deps (fmt, folly, fizz, wangle, mvfst, fbthrift) are built by this +# ninja step via ExternalProject_Add. Their build order is declared in +# third_party/src/CMake/build-*.cmake via add_dependencies() and +# ExternalProject_Add_StepDependencies(), so ninja respects the DAG under -jN. +# Use nproc/2 to avoid OOM during heavy template-instantiation steps. +NINJA_JOBS="${BP_NINJA_JOBS:-$(( $(nproc) / 2 ))}" +[ "$NINJA_JOBS" -lt 1 ] && NINJA_JOBS=1 +msg "Building FeedSim with ninja -j${NINJA_JOBS} (set BP_NINJA_JOBS to override)" +ninja -j"${NINJA_JOBS}" msg "" msg "=== FeedSim Installation Complete ==="