From fe7beca0516118c393016d08692442998a9e72f4 Mon Sep 17 00:00:00 2001 From: jihoonl Date: Sun, 17 Jan 2010 10:26:40 +0000 Subject: [PATCH] change --- .../Recovery/FileSystem/LookUpService.java | 2 +- ...trixMultiplyN.java => MatrixMultiply.java} | 48 +++++++++++++---- .../Recovery/MatrixMultiply/makefile | 2 +- .../Benchmarks/Recovery/Spider/Spider.java | 11 ++-- Robust/src/Benchmarks/Recovery/runjava.sh | 52 ++++++++++--------- 5 files changed, 72 insertions(+), 43 deletions(-) rename Robust/src/Benchmarks/Recovery/MatrixMultiply/{MatrixMultiplyN.java => MatrixMultiply.java} (81%) diff --git a/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java b/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java index 85d74ae1..913399b1 100644 --- a/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java +++ b/Robust/src/Benchmarks/Recovery/FileSystem/LookUpService.java @@ -221,7 +221,7 @@ public class LookUpService extends Thread { NUM_THREADS = Integer.parseInt(args[0]); filename = args[1]; - int[] mid = new int[NUM_THREADS]; + int[] mid = new int[8]; mid[0] = (128<<24)|(195<<16)|(180<<8)|21;//dw-2 mid[1] = (128<<24)|(195<<16)|(180<<8)|24;//dw-5 mid[2] = (128<<24)|(195<<16)|(180<<8)|26;//dw-7 diff --git a/Robust/src/Benchmarks/Recovery/MatrixMultiply/MatrixMultiplyN.java b/Robust/src/Benchmarks/Recovery/MatrixMultiply/MatrixMultiply.java similarity index 81% rename from Robust/src/Benchmarks/Recovery/MatrixMultiply/MatrixMultiplyN.java rename to Robust/src/Benchmarks/Recovery/MatrixMultiply/MatrixMultiply.java index dc956d5d..24460f8f 100644 --- a/Robust/src/Benchmarks/Recovery/MatrixMultiply/MatrixMultiplyN.java +++ b/Robust/src/Benchmarks/Recovery/MatrixMultiply/MatrixMultiply.java @@ -1,13 +1,20 @@ +/* MatrixMultiplyN.java + + Matrix Multiplication Benchmark using Task Library. + a, b, and c are two dimensional array. + It computes a * b and assigns to c. + +*/ public class MatrixMultiply extends Task { MMul mmul; int SIZE; int increment; - public MatrixMultiply(MMul mmul, int num_threads, int size) { + public MatrixMultiply(MMul mmul, int num_threads, int size,int increment) { this.mmul = mmul; SIZE = size; - increment = 80; + this.increment = increment; init(); } @@ -78,7 +85,6 @@ public class MatrixMultiply extends Task { } } // end for i // } - System.out.println("Finished comutation"); atomic { for (i = x0; i < x1; i++) { @@ -95,9 +101,7 @@ public class MatrixMultiply extends Task { double sum = 0; for(i = 0 ;i < size; i++) { -// atomic { sum += rowA[i] * colB[i]; -// } } return sum; @@ -109,22 +113,27 @@ public class MatrixMultiply extends Task { public static void main(String[] args) { int NUM_THREADS=4; int SIZE = 1600; + int increment = 80; int i,j; Work[] works; MMul matrix; MatrixMultiply mm; Segment[] currentWorkList; - if (args.length > 0) { + if (args.length == 3) { NUM_THREADS = Integer.parseInt(args[0]); SIZE = Integer.parseInt(args[1]); + increment = Integer.parseInt(args[2]); // size of subtask } else { - System.out.println("usage: ./MatrixMultiply.bin master "); + System.out.println("usage: ./MatrixMultiply.bin master "); } int[] mid = new int[8]; - mid[0] = (128<<24)|(195<<16)|(136<<8)|162; //dc1 + mid[0] = (128<<24)|(195<<16)|(180<<8)|21; //dw-2 + mid[1] = (128<<24)|(195<<16)|(180<<8)|24; //dw-5 + 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[3] = (128<<24)|(195<<16)|(136<<8)|165; //dc4 @@ -132,12 +141,12 @@ public class MatrixMultiply extends Task { 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(); matrix.transpose(); - mm = global new MatrixMultiply(matrix, NUM_THREADS, SIZE); + mm = global new MatrixMultiply(matrix, NUM_THREADS, SIZE,increment); works = global new Work[NUM_THREADS]; currentWorkList = global new Segment[NUM_THREADS]; @@ -146,7 +155,6 @@ public class MatrixMultiply extends Task { works[i] = global new Work(mm, NUM_THREADS, i,currentWorkList); } } - System.out.println("Finished to createObjects"); long st = System.currentTimeMillis(); long fi; @@ -167,6 +175,12 @@ public class MatrixMultiply extends Task { } fi = System.currentTimeMillis(); + double sum= 0; + atomic { + sum = matrix.getSum(); + } + + System.out.println("Sum of matrix = " + sum); System.out.println("Time Elapse = " + (double)((fi-st)/1000)); System.printString("Finished\n"); } @@ -226,6 +240,18 @@ public class MMul{ } } } + + public double getSum() { + double sum =0; + + for(int row =0; row < L; row++) { + double cr[] = c[row]; + for(int col = 0; col < N; col++) { + sum += cr[col]; + } + } + return sum; + } } public class Segment { diff --git a/Robust/src/Benchmarks/Recovery/MatrixMultiply/makefile b/Robust/src/Benchmarks/Recovery/MatrixMultiply/makefile index cb8d03bd..92d0677f 100644 --- a/Robust/src/Benchmarks/Recovery/MatrixMultiply/makefile +++ b/Robust/src/Benchmarks/Recovery/MatrixMultiply/makefile @@ -1,5 +1,5 @@ MAINCLASS=MatrixMultiply -SRC1=${MAINCLASS}N.java +SRC1=${MAINCLASS}.java FLAGS= -recovery -recoverystats -dsm -32bit -nooptimize -debug -dsmtask -mainclass ${MAINCLASS} diff --git a/Robust/src/Benchmarks/Recovery/Spider/Spider.java b/Robust/src/Benchmarks/Recovery/Spider/Spider.java index dd286566..e86229ce 100644 --- a/Robust/src/Benchmarks/Recovery/Spider/Spider.java +++ b/Robust/src/Benchmarks/Recovery/Spider/Spider.java @@ -2,7 +2,7 @@ public class Spider { public static void main(String[] args) { int NUM_THREADS = 3; int maxDepth = 4; - int maxSearchDepth = 100; + int maxSearchDepth = 10; int i, j; Work[] works; QueryTask[] qt; @@ -18,12 +18,11 @@ public class Spider { mid[1] = (128<<24)|(195<<16)|(136<<8)|163; mid[2] = (128<<24)|(195<<16)|(136<<8)|164; mid[3] = (128<<24)|(195<<16)|(136<<8)|165; + mid[4] = (128<<24)|(195<<16)|(136<<8)|166; + mid[5] = (128<<24)|(195<<16)|(136<<8)|167; + mid[6] = (128<<24)|(195<<16)|(136<<8)|168; + mid[7] = (128<<24)|(195<<16)|(136<<8)|169; - -/* mid[0] = (128<<24)|(195<<16)|(180<<8)|21; - mid[1] = (128<<24)|(195<<16)|(180<<8)|24; - mid[2] = (128<<24)|(195<<16)|(180<<8)|26; -*/ atomic { firstmachine = global new GlobalString(args[1]); if (args.length == 3) { diff --git a/Robust/src/Benchmarks/Recovery/runjava.sh b/Robust/src/Benchmarks/Recovery/runjava.sh index bdda9a26..c8ca9deb 100755 --- a/Robust/src/Benchmarks/Recovery/runjava.sh +++ b/Robust/src/Benchmarks/Recovery/runjava.sh @@ -11,8 +11,7 @@ ITERATIONS=1 function killclients { i=1; fileName=$1 - let "k= $Num"; - while [ $i -le $k ]; do + while [ $i -le $2 ]; do echo "killing dc-$i ${fileName}" ssh dc-${i} pkill -u jihoonl -f ${fileName} i=`expr $i + 1` @@ -27,6 +26,7 @@ function killonemachine { ssh dc-${machine} pkill -u jihoonl -f ${fileName} } +# runmachines function runMachines { echo "Running on ${NUM_MACHINE} machines ... " @@ -43,10 +43,11 @@ function runMachines { echo "SSH into dc-${k}" ssh dc-${k} 'cd '$DIR'; ./'$BM_NAME'.bin' & k=`expr $k - 1` + sleep 1 done - echo "Running master machine ... " - ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS & + echo "ssh dc-1 cd $DIR'; ./$BM_NAME.bin master '$NUM_MACHINE $BM_ARGS"; + ssh dc-1 'cd '$DIR'; ./'$BM_NAME'.bin master '$NUM_MACHINE $BM_ARGS } function runMultiMachineTest { @@ -54,26 +55,29 @@ function runMultiMachineTest { echo "Runnning ${BM_NAME}" j=1; BM_DIR=${BM_NAME} - - cd ${BM_DIR} - - while [ $j -le $ITERATIONS ]; do - # run all machines - runMachines - sleep 10 # wait until all machine run - fileName="$BM_NAME.bin"; - # Kill machines - for k in 2 4 6 8 - do - killonemachine $fileName $k - sleep 30 - done - - sleep 1000; # wait the end of execution - killclients # kill alive machines - sleep 10; - j=`expr $j + 1` - done + fileName="$BM_NAME.bin"; + cd ${BM_DIR} + + ########### Normal execution + runMachines + killclients $fileName 8 + sleep 10 + + ########### Failure case-1 + + # run all machines +# runMachines +# sleep 10 # wait until all machine run + # Kill machines +# for k in 2 4 6 8 +# do +# killonemachine $fileName $k +# sleep 30 +# done + +# sleep 1000; # wait the end of execution + killclients $fileName 8 # kill alive machines + sleep 10; cd - } -- 2.34.1