bug fixes for LookUpServerThread.java
[IRC.git] / Robust / src / Benchmarks / Prefetch / ManualPrefetch / run.sh
1 #!/bin/sh 
2
3 #set -x
4 MACHINELIST='dc-1.calit2.uci.edu dc-2.calit2.uci.edu dc-3.calit2.uci.edu dc-4.calit2.uci.edu dc-5.calit2.uci.edu dc-6.calit2.uci.edu dc-7.calit2.uci.edu dc-8.calit2.uci.edu'
5 #benchmarks='40962dconv 1200mmver moldynverB'
6 benchmarks='1152fft2d 40962dconv 10lookup 1200mmver moldynverB rainforest'
7
8 LOGDIR=~/research/Robust/src/Benchmarks/Prefetch/ManualPrefetch/runlog
9 TOPDIR=`pwd`
10
11 function run {
12   i=0;
13   DIR=`pwd`
14   HOSTNAME=`hostname`
15   while [ $i -lt $1 ]; do
16     echo "$DIR" > ~/.tmpdir
17     echo "bin=$3" > ~/.tmpvars
18     ct=0
19     MACHINES=''
20     for j in $MACHINELIST; do
21       if [ $ct -lt $2 ]; then
22         if [ "$j" != "$HOSTNAME" ]; then
23           MACHINES="$MACHINES $j"
24         fi
25       fi
26       let ct=$ct+1
27     done
28
29     rm dstm.conf
30     DSTMDIR=${HOME}/research/Robust/src/Benchmarks/Prefetch/config
31     if [ $2 -eq 2 ]; then 
32       arg=$ARGS2
33       ln -s ${DSTMDIR}/dstm_2.conf dstm.conf
34     fi
35     if [ $2 -eq 3 ]; then 
36       arg=$ARGS3
37       ln -s ${DSTMDIR}/dstm_3.conf dstm.conf
38     fi
39     if [ $2 -eq 4 ]; then 
40       arg=$ARGS4
41       ln -s ${DSTMDIR}/dstm_4.conf dstm.conf
42     fi
43     if [ $2 -eq 5 ]; then 
44       arg=$ARGS5
45       ln -s ${DSTMDIR}/dstm_5.conf dstm.conf
46     fi
47     if [ $2 -eq 6 ]; then 
48       arg=$ARGS6
49       ln -s ${DSTMDIR}/dstm_6.conf dstm.conf
50     fi
51     if [ $2 -eq 7 ]; then 
52       arg=$ARGS7
53       ln -s ${DSTMDIR}/dstm_7.conf dstm.conf
54     fi
55     if [ $2 -eq 8 ]; then 
56       arg=$ARGS8
57       ln -s ${DSTMDIR}/dstm_8.conf dstm.conf
58     fi
59     chmod +x ~/.tmpvars
60     for machine in `echo $MACHINES`
61     do
62       ssh ${machine} 'cd `cat ~/.tmpdir`; source ~/.tmpvars; ./$bin' &
63       echo ""
64     done
65     sleep 2
66     echo ${3}
67 #   perl -x${TOPDIR} ${TOPDIR}/switch/fetch_stat.pl clear_stats settings=switch/clearsettings.txt
68     /usr/bin/time -f "%e" ./${3} master $arg 2> ${LOGDIR}/tmp
69 #   perl -x${TOPDIR} ${TOPDIR}/switch/fetch_stat.pl settings=switch/settings.txt
70     cat ${LOGDIR}/tmp >> ${LOGDIR}/${3}_${2}Thrd_${EXTENSION}.txt
71     if [ $i -eq 0 ];then echo "<h3> Benchmark=${3} Thread=${2} Extension=${EXTENSION}</h3><br>" > ${LOGDIR}/${3}_${EXTENSION}_${2}Thrd_a.html  ;fi
72     cat ${LOGDIR}/tmp >> ${LOGDIR}/${3}_${EXTENSION}_${2}Thrd_a.html
73 #    echo "<a href=\"${3}_${2}Thrd_${EXTENSION}_${i}.html\">Network Stats</a><br>" >> ${LOGDIR}/${3}_${EXTENSION}_${2}Thrd_a.html
74 #    mv ${TOPDIR}/html/dell.html ${LOGDIR}/${3}_${2}Thrd_${EXTENSION}_${i}.html
75     echo "Terminating ... "
76     for machine in `echo $MACHINES`
77     do
78       ssh ${machine} 'source ~/.tmpvars; killall $bin'
79     done
80     sleep 2
81     i=`expr $i + 1`
82   done
83 }
84
85 function callrun {
86   MANUAL_PREFETCH=${BENCHMARK}RangeN.bin
87   
88   cd $BMDIR 
89
90   for count in 2 4 6 8
91   do
92     echo "------- Running $count threads $BMDIR manual prefetch on $count machines -----"
93     run 1 $count ${MANUAL_PREFETCH}
94   done
95
96   cd $TOPDIR
97 }
98
99
100 echo "---------- Clean old files ---------- "
101 rm runlog/*
102 for b in `echo $benchmarks`
103 do
104   bm=`grep $b bm.txt`
105   BENCHMARK=`echo $bm | cut -f1 -d":"`
106   BMDIR=`echo $bm | cut -f2 -d":"`
107   ARGS1=`echo $bm | cut -f3 -d":"`
108   ARGS2=`echo $bm | cut -f4 -d":"`
109   ARGS3=`echo $bm | cut -f5 -d":"`
110   ARGS4=`echo $bm | cut -f6 -d":"`
111   ARGS5=`echo $bm | cut -f7 -d":"`
112   ARGS6=`echo $bm | cut -f8 -d":"`
113   ARGS7=`echo $bm | cut -f9 -d":"`
114   ARGS8=`echo $bm | cut -f10 -d":"`
115   EXTENSION=`echo $bm | cut -f11 -d":"`
116   callrun
117 done
118
119 #----------Calulates  the averages ----------- 
120 for file in `ls runlog/*.txt`
121 do
122   echo -n $file >> average.txt
123   cat $file | grep -v "^Command" | awk '{sum += $1} END {print " "sum/NR}' >> average.txt
124 done
125 echo "===========" >> average.txt
126 echo "" >> average.txt
127
128 echo "done"