Skip to content

Commit

Permalink
Clean up the release scripts:
Browse files Browse the repository at this point in the history
+ 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.
  • Loading branch information
KineticTheory committed Jul 10, 2017
1 parent c7cea8c commit ab061a5
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 36 deletions.
40 changes: 26 additions & 14 deletions regression/scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 3 additions & 4 deletions regression/scripts/release_bgq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 7 additions & 9 deletions regression/scripts/release_cray.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand Down
7 changes: 3 additions & 4 deletions regression/scripts/release_darwin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions regression/scripts/release_toss2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ab061a5

Please sign in to comment.