Mercurial > repos > alvarofaure > bitlab
diff chromeister/bin/recompute_scores.sh @ 0:7fdf47a0bae8 draft
Uploaded
author | alvarofaure |
---|---|
date | Wed, 12 Dec 2018 07:18:40 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/chromeister/bin/recompute_scores.sh Wed Dec 12 07:18:40 2018 -0500 @@ -0,0 +1,64 @@ +#!/usr/bin/env bash + +if [ $# -ne 1 ]; then + echo " ==== ERROR ... you called this script inappropriately." + echo "" + echo " usage: $0 <#threads>" + echo "" + exit -1 +fi + +BINDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +THREADS=$1 + + +for p in */; +do + + echo "Entering $p" + cd $p + + + + thepaths=() + n=0 + # Grab the routes + for i in *.mat ; + do + + thepaths[$n]=$i + n=`expr $n + 1` + + done + + i=0 + aux=0 + for ((i=0; i < $n ; i+=$THREADS)) + do + aux=$i + for ((j=0; j<$THREADS; j++)) + do + if [ "$aux" -lt "$n" ]; then + echo "Recomputing ${thepaths[$aux]}" + goodpath=${thepaths[$aux]%.mat} + Rscript $BINDIR/compute_score.R ${thepaths[$aux]} > ${goodpath}.scr.txt & + aux=`expr $aux + 1` + fi + done + + for job in `jobs -p` + do + #echo $job + wait $job + done + + done + + + echo "Exiting $p" + cd .. + + +done + +