5 # ./runjava.sh <num_machine>
11 RECOVERYDIR='recovery'
15 LOGDIR=~/research/Robust/src/Benchmarks/Recovery/runlog
16 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'
20 # 1~8 machine id to be killed
27 # killClients <fileName> <# of machines>
28 function killclients {
31 while [ $i -le $2 ]; do
32 echo "killing dc-$i ${fileName}"
33 ssh dc-${i} pkill -u ${USER} -f ${fileName}
38 # killonemachine <Benchmark file name> <machine_num>
39 function killonemachine {
42 echo "killing dc-$machine ${fileName}";
43 ssh dc-${machine} pkill -u ${USER} -f ${fileName}
46 # runmachines <log filename>
47 function runMachines {
48 echo "Running on ${NUM_MACHINE} machines ... "
51 echo "Running machines"
54 DIR=`echo ${BASEDIR}\/${BM_DIR}\/${RECOVERYDIR}`;
58 while [ $k -gt 1 ]; do
59 echo "SSH into dc-${k}"
60 ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> $1'-'$k 2>&1 &
64 echo "Running master machine ... "
65 echo "ssh dc-1 cd $DIR'; ./$BM_NAME.bin master $NUM_MACHINE $BM_ARGS";
66 ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS >> $1'-1' 2>&1 &
69 ########### Normal execution
70 function runNormalTest {
79 while [ $tt -le $NUM_MACHINE ]; do
80 echo "------------------------------- Normal Test $1 ----------------------------" >> log-$tt
94 ########### Failure case
95 function runFailureTest {
106 if [ $k -eq 0 ]; then # if k = 0, it is a new test
107 if [ $test_iter -ne 1 ]; then
108 sleep $WAITTIME # wait the end of execution
109 killclients $fName 8 # kill alive machines
111 for outputIter in 1 2 3 4 5 6 7 8
113 echo "----------------------------------------------------------------------------------" >> log-$outputIter
118 for outputIter in 1 2 3 4 5 6 7 8
120 echo "------------------------------- Failure Test $test_iter ----------------------------" >> log-$outputIter
122 echo "------------------------------- Failure Test $test_iter ----------------------------"
124 sleep 10 # wait until all machine run
125 test_iter=`expr $test_iter + 1`
126 else # if k != 0, time to kill machines!
127 echo "------------------------ dc-$k is killed ------------------------" >> log-$k
128 echo "------------------------ dc-$k is killed ------------------------"
129 killonemachine $fName $k
131 let "delay= $RANDOM % $KILLDELAY + 3"
136 killclients $fName 8 # kill alive machines
145 while [ $i -lt $1 ]; do
146 echo "$DIR" > ~/.tmpdir
147 echo "bin=$3" > ~/.tmpvars
150 for j in $MACHINELIST; do
151 if [ $ct -lt $2 ]; then
152 if [ "$j" != "$HOSTNAME" ]; then
153 MACHINES="$MACHINES $j"
160 DSTMDIR=${HOME}/research/Robust/src/Benchmarks/Prefetch/config
161 if [ $2 -eq 2 ]; then
163 ln -s ${DSTMDIR}/dstm_2.conf dstm.conf
165 if [ $2 -eq 3 ]; then
167 ln -s ${DSTMDIR}/dstm_3.conf dstm.conf
169 if [ $2 -eq 4 ]; then
171 ln -s ${DSTMDIR}/dstm_4.conf dstm.conf
173 if [ $2 -eq 5 ]; then
175 ln -s ${DSTMDIR}/dstm_5.conf dstm.conf
177 if [ $2 -eq 6 ]; then
179 ln -s ${DSTMDIR}/dstm_6.conf dstm.conf
181 if [ $2 -eq 7 ]; then
183 ln -s ${DSTMDIR}/dstm_7.conf dstm.conf
185 if [ $2 -eq 8 ]; then
187 ln -s ${DSTMDIR}/dstm_8.conf dstm.conf
190 for machine in `echo $MACHINES`
192 ssh ${machine} 'cd `cat ~/.tmpdir`; source ~/.tmpvars; ./$bin' &
196 perl -x${TOPDIR} ${TOPDIR}/switch/fetch_stat.pl clear_stats settings=switch/clearsettings.txt
197 /usr/bin/time -f "%e" ./$3 master $arg 2> ${LOGDIR}/tmp
198 perl -x${TOPDIR} ${TOPDIR}/switch/fetch_stat.pl settings=switch/settings.txt
199 cat ${LOGDIR}/tmp >> ${LOGDIR}/${3}_${2}Thrd_${EXTENSION}.txt
200 if [ $i -eq 0 ];then echo "<h3> Benchmark=${3} Thread=${2} Extension=${EXTENSION}</h3><br>" > ${LOGDIR}/${3}_${EXTENSION}_${2}Thrd_a.html ;fi
201 cat ${LOGDIR}/tmp >> ${LOGDIR}/${3}_${EXTENSION}_${2}Thrd_a.html
202 echo "<a href=\"${3}_${2}Thrd_${EXTENSION}_${i}.html\">Network Stats</a><br>" >> ${LOGDIR}/${3}_${EXTENSION}_${2}Thrd_a.html
203 mv ${TOPDIR}/html/dell.html ${LOGDIR}/${3}_${2}Thrd_${EXTENSION}_${i}.html
204 echo "Terminating ... "
205 for machine in `echo $MACHINES`
207 ssh ${machine} 'source ~/.tmpvars; killall $bin'
218 BM_NAME=`echo $line | cut -f1 -d":"`
219 BM_ARGS=`echo $line | cut -f2 -d":"`
222 # Setup for remote machine
223 echo "BM_NAME='$BM_NAME'"
224 echo "BM_ARGS='$BM_ARGS'"
226 fileName=${BM_NAME}.bin
228 # terminate if it doesn't have parameter
229 let "NUM_MACHINE= $nummachines + 0";
231 # echo "====================================== Normal Test =============================="
232 # runNormalTest $NUM_MACHINES 1
233 # echo "================================================================================"
235 # echo "====================================== Failure Test ============================="
236 # runFailureTest $NUM_MACHINES
237 # echo "================================================================================="
239 # echo "====================================== Recovery Execution Time ============================="
240 # for count in 2 4 6 8
242 # echo "------- Running $count threads $BMDIR non-prefetch + non-cache on $count machines -----"
243 # runRecovery 1 $count $NONPREFETCH_NONCACHE
245 # echo "================================================================================="
247 # echo "====================================== Normal DSM Execution Time ============================="
248 # for count in 2 4 6 8
250 # echo "------- Running $count threads $BMDIR non-prefetch + non-cache on $count machines -----"
251 # runDSM 1 $count $NONPREFETCH_NONCACHE
253 # echo "================================================================================="
255 echo "=============== Running javasingle for ${BM_NAME} on 1 machines ================="
256 javasingle 1 ${BM_NAME}
258 echo "================================================================================="
260 echo "=============== Running recoverysingle for ${BM_NAME} on 1 machines ================="
261 recoverysingle 1 ${BM_NAME}
263 echo "================================================================================="
268 function javasingle {
269 DIR=`echo ${BASEDIR}\/${2}\/${JAVASINGLEDIR}`;
273 echo "ssh dc-1 cd $DIR'; ./${2}.bin 1 ${BM_ARGS}";
274 while [ $i -lt $1 ]; do
275 /usr/bin/time -f "%e" ./${2}.bin 1 ${BM_ARGS} 2> ${DIR}/tmp
276 cat ${DIR}/tmp >> ${LOGDIR}/${2}_javasingle.txt
282 function recoverysingle {
283 DIR=`echo ${BASEDIR}\/${2}\/${RECOVERYDIR}`;
287 DSTMDIR=${HOME}/research/Robust/src/Benchmarks/Prefetch/config
288 ln -s ${DSTMDIR}/dstm_1.conf dstm.conf
292 while [ $i -lt $1 ]; do
293 echo "Running master machine ... "
294 echo "ssh dc-1 cd $DIR'; ./${2}.bin master 1 ${BM_ARGS}";
295 ssh dc-1 'cd '$DIR'; ./'${2}'.bin master '1 ${BM_ARGS} >> ${LOGDIR}/${2}_recoverysingle.txt 2>&1 &
298 echo "killing dc-1 ${fName}"
299 pkill -u ${USER} -f ${fName}
304 echo "---------- Starting Benchmarks ----------"
307 echo "----------- done ------------"