From 8defcb4365240b130dc50d54c33e9a813089cf05 Mon Sep 17 00:00:00 2001 From: Richard Maw Date: Tue, 29 Sep 2015 13:11:27 +0000 Subject: Divide up available CPUs dynamically for builds Having 5 builds on ARM is not performant, so we should split it up dynamically. --- build_a_system.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/build_a_system.sh b/build_a_system.sh index 4dc5b9f..d38b8ce 100755 --- a/build_a_system.sh +++ b/build_a_system.sh @@ -7,11 +7,23 @@ set -ex system_name="$1" system_arch="$2" -definitions_dir=$(pwd)/definitions -ybd_dir=$(pwd)/ybd - -# Building is optimal with 5 "instances" on the monster machine -sudo sed -i '/^instances: /c\instances: 5' "$ybd_dir"/ybd.conf +definitions_dir="$(pwd)/definitions" +ybd_dir="$(pwd)/ybd" + +# Experimentally we have seen no benefit to a single build with greater +# than max-jobs: 10, though 8 divides up more nicely, so we previously +# had 5 builders with 8 cores each for the parallel build on the meaty +# x86 VPS, but we'd like to see some parallelism on the ARM builders, +# which have 8 CPUs total, so we'd need to have 4 to see any parallelism. +cpus_per_instance=4 + +# Determine the number of instances to have such that each has at least +# the specified number of CPUs but not more than double it. +# STYLE NOTE: Substitutions are intentionally not quoted here, since in +# some shells arithmetic expansion doesn't follow the traditional POSIX +# word splitting, so quotes aren't removed. +instances="$(( $(nproc) / $cpus_per_instance == 0 ? 1 : $(nproc) / $cpus_per_instance ))" +sudo sed -i "/^instances: /c\\instances: $instances" "$ybd_dir"/ybd.conf # will this build things - No. # "$ybd_dir"/ybd.py "$definitions_dir"/systems/"$system_name" -- cgit v1.2.1