diff --git a/samples/mpi_reduce_bench/mpibench.sh b/samples/mpi_reduce_bench/mpibench.sh index 6517bf7..4e9eae3 100755 --- a/samples/mpi_reduce_bench/mpibench.sh +++ b/samples/mpi_reduce_bench/mpibench.sh @@ -11,47 +11,45 @@ script_name=$0 print_usage(){ echo "Usage: $script_name [Options]" - echo "\tRuns mpi_reduce_bench, which will write benchmark results" + echo " Runs ./mpi_reduce_bench, which will write benchmark results to a csv file" + echo " Remember to run this script from your build directory" + echo " The benchmarks are submitted with sbatch, unless the -i option is passed" echo "Options:" - echo "\t -n " - echo "\t\t-n option to slurm, default=$default_num_procs" - echo "\t -N " - echo "\t\t-N option to slurm, default=$default_num_nodes" - echo "\t -t " - echo "\t\tA benchmark tag that will be added to the mpi_reduction_benchmark.csv file" - echo "\t\tBy default the current git HEAD short hash will be used as a tag" + echo " -n " + echo " number of tasks for slurm, default=$default_num_procs" + echo " -N " + echo " number of nodes for slurm, default=$default_num_nodes" + echo " -t " + echo " A benchmark tag that will be added to the mpi_reduction_benchmark.csv file" + echo " By default the current git HEAD short hash will be used as a tag" + echo " -i" + echo " Run the benchmark interactively with srun instead of sbatch" + echo " -h" + echo " Print this message" } -while getopts n:N:t: opt +while getopts :n:N:t:ih opt do case "$opt" in n) - if [ $OPTARG ] - then - num_procs=$OPTARG - else - print_usage - exit 1 - fi + num_procs=$OPTARG ;; N) - if [ $OPTARG ] - then - num_nodes=$OPTARG - else - print_usage - exit 1 - fi + num_nodes=$OPTARG ;; t) - if [ $OPTARG ] - then - benchmark_label=$OPTARG - else - print_usage - exit 1 - fi + benchmark_label=$OPTARG ;; + i) + interactively=1 + ;; + h) + print_usage + exit 0 + ;; + ?) + print_usage + exit 1 esac done @@ -60,4 +58,21 @@ then benchmark_label=$(git rev-parse --short HEAD) fi set -x -srun --account=project_2000403 --gres=gpu:v100:4 --mem=48000 -t 00:14:59 -p gpu -n ${num_procs} -N ${num_nodes} ./mpi_reduce_bench ${benchmark_label} + +if [ -z "$interactively"] +then +sbatch <