Mercurial > hg > cc > cirrus_work
comparison bin/_runme.sh @ 2:b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Mon, 18 Jul 2022 19:22:42 +0100 |
parents | |
children | e3c440666f1a |
comparison
equal
deleted
inserted
replaced
1:d5b6748f29a9 | 2:b4801f5696b2 |
---|---|
1 #!/bin/bash | |
2 # This runs on the compute nodes... | |
3 # Args: wd [-b CMDS] [-i input] CMDS | |
4 | |
5 N=$SLURM_JOB_NUM_NODES | |
6 n=$SLURM_NTASKS | |
7 c=$SLURM_CPUS_PER_TASK | |
8 nodename=$SLURMD_NODENAME | |
9 local=$SLURM_LOCALID | |
10 node=$SLURM_NODEID | |
11 task=$SLURM_PROCID | |
12 | |
13 cd "$1" | |
14 shift | |
15 | |
16 threadsPerTask=2 | |
17 pjobs=$((c / $threadsPerTask)) | |
18 | |
19 echo $(date) task $n.$task on $nodename:$N.$node start $(pwd) 1>&2 | |
20 | |
21 PATH=$W/$USER/bin:$W/shared/bin:$PATH | |
22 export task PATH n | |
23 | |
24 if [ "$1" = "-b" ] | |
25 then | |
26 shift | |
27 eval "$1" | |
28 shift | |
29 fi | |
30 | |
31 if [ "$1" = "-i" ] | |
32 then | |
33 shift | |
34 input="$1" | |
35 shift | |
36 fi | |
37 | |
38 export cmd="$1" | |
39 shift | |
40 | |
41 doit () { | |
42 arg="$1" | |
43 echo $(date) start $task $PARALLEL_SEQ $arg | |
44 eval "$cmd" | |
45 echo $(date) end $task $PARALLEL_SEQ | |
46 } | |
47 | |
48 export -f doit | |
49 | |
50 eval "$input" | \ | |
51 parallel -j $pjobs doit '{}' | |
52 | |
53 echo $(date) task $n.$task on $nodename:$N.$node end 1>&2 | |
54 |