#! /bin/sh # # Usage: ./BV.sh [mpirun_args] [BV_args] [OMP_NUM_THREADS] # # Example: ./BV.sh "" "-r -d 8" mpirun_args="-n 4 -H vecr:8" #mpirun_args="-n 4 -H Node-001,Node-002,Node-003,Node-004" #mpirun_args="-n 4 -H Node-009,Node-010,Node-011,Node-012" BV_args="5"; BV="./BV" export OMP_NUM_THREADS=1 if [ -n "$1" ]; then mpirun_args="$1"; fi if [ -n "$2" ]; then BV_args="$2"; fi if [ -n "$3" ]; then OMP_NUM_THREADS="$3"; BV="./BV-omp" mpirun_args="$mpirun_args -x OMP_NUM_THREADS=$OMP_NUM_THREADS" fi export OMP_NUM_THREADS # man awk: # rand() Return a random number N, between 0 and 1, such that 0 <= N < 1. # srand([expr]) Use expr as the new seed for the random number generator. # If no expr is provided, use the time of day. # seed=$(awk 'BEGIN { srand(); print int(rand()*lshift(1,31)); }' < /dev/null) # default binding is to socket, which limits #cores used = #sockets # check using e.g. mpstat -P ALL 5 5 # see also --report-bindings # cmd="mpirun --bind-to none $mpirun_args $BV -s$seed $BV_args" echo "$cmd" eval "$cmd"