Mercurial > repos > alvarofaure > bitlab
comparison chromeister/bin/recompute_scores.sh @ 0:7fdf47a0bae8 draft
Uploaded
author | alvarofaure |
---|---|
date | Wed, 12 Dec 2018 07:18:40 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7fdf47a0bae8 |
---|---|
1 #!/usr/bin/env bash | |
2 | |
3 if [ $# -ne 1 ]; then | |
4 echo " ==== ERROR ... you called this script inappropriately." | |
5 echo "" | |
6 echo " usage: $0 <#threads>" | |
7 echo "" | |
8 exit -1 | |
9 fi | |
10 | |
11 BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
12 THREADS=$1 | |
13 | |
14 | |
15 for p in */; | |
16 do | |
17 | |
18 echo "Entering $p" | |
19 cd $p | |
20 | |
21 | |
22 | |
23 thepaths=() | |
24 n=0 | |
25 # Grab the routes | |
26 for i in *.mat ; | |
27 do | |
28 | |
29 thepaths[$n]=$i | |
30 n=`expr $n + 1` | |
31 | |
32 done | |
33 | |
34 i=0 | |
35 aux=0 | |
36 for ((i=0; i < $n ; i+=$THREADS)) | |
37 do | |
38 aux=$i | |
39 for ((j=0; j<$THREADS; j++)) | |
40 do | |
41 if [ "$aux" -lt "$n" ]; then | |
42 echo "Recomputing ${thepaths[$aux]}" | |
43 goodpath=${thepaths[$aux]%.mat} | |
44 Rscript $BINDIR/compute_score.R ${thepaths[$aux]} > ${goodpath}.scr.txt & | |
45 aux=`expr $aux + 1` | |
46 fi | |
47 done | |
48 | |
49 for job in `jobs -p` | |
50 do | |
51 #echo $job | |
52 wait $job | |
53 done | |
54 | |
55 done | |
56 | |
57 | |
58 echo "Exiting $p" | |
59 cd .. | |
60 | |
61 | |
62 done | |
63 | |
64 |