From ab061a59937f0d19ba59945d4c3f7b910fc9e797 Mon Sep 17 00:00:00 2001 From: "Kelly (KT) Thompson" Date: Mon, 10 Jul 2017 09:17:51 -0600 Subject: [PATCH] Clean up the release scripts: + Replace the local variable cdir with a more descriptive name and eliminate the use of sdir. + Update the function npes_test so that it uses the command lscpu (if available). This helps us detect if hyperthreading being enabled so as to avoid oversubscribing physical cores when running tests. --- regression/scripts/common.sh | 40 ++++++++++++++++++---------- regression/scripts/release_bgq.sh | 7 +++-- regression/scripts/release_cray.sh | 16 +++++------ regression/scripts/release_darwin.sh | 7 +++-- regression/scripts/release_toss2.sh | 9 +++---- 5 files changed, 43 insertions(+), 36 deletions(-) diff --git a/regression/scripts/common.sh b/regression/scripts/common.sh index d842432519..3f9b1471e2 100755 --- a/regression/scripts/common.sh +++ b/regression/scripts/common.sh @@ -295,20 +295,32 @@ function npes_build function npes_test { local np=1 - if [[ ${PBS_NP} ]]; then - np=${PBS_NP} - elif [[ ${SLURM_NPROCS} ]]; then - np=${SLURM_NPROCS} - elif [[ ${SLURM_CPUS_ON_NODE} ]]; then - np=${SLURM_CPUS_ON_NODE} - elif [[ ${SLURM_TASKS_PER_NODE} ]]; then - np=${SLURM_TSKS_PER_NODE} - elif [[ `uname -p` == "ppc" ]]; then - # sinfo --long --partition=pdebug (show limits) - np=64 - elif [[ -f /proc/cpuinfo ]]; then - # lscpu=`lscpu | grep "CPU(s):" | head -n 1 | awk '{ print $2 }'` - np=`cat /proc/cpuinfo | grep -c processor` + # use lscpu if it is available. + if ! [[ `which lscpu 2>/dev/null` == 0 ]]; then + # number of cores per socket + local cps=`lscpu | grep "^Core(s)" | awk '{ print $4 }'` + # number of sockets + local ns=`lscpu | grep "^Socket(s):" | awk '{ print $2 }'` + np=`expr $cps \* $ns` + + else + + if [[ ${PBS_NP} ]]; then + np=${PBS_NP} + elif [[ ${SLURM_NPROCS} ]]; then + np=${SLURM_NPROCS} + elif [[ ${SLURM_CPUS_ON_NODE} ]]; then + np=${SLURM_CPUS_ON_NODE} + elif [[ ${SLURM_TASKS_PER_NODE} ]]; then + np=${SLURM_TSKS_PER_NODE} + elif [[ `uname -p` == "ppc" ]]; then + # sinfo --long --partition=pdebug (show limits) + np=64 + elif [[ -f /proc/cpuinfo ]]; then + # lscpu=`lscpu | grep "CPU(s):" | head -n 1 | awk '{ print $2 }'` + np=`cat /proc/cpuinfo | grep -c processor` + fi + fi echo $np } diff --git a/regression/scripts/release_bgq.sh b/regression/scripts/release_bgq.sh index 0fb5748622..d8b9a08be1 100755 --- a/regression/scripts/release_bgq.sh +++ b/regression/scripts/release_bgq.sh @@ -66,12 +66,11 @@ function xlc12() ##---------------------------------------------------------------------------## ## Generic setup (do not edit) ##---------------------------------------------------------------------------## -sdir=`dirname $0` -cdir=`pwd` -cd $sdir +initial_working_dir=`pwd` +cd `dirname $0` export script_dir=`pwd` export draco_script_dir=$script_dir -cd $cdir +cd $initial_working_dir source $draco_script_dir/common.sh # CMake options that will be included in the configuration step diff --git a/regression/scripts/release_cray.sh b/regression/scripts/release_cray.sh index 3dadcad4d2..16e9b543e3 100755 --- a/regression/scripts/release_cray.sh +++ b/regression/scripts/release_cray.sh @@ -18,8 +18,7 @@ ## 1. Set modulefiles to be loaded in named environment functions. ## 2. Update variables that control the build: ## - $ddir -## - $CONFIG_BASE -## 3. Run this script: ./release_ml &> ../logs/relase_moonlight.log +## 3. Run this script: scripts/release_cray.sh &> logs/relase-trinitite.log #----------------------------------------------------------------------# # Per release settings go here: @@ -96,12 +95,11 @@ export TARGET=knl ##---------------------------------------------------------------------------## ## Generic setup ##---------------------------------------------------------------------------## -sdir=`dirname $0` -cdir=`pwd` -cd $sdir +initial_working_dir=`pwd` +cd `dirname $0` export script_dir=`pwd` export draco_script_dir=$script_dir -cd $cdir +cd $initial_working_dir source $draco_script_dir/common.sh # CMake options that will be included in the configuration step @@ -121,9 +119,9 @@ ppn=`lookupppn` # be passed to the subshell (bash bug) # ============================================================================= -OPTIMIZE_ON="-DCMAKE_BUILD_TYPE=Release -DDRACO_LIBRARY_TYPE=STATIC" -OPTIMIZE_OFF="-DCMAKE_BUILD_TYPE=Debug -DDRACO_LIBRARY_TYPE=STATIC" -OPTIMIZE_RWDI="-DCMAKE_BUILD_TYPE=RELWITHDEBINFO -DDRACO_LIBRARY_TYPE=STATIC -DDRACO_DBC_LEVEL=15" +OPTIMIZE_ON="-DCMAKE_BUILD_TYPE=Release -DDRACO_LIBRARY_TYPE=SHARED" +OPTIMIZE_OFF="-DCMAKE_BUILD_TYPE=Debug -DDRACO_LIBRARY_TYPE=SHARED" +OPTIMIZE_RWDI="-DCMAKE_BUILD_TYPE=RELWITHDEBINFO -DDRACO_LIBRARY_TYPE=SHARED -DDRACO_DBC_LEVEL=15" LOGGING_ON="-DDRACO_DIAGNOSTICS=7 -DDRACO_TIMING=1" LOGGING_OFF="-DDRACO_DIAGNOSTICS=0 -DDRACO_TIMING=0" diff --git a/regression/scripts/release_darwin.sh b/regression/scripts/release_darwin.sh index 4344b4c9bf..17d677bad1 100755 --- a/regression/scripts/release_darwin.sh +++ b/regression/scripts/release_darwin.sh @@ -64,12 +64,11 @@ function intel15env() ##---------------------------------------------------------------------------## ## Generic setup (do not edit) ##---------------------------------------------------------------------------## -sdir=`dirname $0` -cdir=`pwd` -cd $sdir +initial_working_dir=`pwd` +cd `dirname $0` export script_dir=`pwd` export draco_script_dir=$script_dir -cd $cdir +cd $initial_working_dir source $draco_script_dir/common.sh # sets umask 0002 diff --git a/regression/scripts/release_toss2.sh b/regression/scripts/release_toss2.sh index 704e63f651..cf44e776ca 100755 --- a/regression/scripts/release_toss2.sh +++ b/regression/scripts/release_toss2.sh @@ -18,7 +18,7 @@ ## 1. Set modulefiles to be loaded in named environment functions. ## 2. Update variables that control the build: ## - $ddir -## 3. Run this script: ./release_ml &> ../logs/relase_moonlight.log +## 3. Run this script: ./release_toss2.sh &> ../logs/relase_moonlight.log #----------------------------------------------------------------------# # Per release settings go here (edits go here) @@ -62,12 +62,11 @@ function gcc610env() ##---------------------------------------------------------------------------## ## Generic setup (do not edit) ##---------------------------------------------------------------------------## -sdir=`dirname $0` -cdir=`pwd` -cd $sdir +initial_working_dir=`pwd` +cd $`dirname $0` export script_dir=`pwd` export draco_script_dir=$script_dir -cd $cdir +cd $initial_working_dir source $draco_script_dir/common.sh # CMake options that will be included in the configuration step