From: Arnaud Giersch Date: Thu, 31 Oct 2013 08:22:38 +0000 (+0100) Subject: Fix computation of NUMBER_OF_PROCESSORS. X-Git-Tag: v3_10_rc1~34 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b29c32a336eacac8bf67b34f5ff703b64dbf4285?ds=sidebyside Fix computation of NUMBER_OF_PROCESSORS. --- diff --git a/buildtools/jenkins/run.sh b/buildtools/jenkins/run.sh index deceff5d36..287c1440e1 100755 --- a/buildtools/jenkins/run.sh +++ b/buildtools/jenkins/run.sh @@ -13,13 +13,13 @@ export PATH=./lib/:../../lib:$PATH if test "$(uname -o)" = "Msys" then - - cmake -G "MSYS Makefiles" $WORKSPACE #$NUMBER_OF_PROCESSORS should be already set on win if [ -z "$NUMBER_OF_PROCESSORS" ]; then NUMBER_OF_PROCESSORS=1 fi + cmake -G "MSYS Makefiles" $WORKSPACE + if [ $? -ne 0 ] ; then echo "Failed to do the first cmake - Halting" exit 1 @@ -54,16 +54,11 @@ then fi else - NUMBER_OF_PROCESSORS=0 # Linux: cpuinfo_file="/proc/cpuinfo" - if [ -f "${cpuinfo_file}" ]; then - NUMBER_OF_PROCESSORS=$(grep -c "processor.: " ${cpuinfo_file}) - fi - # grep returns 0 or cpuinfo not found - if [ $NUMBER_OF_PROCESSORS = 0 ]; then - NUMBER_OF_PROCESSORS=1 - fi + NUMBER_OF_PROCESSORS=$(lscpu -p 2>/dev/null | grep -c '^[^#]') || \ + NUMBER_OF_PROCESSORS=$(grep -c "^processor[[:space:]]*:" ${cpuinfo_file} 2>/dev/null) + [ "0$NUMBER_OF_PROCESSORS" -gt 0 ] || NUMBER_OF_PROCESSORS=1 cmake $WORKSPACE