Mercurial > hg > cc > cirrus_home
changeset 181:55169996c3bf
add support for multiple calls to srun with a counter
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Fri, 21 Jul 2023 11:38:20 +0100 |
parents | 4cb5cc893003 |
children | dfb88dee52b8 |
files | bin/runme.sh |
diffstat | 1 files changed, 17 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/runme.sh Wed Jul 05 15:08:59 2023 +0100 +++ b/bin/runme.sh Fri Jul 21 11:38:20 2023 +0100 @@ -1,6 +1,7 @@ #!/usr/bin/bash -# Invoke this as e.g. sbatch --ntasks=10 -c 20 runme.sh [args for work/bin/_runme.sh] +# Invoke this as e.g. sbatch --ntasks=10 -c 20 runme.sh [-m first last] [args for work/bin/_runme.sh] # It will run on the login node +# -m i j will launch _runme.sh multiple times with a -a in {first..last} #SBATCH --time=01:00:00 #SBATCH --partition=standard @@ -10,6 +11,19 @@ export W=/work/dc007/dc007 -echo $(date) Launching $SLURM_JOB_NUM_NODES nodes in $(pwd) for runme "$@" from $(hostname) to do $SLURM_NTASKS tasks, $SLURM_CPUS_PER_TASK cpus each 1>&2 +if [ "$1" = "-m" ] +then + ss={$2..$3} + shift; shift; shift; + echo $(date) Launching $SLURM_JOB_NUM_NODES nodes in $(pwd) for runme -a $ss "$@" from $(hostname) to do $SLURM_NTASKS tasks, $SLURM_CPUS_PER_TASK cpus each 1>&2 + for i in $(eval echo $ss) + do + srun --unbuffered -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh -a $i "$@" + echo $(date) Finished $i + done +else + echo $(date) Launching $SLURM_JOB_NUM_NODES nodes in $(pwd) for runme "$@" from $(hostname) to do $SLURM_NTASKS tasks, $SLURM_CPUS_PER_TASK cpus each 1>&2 -srun --unbuffered -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh "$@" + srun --unbuffered -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh "$@" + echo $(date) Finished +fi