MMul matrix;
MatrixMultiply mm;
- if (args.length == 3) {
+ if (args.length == 2) {
SIZE = Integer.parseInt(args[0]);
increment = Integer.parseInt(args[1]); // size of subtask
}
else {
System.out.println("usage: ./MatrixMultiply.bin <size of matrix> <size of subtask>");
+ System.exit(0);
}
matrix = new MMul(SIZE, SIZE, SIZE);
for(int i = 0; i < L; i++) {
double ai[] = a[i];
for(int j = 0; j < M; j++) {
- ai[j] = j+1;
+ ai[j] = 1;
}
}
for(int i = 0; i < M; i++) {
double bi[] = b[i];
for(int j = 0; j < N; j++) {
- bi[j] = j+1;
+ bi[j] = 1;
}
}
int x1;
int size;
+
// get matrix
atomic {
seg = (Segment)myWork;
mmul.c[i][j] = lc[i][j];
}
}
+
}
}
}
int[] mid = new int[8];
- mid[0] = (128<<24)|(195<<16)|(180<<8)|21; //dw-2
- mid[1] = (128<<24)|(195<<16)|(180<<8)|26; //dw-7
-/* mid[2] = (128<<24)|(195<<16)|(180<<8)|26; //dw-7
+/* mid[0] = (128<<24)|(195<<16)|(180<<8)|21; //dw-2
+ mid[1] = (128<<24)|(195<<16)|(180<<8)|26; //dw-7*/
+ mid[2] = (128<<24)|(195<<16)|(180<<8)|26; //dw-7
mid[0] = (128<<24)|(195<<16)|(136<<8)|162; //dc1
mid[1] = (128<<24)|(195<<16)|(136<<8)|163; //dc2
mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dc3
mid[5] = (128<<24)|(195<<16)|(136<<8)|167; //dc6
mid[6] = (128<<24)|(195<<16)|(136<<8)|168; //dc7
mid[7] = (128<<24)|(195<<16)|(136<<8)|169; //dc8
-*/
+
atomic {
matrix = global new MMul(SIZE, SIZE, SIZE);
matrix.setValues();
}
public void output() {
- System.out.println("Sum = " + mmul.getSum());
+ System.out.println("c[0][0] = " + mmul.c[0][0] + " c["+(SIZE-1)+"]["+(SIZE-1)+"] : " + mmul.c[SIZE-1][SIZE-1]);
}
}
for(int i = 0; i < M; i++) {
double bi[] = b[i];
for(int j = 0; j < N; j++) {
- bi[j] = j+1;
+ bi[j] = j+ 1;
}
}
//diff = stop-start;
// System.out.println("time to complete iteration" + j + " = " + diff + " millisecs");
} //end num emails
- System.out.println((i+1)+"th iteration correct = " + correct + " Wrong = " + wrong + " percentage = " + ((float)correct/(float)nemails));
+// System.out.println((i+1)+"th iteration correct = " + correct + " Wrong = " + wrong + " percentage = " + ((float)correct/(float)nemails));
}//end num iter
// Sanity check
-// System.out.println((i)+"th iteration correct = " + correct + " Wrong = " + wrong + " percentage = " + ((float)correct/(float)nemails));
+ System.out.println((i)+"th iteration correct = " + correct + " Wrong = " + wrong + " percentage = " + ((float)correct/(float)nemails));
System.out.println("\n\n\n I'm Done\n\n\n");
RecoveryStat.printRecoveryStat();
# !/bin/sh
+
+# Usage
+#
+# ./runjava.sh <num_machine>
+#
+
BASEDIR=`pwd`
RECOVERYDIR='recovery'
JAVASINGLEDIR='java'
-ITERATIONS=10
-WAITTIME=300
+ITERATIONS=1
+WAITTIME=30
+
+# 0 mean new test
+# 1~8 machine id to be killed
+ORDER=( 0 1 3 5 7 8 2
+ 0 1 2 3 4 5 6
+ 0 1 8 4 6 3 7
+ 0 8 7 3 6 5 4
+ 0 7 4 6 8 1 2 );
# killClients <fileName> <# of machines>
function killclients {
tt=1;
while [ $tt -le $NUM_MACHINE ]; do
- echo "------------------------------- Failure Test $1 ----------------------------" >> log-$tt
tt=`expr $tt + 1`
done
- # run all machines
- runMachines log
- sleep 10 # wait until all machine run
- # Kill machines
- for k in 2 4 6 8
+ test_iter=0;
+
+ for k in ${ORDER[@]}
do
- echo "------------------------ dc-$k is killed ------------------------" >> log-$k
- killonemachine $fileName $k
- sleep 10
+ if [ $k -eq 0 ]; then # if k = 0, it is a new test
+ if [ $test_iter -ne 1 ]; then
+ sleep $WAITTIME # wait the end of execution
+ killclients $fileName 8 # kill alive machines
+ else
+ test_iter=`expr $test_iter + 1`
+ fi
+
+ echo "------------------------------- Failure Test $test_iter ----------------------------" >> log-$tt
+ runMachines log
+ sleep 10 # wait until all machine run
+
+ else # if k != 0, time to kill machines!
+ echo "------------------------ dc-$k is killed ------------------------" >> log-$k
+ killonemachine $fileName $k
+
+ let "killdelay= $RANDOM % 2 + 3"
+ sleep $killdelay
+ fi
done
- sleep $WAITTIME # wait the end of execution
- killclients $fileName 8 # kill alive machines
sleep 10
cd -
}
echo "BM_ARGS='$BM_ARGS'" > ~/.bmargs
fileName=${BM_NAME}.bin
- echo "fileName='$fileName'"
# terminate if it doesn't have parameter
let "NUM_MACHINE= $1 + 0";
- if [ $NUM_MACHINE -eq 0 ];
+ if [ $NUM_MACHINE -eq 0 ]
then
echo "Wrong input"
- let "Num= 8";
+ echo "Usage : ./runjava.sh <num_machine> <number of machine to be killed>"
exit 0
fi
echo "BM_ARGS= $BM_ARGS"
echo "NUM_M = $NUM_MACHINE"
+ echo "====================================== Normal Test =============================="
+ runNormalTest $NUM_MACHINES 1
- echo "=================================== 1 ================================="
- runNormalTest $NUM_MACHINES 1
- echo "======================================================================="
-
- t=2;
- while [ $t -le $ITERATIONS ]; do
- echo "==================================== $t ============================="
-# runFailureTest $NUM_MACHINES 1
-# sleep 10
- echo "====================================================================="
- t=`expr $t + 1`
- done
+ echo "================================================================================="
+ echo "====================================== Failure Test ============================="
+ runFailureTest $NUM_MACHINES
+ echo "================================================================================="
killclients $fileName 8
-done
echo "----------- done ------------"