5 # ./runjava.sh <num_machine>
11 RECOVERYDIR='recovery'
15 LOGDIR=~/research/Robust/src/Benchmarks/Recovery/runlog
16 DSTMDIR=${HOME}/research/Robust/src/Benchmarks/Prefetch/config
17 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'
21 # 1~8 machine id to be killed
29 #ORDER=( 0 1 8 4 6 3 7 );
32 # killClients <fileName> <# of machines>
33 function killclients {
36 while [ $k -le $2 ]; do
37 echo "killing dc-$k ${fileName}"
38 ssh dc-${k} pkill -u ${USER} -f ${fileName}
43 # killClientsWith USR1 signal <fileName> <# of machines>
44 function killclientswithSignal {
47 while [ $k -le $2 ]; do
48 echo "killing dc-$k ${fileName}"
49 ssh dc-${k} killall -USR1 ${fileName}
54 # killonemachine <Benchmark file name> <machine_num>
55 function killonemachine {
58 echo "killing dc-$machine ${fileName}";
59 #ssh dc-${machine} pkill -u ${USER} -f ${fileName}
60 ssh dc-${machine} killall -USR1 ${fileName}
63 # runmachines <log filename>
64 function runMachines {
65 echo "Running on ${NUM_MACHINE} machines ... "
68 echo "Running machines"
71 DIR=`echo ${BASEDIR}\/${BM_DIR}\/${RECOVERYDIR}`;
75 while [ $k -gt 1 ]; do
76 echo "SSH into dc-${k}"
77 ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> log'-'$k 2>&1 &
82 echo "Running master machine ... "
83 echo "ssh dc-1 cd $DIR'; ./$BM_NAME.bin master $NUM_MACHINE $BM_ARGS";
84 ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS >> log'-1' 2>&1 &
87 ########### Normal execution
88 # runNormalTest $NUM_MACHINES 1
89 function runNormalTest {
98 while [ $tt -le $NUM_MACHINE ]; do
99 echo "------------------------------- Normal Test $1 ----------------------------" >> log-$tt
107 killclientswithSignal $fName 8
108 #killclients $fName 8
113 ########### Failure case
114 function runFailureTest {
118 fName="$BM_NAME.bin";
125 if [ $k -eq 0 ]; then # if k = 0, it is a new test
126 if [ $test_iter -ne 1 ]; then
127 sleep $WAITTIME # wait the end of execution
128 #killclients $fName 8 # kill alive machines
129 killclientswithSignal $fName 8 #kill machines when there is more than 1 order
131 for outputIter in 1 2 3 4 5 6 7 8
133 echo "----------------------------------------------------------------------------------" >> log-$outputIter
138 for outputIter in 1 2 3 4 5 6 7 8
140 echo "------------------------------- Failure Test $test_iter ----------------------------" >> log-$outputIter
142 echo "------------------------------- Failure Test $test_iter ----------------------------"
144 sleep 10 # wait until all machine run
145 test_iter=`expr $test_iter + 1`
146 else # if k != 0, time to kill machines!
147 echo "------------------------ dc-$k is killed ------------------------" >> log-$k
148 echo "------------------------ dc-$k is killed ------------------------"
149 killonemachine $fName $k
151 let "delay= $RANDOM % $KILLDELAY + 4"
156 sleep $WAITTIME # wait the end of execution
157 # killclients $fName 8 # kill alive machines
158 killclientswithSignal $fName 8 #kill machines when finished processing everything in ORDER{ }
164 ###runRecovery <num iterations> <num machines> <recovery file name>
166 function runRecovery {
168 DIR=`echo ${BASEDIR}\/${BM_NAME}\/${RECOVERYDIR}`;
170 fName="$BM_NAME.bin";
172 while [ $i -le $1 ]; do
174 while [ $tt -le $2 ]; do
175 echo "------------------------------- running Recovery on $2 machines for iter=$i ----------------------------" >> log-$tt
179 #select the correct dstm config file
181 if [ $2 -eq 2 ]; then
182 ln -s ${DSTMDIR}/dstm_2.conf dstm.conf
184 if [ $2 -eq 3 ]; then
185 ln -s ${DSTMDIR}/dstm_3.conf dstm.conf
187 if [ $2 -eq 4 ]; then
188 ln -s ${DSTMDIR}/dstm_4.conf dstm.conf
190 if [ $2 -eq 5 ]; then
191 ln -s ${DSTMDIR}/dstm_5.conf dstm.conf
193 if [ $2 -eq 6 ]; then
194 ln -s ${DSTMDIR}/dstm_6.conf dstm.conf
196 if [ $2 -eq 7 ]; then
197 ln -s ${DSTMDIR}/dstm_7.conf dstm.conf
199 if [ $2 -eq 8 ]; then
200 ln -s ${DSTMDIR}/dstm_8.conf dstm.conf
205 while [ $k -gt 1 ]; do
206 echo "SSH into dc-${k}"
207 ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> log'-'$k 2>&1 &
213 echo "Running master machine ..."
214 ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$2 $BM_ARGS >> log'-1' 2>&1 &
216 echo "Terminating ... "
217 killclientswithSignal $fName $2
225 ###runDSM <num iterations> <num machines> <dsm file name>
229 DIR=`echo ${BASEDIR}\/${BM_NAME}\/${RECOVERYDIR}`;
233 while [ $i -le $1 ]; do
235 while [ $tt -le $2 ]; do
236 echo "------------------------------- running DSM on $2 machines for iter=$i ----------------------------" >> log-$tt
240 #select the correct dstm config file
242 if [ $2 -eq 2 ]; then
243 ln -s ${DSTMDIR}/dstm_2.conf dstm.conf
245 if [ $2 -eq 3 ]; then
246 ln -s ${DSTMDIR}/dstm_3.conf dstm.conf
248 if [ $2 -eq 4 ]; then
249 ln -s ${DSTMDIR}/dstm_4.conf dstm.conf
251 if [ $2 -eq 5 ]; then
252 ln -s ${DSTMDIR}/dstm_5.conf dstm.conf
254 if [ $2 -eq 6 ]; then
255 ln -s ${DSTMDIR}/dstm_6.conf dstm.conf
257 if [ $2 -eq 7 ]; then
258 ln -s ${DSTMDIR}/dstm_7.conf dstm.conf
260 if [ $2 -eq 8 ]; then
261 ln -s ${DSTMDIR}/dstm_8.conf dstm.conf
266 while [ $k -gt 1 ]; do
267 echo "SSH into dc-${k}"
268 ssh dc-${k} 'cd '$DIR'; ./'$BM_DSM'.bin '>> log'-'$k 2>&1 &
274 echo "Running master machine ..."
275 ssh dc-1 'cd '$DIR'; ./'$BM_DSM'.bin master '$2 $BM_ARGS >> log'-1' 2>&1 &
277 echo "Terminating ... "
278 killclientswithSignal $fName $2
289 BM_NAME=`echo $line | cut -f1 -d":"`
290 BM_ARGS=`echo $line | cut -f2 -d":"`
293 # Setup for remote machine
294 echo "BM_NAME='$BM_NAME'"
295 echo "BM_ARGS='$BM_ARGS'"
298 fileName=${BM_NAME}.bin
300 # terminate if it doesn't have parameter
301 let "NUM_MACHINE= $nummachines + 0";
303 echo "====================================== Normal Test =============================="
304 runNormalTest $NUM_MACHINES 1
305 echo "================================================================================"
307 echo "====================================== Failure Test ============================="
308 runFailureTest $NUM_MACHINES
309 echo "================================================================================="
311 # echo "=============== Running javasingle for ${BM_NAME} on 1 machines ================="
312 # javasingle 1 ${BM_NAME}
314 # echo "================================================================================="
316 # echo "=============== Running recoverysingle for ${BM_NAME} on 1 machines ================="
317 # recoverysingle 1 ${BM_NAME}
319 # echo "================================================================================="
321 # echo "=============== Running dsmsingle for ${BM_NAME} on 1 machines ================="
322 # dsmsingle 1 ${BM_DSM}
324 # echo "================================================================================="
326 # echo "====================================== Recovery Execution Time ============================="
329 # echo "------- Running $count threads $BM_NAME recovery on $count machines -----"
330 # runRecovery 1 $count ${BM_NAME}
332 # echo "================================================================================="
334 # echo "====================================== DSM Execution Time ============================="
337 # echo "------- Running $count threads $BM_NAME dsm on $count machines -----"
338 # runDSM 1 $count $BM_DSM
340 # echo "================================================================================="
344 function javasingle {
346 DIR=`echo ${BASEDIR}\/${2}\/${JAVASINGLEDIR}`;
350 echo "ssh dc-1 cd $DIR'; ./${2}.bin 1 ${BM_ARGS}";
351 while [ $i -lt $1 ]; do
352 /usr/bin/time -f "%e" ./${2}.bin 1 ${BM_ARGS} 2> ${DIR}/tmp
353 cat ${DIR}/tmp >> ${LOGDIR}/${2}_javasingle.txt
359 function recoverysingle {
360 DIR=`echo ${BASEDIR}\/${2}\/${RECOVERYDIR}`;
364 ln -s ${DSTMDIR}/dstm_1.conf dstm.conf
368 while [ $i -lt $1 ]; do
369 echo "Running master machine ... "
370 echo "ssh dc-1 cd $DIR'; ./${2}.bin master 1 ${BM_ARGS}";
371 ssh dc-1 'cd '$DIR'; ./'${2}'.bin master '1 ${BM_ARGS} >> ${LOGDIR}/${2}_recoverysingle.txt 2>&1 &
374 echo "killing dc-1 ${fName}"
375 pkill -u ${USER} -f ${fName}
381 DIR=`echo ${BASEDIR}\/${BM_NAME}\/${RECOVERYDIR}`;
385 ln -s ${DSTMDIR}/dstm_1.conf dstm.conf
389 while [ $i -lt $1 ]; do
390 echo "Running master machine ... "
391 echo "ssh dc-1 cd $DIR'; ./${2}.bin master 1 ${BM_ARGS}";
392 ssh dc-1 'cd '$DIR'; ./'${2}'.bin master '1 ${BM_ARGS} >> ${LOGDIR}/${BM_NAME}_dsmsingle.txt 2>&1 &
395 echo "killing dc-1 ${fName}"
396 pkill -u ${USER} -f ${fName}
401 echo "---------- Starting Benchmarks ----------"
404 echo "----------- done ------------"