#!/bin/bash #defaults default_num_procs=8 default_num_nodes=2 num_procs=$default_num_procs num_nodes=$default_num_nodes script_name=$0 print_usage(){ echo "Usage: $script_name [Options]" 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 " -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:ih opt do case "$opt" in n) num_procs=$OPTARG ;; N) num_nodes=$OPTARG ;; t) benchmark_label=$OPTARG ;; i) interactively=1 ;; h) print_usage exit 0 ;; ?) print_usage exit 1 esac done if [ -z "$benchmark_label" ] then benchmark_label=$(git rev-parse --short HEAD) fi set -x if [ -z "$interactively"] then sbatch <