Mercurial > hg > cc > cirrus_work
annotate bin/_ex1.sh @ 231:c48f859889da
merge
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Thu, 29 Feb 2024 15:01:10 +0000 |
parents | 668579197bec |
children |
rev | line source |
---|---|
2
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
1 #!/bin/bash |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
2 # This runs on the compute nodes... |
3
668579197bec
oops, 1.1 was half-modified, bogus
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
2
diff
changeset
|
3 # count http vs. https vs. english, chinese in parallel, taking input directly from /work/dc007/dc007/hst/results/$1/cdx_counts/xxx.tsv |
2
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
4 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
5 N=$SLURM_JOB_NUM_NODES |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
6 n=$SLURM_NTASKS |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
7 c=$SLURM_CPUS_PER_TASK |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
8 nodename=$SLURMD_NODENAME |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
9 local=$SLURM_LOCALID |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
10 node=$SLURM_NODEID |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
11 task=$SLURM_PROCID |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
12 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
13 threadsPerTask=2 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
14 pjobs=$((c / $threadsPerTask)) |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
15 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
16 cc=$1 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
17 resdir=$W/$USER/results/$cc/$2 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
18 srcdir=$W/hst/results/$cc/cdx_counts |
3
668579197bec
oops, 1.1 was half-modified, bogus
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
2
diff
changeset
|
19 s1=$3 |
668579197bec
oops, 1.1 was half-modified, bogus
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
2
diff
changeset
|
20 sn=$4 |
2
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
21 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
22 echo $(date) task $n.$task on $nodename:$N.$node start |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
23 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
24 mkdir -p $resdir |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
25 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
26 doit () { |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
27 echo $(date) start $1 $task $PARALLEL_SEQ |
3
668579197bec
oops, 1.1 was half-modified, bogus
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
2
diff
changeset
|
28 fgrep ' w ' $srcdir/$1.tsv | cut -f 3,4 | uniq -c | \ |
668579197bec
oops, 1.1 was half-modified, bogus
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
2
diff
changeset
|
29 $W/shared/bin/uniq_merge.py > $resdir/ex1_$1.tsv |
2
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
30 echo $(date) end $1 $task $PARALLEL_SEQ |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
31 } |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
32 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
33 export -f doit |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
34 export srcdir resdir task |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
35 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
36 seq $s1 $sn | while read i |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
37 do if [ $((i % $n)) -eq $task ] |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
38 then printf '%03g\n' $i |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
39 fi |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
40 done | \ |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
41 parallel -j $pjobs doit '{}' |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
42 |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
43 echo $(date) task $n.$task on $nodename:$N.$node end |
b4801f5696b2
compute node workers, see cirrus_home/bin repo for login node masters
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff
changeset
|
44 |