From e3dc4a22f7ec0ed0da7fa349b1b0b2b3058af5aa Mon Sep 17 00:00:00 2001 From: Daniel Markstedt Date: Sat, 7 Oct 2023 10:33:57 +0000 Subject: [PATCH] Default compiler threads based on available RAM, but no more or less than available cores --- easyinstall.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/easyinstall.sh b/easyinstall.sh index 2f7f2cd404..28da5f8ac3 100755 --- a/easyinstall.sh +++ b/easyinstall.sh @@ -49,7 +49,13 @@ echo -e $logo CONNECT_TYPE="FULLSPEC" # clang v11 is the latest distributed by Buster COMPILER="clang++-11" -CORES=1 +MEM=$(grep MemTotal /proc/meminfo | awk '{print $2}') +CORES=`expr $MEM / 450000` +if [ $CORES -gt $(nproc) ]; then + CORES=$(nproc) +elif [ $CORES -lt 1 ]; then + CORES=1 +fi USER=$(whoami) BASE=$(dirname "$(readlink -f "${0}")") CPP_PATH="$BASE/cpp"