diff --git a/bin/run.sh b/bin/run.sh index 0de7005be7d596a215882cd675b4e6f2d1a60b48..8dd6c5e9180dc2180f8828a5f3c119186484b912 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -26,28 +26,62 @@ # script runs distaix with binary # in the current folder and props in the props folder in the project root # -# Its possible to specify how many processes should be +# Its possible to specify how many processes should be # used with the -n [COUNT] option # -# Default count of processes are 4, specified by the +# Default count of processes are 4, specified by the # PROCESS_N variable under this paragraph. PROCESS_N=4 - +PROPERTY_FILE="../props/model.props" +CONFIG_FILE="../props/config.props" cd "${0%/*}" -while getopts n: opt +while getopts n:c:p:d: opt do case $opt in - n) PROCESS_N=$OPTARG + n) PROCESS_N=$OPTARG;; + c) CONFIG_FILE=$OPTARG;; + p) PROPERTY_FILE=$OPTARG;; + d) PROPERTY_DIRECTORY=$OPTARG esac done -pwd +pwd + +if [ -z ${PROPERTY_DIRECTORY+x} ]; then + + # No directory was specified, run single simulation for PROPERTY_FILE + + echo "################### START #######################" + start_time=`date +%s%N` + mpiexec -n $PROCESS_N ./distaix $CONFIG_FILE $PROPERTY_FILE 2> error + end_time=`date +%s%N` + echo "execution time was `expr $end_time - $start_time` ns." + echo "######################## END ########################" +else + # Directory including multiple property files was specified by PROPERTY_DIRECTORY, + # run simulations for all of them + + echo "###### Start simulation of Series ######" + echo "## Properties Directory: $PROPERTY_DIRECTORY " + echo "## Identified following property files..." + + for prop_file in "$PROPERTY_DIRECTORY"/* + do + echo "## - $prop_file" + done + + sleep 5 + + for PROP_FILE in "$PROPERTY_DIRECTORY"/* + do + echo "################### START #######################" + start_time=`date +%s%N` + mpiexec -n $PROCESS_N ./distaix $CONFIG_FILE $PROP_FILE 2> error + end_time=`date +%s%N` + echo "execution time was `expr $end_time - $start_time` ns." + echo "######################## END ########################" + done -echo "################### START #######################" -start_time=`date +%s%N` -mpiexec -n $PROCESS_N ./distaix ../props/config.props ../props/model.props 2> error -end_time=`date +%s%N` -echo execution time was `expr $end_time - $start_time` ns. -echo "######################## END ########################" +fi