From: bdemsky Date: Mon, 5 May 2008 07:17:21 +0000 (+0000) Subject: checked in final version of Matrix Multiply X-Git-Tag: preEdgeChange~102 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b11c9225e37773099dad8a7d6e9ba4f2a84baebd;p=IRC.git checked in final version of Matrix Multiply --- diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java index e0e9a25a..24eda14f 100644 --- a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java +++ b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java @@ -12,38 +12,43 @@ public class MatrixMultiply extends Thread{ public void run() { atomic { - double la[][]=mmul.a; - double lc[][]=mmul.c; - double lb[][]=mmul.btranspose; + double la[][][]=mmul.a; + double lc[][][]=mmul.c; + double lb[][][]=mmul.btranspose; int M=mmul.M; - + int P=mmul.P; //Use btranspose for cache performance - for(int i = x0; i< x1; i++){ - double a[]=la[i]; - double c[]=lc[i]; - for (int j = y0; j < y1; j++) { - double innerProduct=0; - double b[] = lb[j]; - for(int k = 0; k < M; k++) { - innerProduct += a[k] *b[k]; - } - c[j]=innerProduct; - } - } + for(int q=0;q0) { - NUM_THREADS=Integer.parseInt(args[0]); - if (args.length>1) { - SIZE=Integer.parseInt(args[1]); - if (args.length>2) - NUM_MATRIX=Integer.parseInt(args[2]); - } + NUM_THREADS=Integer.parseInt(args[0]); + if (args.length>1) { + SIZE=Integer.parseInt(args[1]); + if (args.length>2) + NUM_MATRIX=Integer.parseInt(args[2]); + } } int[] mid = new int[4]; @@ -54,42 +59,27 @@ public class MatrixMultiply extends Thread{ int p, q, r; MatrixMultiply[] mm; MatrixMultiply tmp; - MMul matrix; - - for (int l = 0; l < NUM_MATRIX; l++) { - atomic { - matrix = global new MMul(SIZE, SIZE, SIZE); - matrix.setValues(); - matrix.transpose(); - mm = global new MatrixMultiply[NUM_THREADS]; - int increment=SIZE/NUM_THREADS; - int base=0; - for(int i=0;i