Mercurial > hg > cc > cirrus_home
comparison bin/runme.sh @ 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 | e1bc9d8d688c |
children |
comparison
equal
deleted
inserted
replaced
180:4cb5cc893003 | 181:55169996c3bf |
---|---|
1 #!/usr/bin/bash | 1 #!/usr/bin/bash |
2 # Invoke this as e.g. sbatch --ntasks=10 -c 20 runme.sh [args for work/bin/_runme.sh] | 2 # Invoke this as e.g. sbatch --ntasks=10 -c 20 runme.sh [-m first last] [args for work/bin/_runme.sh] |
3 # It will run on the login node | 3 # It will run on the login node |
4 # -m i j will launch _runme.sh multiple times with a -a in {first..last} | |
4 | 5 |
5 #SBATCH --time=01:00:00 | 6 #SBATCH --time=01:00:00 |
6 #SBATCH --partition=standard | 7 #SBATCH --partition=standard |
7 #SBATCH --qos=standard | 8 #SBATCH --qos=standard |
8 #SBATCH --account=ec184-hst | 9 #SBATCH --account=ec184-hst |
9 #SBATCH --job-name runme | 10 #SBATCH --job-name runme |
10 | 11 |
11 export W=/work/dc007/dc007 | 12 export W=/work/dc007/dc007 |
12 | 13 |
13 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 | 14 if [ "$1" = "-m" ] |
15 then | |
16 ss={$2..$3} | |
17 shift; shift; shift; | |
18 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 | |
19 for i in $(eval echo $ss) | |
20 do | |
21 srun --unbuffered -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh -a $i "$@" | |
22 echo $(date) Finished $i | |
23 done | |
24 else | |
25 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 | |
14 | 26 |
15 srun --unbuffered -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh "$@" | 27 srun --unbuffered -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh "$@" |
28 echo $(date) Finished | |
29 fi |