[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 7dbb1f0 1/4: Determine number of cores dynami
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 7dbb1f0 1/4: Determine number of cores dynamically |
Date: |
Tue, 24 Sep 2019 20:00:10 -0400 (EDT) |
branch: master
commit 7dbb1f08c18858db00ee6d385189d26fe01ebd31
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Determine number of cores dynamically
---
gwc/.zshrc | 5 ++++-
install_msw.sh | 27 +++++++++++++--------------
install_wx.sh | 2 +-
install_wxpdfdoc.sh | 2 +-
4 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/gwc/.zshrc b/gwc/.zshrc
index afe8af7..13590f1 100644
--- a/gwc/.zshrc
+++ b/gwc/.zshrc
@@ -15,7 +15,10 @@ export PATH="$MINIMAL_PATH"
# and replace :0.0 below with the string it returns:
export DISPLAY=":0.0"
-export coefficiency='--jobs=32'
+# Something like
+# "--jobs=$(nproc || sysctl -n hw.ncpu || getconf _NPROCESSORS_ONLN)"
+# could be used instead for other *nix systems:
+export coefficiency="--jobs=$(nproc)"
# export TZ=UCT
export LANG=en_US.UTF-8 LC_ALL=C.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE=C.UTF-8
diff --git a/install_msw.sh b/install_msw.sh
index a5f3183..ca56c5f 100755
--- a/install_msw.sh
+++ b/install_msw.sh
@@ -49,13 +49,12 @@ esac
export PATH="$minimal_path"
-# '--jobs=4': big benefit for multicore, no penalty for single core
-# (but don't force it to 4 if it's already set).
-# '--output-sync=recurse' is also used, passim, to facilitate log
-# comparison.
+# '--jobs=': big benefit for multicore (but can be overridden).
+# '--output-sync=recurse' is used passim to facilitate log comparison.
if [ -z "$coefficiency" ]
then
- export coefficiency='--jobs=4'
+ coefficiency="--jobs=$(nproc)"
+ export coefficiency
fi
case "$lmi_build_type" in
@@ -236,8 +235,8 @@ mount
md5sum "$0"
find /cache_for_lmi/downloads -type f -print0 | xargs -0 md5sum
-make $coefficiency --output-sync=recurse -f install_miscellanea.make clobber
-make $coefficiency --output-sync=recurse -f install_miscellanea.make
+make "$coefficiency" --output-sync=recurse -f install_miscellanea.make clobber
+make "$coefficiency" --output-sync=recurse -f install_miscellanea.make
# This for-loop can iterate over as many toolchains as desired.
# Make sure the current production architecture is built last, so that
@@ -258,14 +257,14 @@ do
mingw_dir=/opt/lmi/${LMI_COMPILER}_${LMI_TRIPLET}/gcc_msw
[ -d "$mingw_dir" ] && rm --force --recursive "$mingw_dir"
if [ "i686-w64-mingw32" = "$LMI_TRIPLET" ]; then
- make $coefficiency --output-sync=recurse -f install_mingw32.make
+ make "$coefficiency" --output-sync=recurse -f install_mingw32.make
elif [ "x86_64-w64-mingw32" = "$LMI_TRIPLET" ]; then
- make $coefficiency --output-sync=recurse -f install_mingw.make
+ make "$coefficiency" --output-sync=recurse -f install_mingw.make
else
printf 'No MinGW compiler for this triplet.\n'
fi
- make $coefficiency --output-sync=recurse -f install_libxml2_libxslt.make
+ make "$coefficiency" --output-sync=recurse -f install_libxml2_libxslt.make
./install_wx.sh
./install_wxpdfdoc.sh
@@ -275,10 +274,10 @@ do
# Source this script only for commands that depend upon it.
. ./set_toolchain.sh
- make $coefficiency --output-sync=recurse wx_config_check
- make $coefficiency --output-sync=recurse show_flags
- make $coefficiency --output-sync=recurse clean
- make $coefficiency --output-sync=recurse install
+ make "$coefficiency" --output-sync=recurse wx_config_check
+ make "$coefficiency" --output-sync=recurse show_flags
+ make "$coefficiency" --output-sync=recurse clean
+ make "$coefficiency" --output-sync=recurse install
if [ "Cygwin" = "$platform" ]
then
diff --git a/install_wx.sh b/install_wx.sh
index 100505f..3f59c6f 100755
--- a/install_wx.sh
+++ b/install_wx.sh
@@ -37,7 +37,7 @@
wx_commit_sha=${wx_commit_sha:-"f741031e69de73d5816cc56e99c9beba3ac820de"}
wx_skip_clean=${wx_skip_clean:-"0"}
-coefficiency=${coefficiency:-"--jobs=4"}
+coefficiency=${coefficiency:-"--jobs=$(nproc)"}
MAKE=${MAKE:-"make $coefficiency"}
diff --git a/install_wxpdfdoc.sh b/install_wxpdfdoc.sh
index 2b2209d..fc3b2e6 100755
--- a/install_wxpdfdoc.sh
+++ b/install_wxpdfdoc.sh
@@ -37,7 +37,7 @@
wxpdfdoc_commit_sha=${wxpdfdoc_commit_sha:-"55366f01eed8549ca704f9d9825127868858
wxpdfdoc_skip_clean=${wxpdfdoc_skip_clean:-"0"}
-coefficiency=${coefficiency:-"--jobs=4"}
+coefficiency=${coefficiency:-"--jobs=$(nproc)"}
MAKE=${MAKE:-"make $coefficiency"}