From 81363c0731821f1f846a5f647e6990c3c504eb9d Mon Sep 17 00:00:00 2001 From: Daniel Petry Date: Tue, 7 Jan 2025 15:44:59 -0600 Subject: [PATCH] Use N-1 cores --- recipe/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipe/build.sh b/recipe/build.sh index 0fe9d3a9..db0a7feb 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -118,7 +118,9 @@ if [[ "${CI}" == "github_actions" ]]; then # cirun-openstack-gpu-2xlarge, which has 32GB RAM, 8 CPUs export MAX_JOBS=4 else - export MAX_JOBS=${CPU_COUNT} + # Leave a spare core for other tasks. This may need to be reduced further + # if we get out of memory errors. + export MAX_JOBS=$((CPU_COUNT > 1 ? CPU_COUNT - 1 : 1)) fi if [[ "$blas_impl" == "generic" ]]; then