5 # ./runjava.sh <num_machine>
15 # 1~8 machine id to be killed
22 # killClients <fileName> <# of machines>
23 function killclients {
26 while [ $i -le $2 ]; do
27 echo "killing dc-$i ${fileName}"
28 ssh dc-${i} pkill -u jihoonl -f ${fileName}
33 # killonemachine <Benchmark file name> <machine_num>
34 function killonemachine {
37 echo "killing dc-$machine ${fileName}";
38 ssh dc-${machine} pkill -u jihoonl -f ${fileName}
41 # runmachines <log filename>
42 function runMachines {
43 echo "Running on ${NUM_MACHINE} machines ... "
46 echo "Running machines"
49 DIR=`echo ${BASEDIR}\/${BM_DIR}\/${RECOVERYDIR}`;
53 while [ $k -gt 1 ]; do
54 echo "SSH into dc-${k}"
55 ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin '>> $1'-'$k 2>&1 &
59 echo "Running master machine ... "
60 echo "ssh dc-1 cd $DIR'; ./$BM_NAME.bin master $NUM_MACHINE $BM_ARGS";
61 ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS >> $1'-1' 2>&1 &
64 ########### Normal execution
65 function runNormalTest {
74 while [ $tt -le $NUM_MACHINE ]; do
75 echo "------------------------------- Normal Test $1 ----------------------------" >> log-$tt
89 ########### Failure case
90 function runFailureTest {
101 if [ $k -eq 0 ]; then # if k = 0, it is a new test
102 if [ $test_iter -ne 1 ]; then
103 sleep $WAITTIME # wait the end of execution
104 killclients $fName 8 # kill alive machines
106 for outputIter in 1 2 3 4 5 6 7 8
108 echo "----------------------------------------------------------------------------------" >> log-$outputIter
113 for outputIter in 1 2 3 4 5 6 7 8
115 echo "------------------------------- Failure Test $test_iter ----------------------------" >> log-$outputIter
117 echo "------------------------------- Failure Test $test_iter ----------------------------"
119 sleep 10 # wait until all machine run
120 test_iter=`expr $test_iter + 1`
121 else # if k != 0, time to kill machines!
122 echo "------------------------ dc-$k is killed ------------------------" >> log-$k
123 echo "------------------------ dc-$k is killed ------------------------"
124 killonemachine $fName $k
126 let "delay= $RANDOM % $KILLDELAY + 3"
131 killclients $fName 8 # kill alive machines
141 BM_NAME=`echo $line | cut -f1 -d":"`
142 BM_ARGS=`echo $line | cut -f2 -d":"`
145 # Setup for remote machine
146 echo "BM_NAME='$BM_NAME'"
147 echo "BM_ARGS='$BM_ARGS'"
149 fileName=${BM_NAME}.bin
151 # terminate if it doesn't have parameter
152 let "NUM_MACHINE= $nummachines + 0";
154 echo "====================================== Normal Test =============================="
155 runNormalTest $NUM_MACHINES 1
156 echo "================================================================================"
158 echo "====================================== Failure Test ============================="
159 runFailureTest $NUM_MACHINES
160 echo "================================================================================="
164 echo "---------- Starting Benchmarks ----------"
167 echo "----------- done ------------"