From c1586dec011c7c08fd5d2b03a582ccc093e53448 Mon Sep 17 00:00:00 2001 From: adash Date: Tue, 12 Aug 2008 21:46:44 +0000 Subject: [PATCH] commit latest files --- .../MatrixMultiply/MatrixMultiply.java | 161 +++++++++--------- .../MatrixMultiply/MatrixMultiplyN.java | 10 +- .../MatrixMultiply/MatrixMultiplyNrun.java | 6 +- .../Prefetch/MatrixMultiply/makefile | 24 +-- 4 files changed, 97 insertions(+), 104 deletions(-) diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java index e56a6faa..3f2d37cd 100644 --- a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java +++ b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java @@ -46,101 +46,92 @@ public class MatrixMultiply extends Thread{ } } - public static void main(String[] args) { -<<<<<<< MatrixMultiply.java - int mid1 = (128<<24)|(195<<16)|(175<<8)|69; - int mid2 = (128<<24)|(195<<16)|(175<<8)|69; - int mid3 = (128<<24)|(195<<16)|(175<<8)|71; - int NUM_THREADS = 1; -======= + public static void main(String[] args) { int NUM_THREADS = 4; int[] mid = new int[NUM_THREADS]; mid[0] = (128<<24)|(195<<16)|(175<<8)|69; mid[1] = (128<<24)|(195<<16)|(175<<8)|73; mid[2] = (128<<24)|(195<<16)|(175<<8)|78; mid[3] = (128<<24)|(195<<16)|(175<<8)|79; - //int mid1 = (128<<24)|(195<<16)|(175<<8)|69; - //int mid2 = (128<<24)|(195<<16)|(175<<8)|73; ->>>>>>> 1.19 - int p, q, r; - MatrixMultiply[] mm; - MatrixMultiply tmp; - MMul matrix; - - atomic { - matrix = global new MMul(400, 400, 400); - matrix.setValues(); - matrix.transpose(); - } - - atomic{ - mm = global new MatrixMultiply[NUM_THREADS]; - } - - atomic { - mm[0] = global new MatrixMultiply(matrix,0,0,200,200); - mm[1] = global new MatrixMultiply(matrix,0,201,200,399); - mm[2] = global new MatrixMultiply(matrix,201,0,399,200); - mm[3] = global new MatrixMultiply(matrix,201,201,399,399); - } - - atomic { - p = matrix.L; - q = matrix.M; - r = matrix.N; - } - - // print out the matrices to be multiplied - System.printString("\n"); - System.printString("MatrixMultiply: L="); - System.printInt(p); - System.printString("\t"); - System.printString("M="); - System.printInt(q); - System.printString("\t"); - System.printString("N="); - System.printInt(r); - System.printString("\n"); - - // start a thread to compute each c[l,n] - for (int i = 0; i < NUM_THREADS; i++) { - atomic { - tmp = mm[i]; - } - tmp.start(mid[i]); - } - - // wait for them to finish - for (int i = 0; i < NUM_THREADS; i++) { - atomic { - tmp = mm[i]; - } - tmp.join(); - } - - // print out the result of the matrix multiply - System.printString("Starting\n"); - System.printString("Matrix Product c =\n"); - double val; - atomic { - for (int i = 0; i < p; i++) { - double c[]=matrix.c[i]; - for (int j = 0; j < r; j++) { - val = c[j]; - } - } - } - System.printString("Finished\n"); - } + int p, q, r; + MatrixMultiply[] mm; + MatrixMultiply tmp; + MMul matrix; + + atomic { + matrix = global new MMul(400, 400, 400); + matrix.setValues(); + matrix.transpose(); + } + + atomic{ + mm = global new MatrixMultiply[NUM_THREADS]; + } + + atomic { + mm[0] = global new MatrixMultiply(matrix,0,0,200,200); + mm[1] = global new MatrixMultiply(matrix,0,201,200,399); + mm[2] = global new MatrixMultiply(matrix,201,0,399,200); + mm[3] = global new MatrixMultiply(matrix,201,201,399,399); + } + + atomic { + p = matrix.L; + q = matrix.M; + r = matrix.N; + } + + // print out the matrices to be multiplied + System.printString("\n"); + System.printString("MatrixMultiply: L="); + System.printInt(p); + System.printString("\t"); + System.printString("M="); + System.printInt(q); + System.printString("\t"); + System.printString("N="); + System.printInt(r); + System.printString("\n"); + + // start a thread to compute each c[l,n] + for (int i = 0; i < NUM_THREADS; i++) { + atomic { + tmp = mm[i]; + } + tmp.start(mid[i]); + } + + // wait for them to finish + for (int i = 0; i < NUM_THREADS; i++) { + atomic { + tmp = mm[i]; + } + tmp.join(); + } + + // print out the result of the matrix multiply + System.printString("Starting\n"); + System.printString("Matrix Product c =\n"); + double val; + atomic { + for (int i = 0; i < p; i++) { + double c[]=matrix.c[i]; + for (int j = 0; j < r; j++) { + val = c[j]; + } + } + } + System.printString("Finished\n"); + } } public class MMul{ - public int L, M, N; - public double[][] a; - public double[][] b; - public double[][] c; - public double[][] btranspose; + public int L, M, N; + public double[][] a; + public double[][] b; + public double[][] c; + public double[][] btranspose; public MMul(int L, int M, int N) { this.L = L; diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java index 93a00316..fdb02c40 100644 --- a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java +++ b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java @@ -1,7 +1,6 @@ public class MatrixMultiply extends Thread{ MMul mmul; public int x0, y0, x1, y1; - public MatrixMultiply(MMul mmul, int x0, int x1, int y0, int y1) { this.mmul = mmul; this.x0 = x0; @@ -43,10 +42,10 @@ public class MatrixMultiply extends Thread{ } int[] mid = new int[4]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|69; - mid[1] = (128<<24)|(195<<16)|(175<<8)|70; - mid[2] = (128<<24)|(195<<16)|(175<<8)|71; - mid[3] = (128<<24)|(195<<16)|(175<<8)|79; + mid[0] = (128<<24)|(195<<16)|(175<<8)|79; //dw-8 + mid[1] = (128<<24)|(195<<16)|(175<<8)|73; //dw-5 + mid[2] = (128<<24)|(195<<16)|(175<<8)|78; //dw-7 + mid[3] = (128<<24)|(195<<16)|(175<<8)|69; //dw-1 int p, q, r; MatrixMultiply[] mm; MatrixMultiply tmp; @@ -90,6 +89,7 @@ public class MatrixMultiply extends Thread{ } tmp.start(mid[i]); } + // wait for them to finish for (int i = 0; i < NUM_THREADS; i++) { diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java index 28c28044..5f487204 100644 --- a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java +++ b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java @@ -53,9 +53,9 @@ public class MatrixMultiply extends Thread{ int[] mid = new int[4]; mid[0] = (128<<24)|(195<<16)|(175<<8)|79; - mid[1] = (128<<24)|(195<<16)|(175<<8)|80; - mid[2] = (128<<24)|(195<<16)|(175<<8)|69; - mid[3] = (128<<24)|(195<<16)|(175<<8)|70; + mid[1] = (128<<24)|(195<<16)|(175<<8)|73; + mid[2] = (128<<24)|(195<<16)|(175<<8)|78; + mid[3] = (128<<24)|(195<<16)|(175<<8)|69; int p, q, r; MatrixMultiply[] mm; MatrixMultiply tmp; diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile index b73534f0..8dfc9c6c 100644 --- a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile +++ b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile @@ -1,20 +1,22 @@ MAINCLASS=MatrixMultiply SRC1=${MAINCLASS}N.java SRC2=${MAINCLASS}Nrun.java -FLAGS=-dsm -prefetch -optimize -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.90 -FLAGS2=-dsm -optimize -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} +FLAGS=-dsm -prefetch -optimize -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.90 +FLAGS2=-dsm -optimize -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} default: ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC1} ../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1} - ../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC2} - ../../../buildscript ${FLAGS} -o ${MAINCLASS}1 ${SRC2} - cp ${MAINCLASS}1NP.bin ${MAINCLASS}2NP.bin - cp ${MAINCLASS}1.bin ${MAINCLASS}2.bin - cp ${MAINCLASS}1NP.bin ${MAINCLASS}3NP.bin - cp ${MAINCLASS}1.bin ${MAINCLASS}3.bin - cp ${MAINCLASS}1NP.bin ${MAINCLASS}4NP.bin - cp ${MAINCLASS}1.bin ${MAINCLASS}4.bin +# ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC2} +# ../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC2} + cp ${MAINCLASS}NNP.bin ${MAINCLASS}1NP.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}1.bin + cp ${MAINCLASS}NNP.bin ${MAINCLASS}2NP.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}2.bin + cp ${MAINCLASS}NNP.bin ${MAINCLASS}3NP.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}3.bin + cp ${MAINCLASS}NNP.bin ${MAINCLASS}4NP.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}4.bin clean: - rm *.bin rm -rf tmpbuilddirectory + rm *.bin -- 2.34.1