changeset 68:235004978b22

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:37:47 +0100
parents b8d4a5ede7a3
children 0d2701901fed
files bin/_runme.sh
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bin/_runme.sh	Thu Jul 20 10:32:55 2023 +0100
+++ b/bin/_runme.sh	Fri Jul 21 11:37:47 2023 +0100
@@ -1,6 +1,6 @@
 #!/bin/bash
 # This runs on the compute nodes...
-# Args: wd [-d] [-t nthreads] [-b CMDS] [-i input] CMDS
+# Args: [-a i] wd [-d] [-t nthreads] [-b CMDS] [-i input] CMDS
 # See ug4/azure/notes.txt for documentation
 
 N=$SLURM_JOB_NUM_NODES
@@ -11,6 +11,15 @@
 node=$SLURM_NODEID
 task=$SLURM_PROCID
 
+if [ "$1" = "-a" ]
+then
+ shift
+ xarg="$1"
+ shift
+else
+ xarg=
+fi
+ 
 cd "$1"
 shift
 
@@ -34,7 +43,7 @@
 echo $(date) task $n.$task on $nodename:$N.$node start $pjobs jobs 1>&2
 
 PATH=$W/$USER/bin:$W/shared/bin:$PATH
-export task PATH n
+export task PATH n xarg
 
 if [ "$1" = "-b" ]
 then
@@ -43,6 +52,8 @@
   shift
 fi
 
+input="seq 1 $pjobs" # default to make sure something runs
+
 if [ "$1" = "-i" ]
 then
  shift
@@ -59,7 +70,7 @@
 
 doit () {
  arg="$1"
- echo $(date) start $task $PARALLEL_SEQ "|$cmd|$arg|"
+ echo $(date) start $task $PARALLEL_SEQ "|$cmd|$xarg|$arg|"
  eval "$cmd"
  echo $(date) end $task $PARALLEL_SEQ
 }