[commit: ghc] master: validate: add simple CPU count autodetection (f328890)
git at git.haskell.org
git at git.haskell.org
Tue Aug 19 13:55:46 UTC 2014
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/f328890021253c426b7450b6c5a1061d25f6219b/ghc
>---------------------------------------------------------------
commit f328890021253c426b7450b6c5a1061d25f6219b
Author: Sergei Trofimovich <slyfox at gentoo.org>
Date: Tue Aug 19 16:54:13 2014 +0300
validate: add simple CPU count autodetection
Summary: Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
Test Plan: ran ./validate on linux
Reviewers: austin
Reviewed By: austin
Subscribers: phaskell, simonmar, relrod, ezyang, carter
Differential Revision: https://phabricator.haskell.org/D146
>---------------------------------------------------------------
f328890021253c426b7450b6c5a1061d25f6219b
validate | 32 +++++++++++++++++++++++++++-----
1 file changed, 27 insertions(+), 5 deletions(-)
diff --git a/validate b/validate
index 7a7b125..8ea9eac 100755
--- a/validate
+++ b/validate
@@ -88,6 +88,32 @@ check_packages () {
echo "== End $1 package check"
}
+detect_cpu_count () {
+ if [ "$CPUS" = "" ]; then
+ # Windows standard environment variable
+ CPUS="$NUMBER_OF_PROCESSORS"
+ fi
+
+ if [ "$CPUS" = "" ]; then
+ # Linux
+ CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null`
+ fi
+
+ if [ "$CPUS" = "" ]; then
+ # FreeBSD
+ CPUS=`getconf NPROCESSORS_ONLN 2>/dev/null`
+ fi
+
+ if [ "$CPUS" = "" ]; then
+ # nothing helped
+ CPUS="1"
+ fi
+
+ echo "using ${CPUS} CPUs" >&2
+}
+
+detect_cpu_count
+
if ! [ -d testsuite ]
then
echo 'Could not find the testsuite for validation' >&2
@@ -95,11 +121,7 @@ then
fi
if [ "$THREADS" = "" ]; then
- if [ "$CPUS" = "" ]; then
- threads=2
- else
- threads=$(($CPUS + 1)) # `expr $CPUS + 1`
- fi
+ threads=$(($CPUS + 1)) # `expr $CPUS + 1`
else
threads="$THREADS"
fi
More information about the ghc-commits
mailing list