Mercurial > hg > cc > cirrus_home
view bin/runme.sh @ 203:2aa9db279d56
--array + -m now working
| author | Henry S. Thompson <ht@inf.ed.ac.uk> |
|---|---|
| date | Wed, 22 Apr 2026 18:50:07 +0100 |
| parents | 491b6d11dd14 |
| children | 4ccd8ad84e82 |
line wrap: on
line source
#!/usr/bin/bash # 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 #SBATCH --qos=standard #SBATCH --account=ec276-hst #SBATCH --job-name runme export W=/work/dc007/dc007 if [ "$1" = "-m" ] then a=$SLURM_ARRAY_TASK_ID echo "Array id $a $SLURM_ARRAY_TASK_COUNT" > mtest$a.out 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 >> mtest$a.out echo $(date) Launching $a >> mtest$a.out srun -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh -a $a "$@" >> mtest$a.out echo $(date) Finished $a $? >> mtest$a.out exit 0 if [ "$exclude" ] then exclude+=",$SLURMD_NODENAME" else export exclude="--exclude=$SLURMD_NODENAME" fi echo $exclude >> mtest$a.out 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 srun --unbuffered -c $SLURM_CPUS_PER_TASK $W/shared/bin/sing $W/hst/bin/_runme.sh "$@" echo $(date) Finished fi
