From 2beb3cfbc972156853c7584da9137cc4036e80af Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 23 Mar 2021 10:23:25 +0100 Subject: [PATCH] CONFIG: respect existing value for WM_NUMCOMPPROCS (#59) - avoids flooding a head-node during compilation. --- etc/tools/ThirdPartyFunctions | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/etc/tools/ThirdPartyFunctions b/etc/tools/ThirdPartyFunctions index 8cc3010..761a11c 100644 --- a/etc/tools/ThirdPartyFunctions +++ b/etc/tools/ThirdPartyFunctions @@ -6,7 +6,7 @@ # \\/ M anipulation | #------------------------------------------------------------------------------ # Copyright (C) 2011-2016 OpenFOAM Foundation -# Copyright (C) 2016-2020 OpenCFD Ltd. +# Copyright (C) 2016-2021 OpenCFD Ltd. #------------------------------------------------------------------------------ # License # This file is part of OpenFOAM, distributed under GPL-3.0-or-later. @@ -430,12 +430,15 @@ setBuildSuffix() # # Mostly building without wmake # - disable wmakeScheduler variables -# - use max number of cores for building +# - use max number of cores for building, unless already defined # unset WM_HOSTS WM_SCHEDULER -WM_NCOMPPROCS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) || WM_NCOMPPROCS=1 -: ${WM_NCOMPPROCS:=1} +if [ -z "$WM_NCOMPPROCS" ] +then + WM_NCOMPPROCS=$(getconf _NPROCESSORS_ONLN 2>/dev/null) + : "${WM_NCOMPPROCS:=1}" +fi export WM_NCOMPPROCS