From c793a740fbb26823827396b26f8ace3624a52fa8 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Thu, 16 Apr 2009 07:41:46 +0000 Subject: [PATCH] changes --- .../SingleTM/LeeRouting/LeeRouter.java | 8 +- .../SingleTM/LeeRouting/LeeThread.java | 1 - .../Benchmarks/SingleTM/LeeRouting/makefile | 2 +- .../MatrixMultiply/MatrixMultiplyN.java | 146 ++++++++++++++++++ .../SingleTM/MatrixMultiply/makefile | 9 ++ 5 files changed, 161 insertions(+), 5 deletions(-) create mode 100644 Robust/src/Benchmarks/SingleTM/MatrixMultiply/MatrixMultiplyN.java create mode 100644 Robust/src/Benchmarks/SingleTM/MatrixMultiply/makefile diff --git a/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeRouter.java b/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeRouter.java index a946f617..e0142240 100644 --- a/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeRouter.java +++ b/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeRouter.java @@ -508,9 +508,10 @@ public class LeeRouter { tempg[tempX][tempY][tempZ] = viat; grid.setPoint(tempX,tempY,tempZ,viat); if(DEBUG)grid.setDebugPoint(tempX,tempY,tempZ,trackNo); - num_vias++; - if (!advanced) - forced_vias++; + //XXXXXXX- changes to make transactional + // num_vias++; + //if (!advanced) + // forced_vias++; if (advanced) if(DEBUG) System.out.println("Via " + distsofar + " " @@ -574,6 +575,7 @@ public class LeeRouter { else { if(DEBUG) System.out.println("Failed to route " + xs + " " + ys + " to " + xg + " " + yg); + System.out.println("Failure"); failures++; } return found; diff --git a/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeThread.java b/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeThread.java index 96d6e0e8..b7f74d00 100644 --- a/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeThread.java +++ b/Robust/src/Benchmarks/SingleTM/LeeRouting/LeeThread.java @@ -77,7 +77,6 @@ public class LeeThread extends Thread { public void run() { int [][][] tempg = scratch new int[lt.GRID_SIZE][lt.GRID_SIZE][2]; // Lee 2D Grid copy - while (!finished && !stop) { if(sampleNow) { //collectMyStatistics(); diff --git a/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile b/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile index 670e5c9f..45aa60e9 100644 --- a/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile +++ b/Robust/src/Benchmarks/SingleTM/LeeRouting/makefile @@ -5,7 +5,7 @@ SRC=${MAINCLASS}.java \ GridCell.java \ LeeThread.java \ WorkQueue.java -FLAGS=-mainclass ${MAINCLASS} -joptimize -debug -singleTM -optimize -dcopts -abcclose -transstats -profile +FLAGS=-mainclass ${MAINCLASS} -joptimize -debug -singleTM -optimize -dcopts -transstats -abcclose -stmdebug default: ../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC} diff --git a/Robust/src/Benchmarks/SingleTM/MatrixMultiply/MatrixMultiplyN.java b/Robust/src/Benchmarks/SingleTM/MatrixMultiply/MatrixMultiplyN.java new file mode 100644 index 00000000..5438be03 --- /dev/null +++ b/Robust/src/Benchmarks/SingleTM/MatrixMultiply/MatrixMultiplyN.java @@ -0,0 +1,146 @@ +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; + this.y0 = y0; + this.x1 = x1; + this.y1 = y1; + } + + public void run() { + atomic { + int M=mmul.M; + int l=8; + //Use btranspose for cache performance + for(int i = x0; i< x1; i++,l++){ + for (int j = y0; j < y1; j++) { + double innerProduct=0; + for(int k = 0; k < M; k++) { + innerProduct += mmul.a[i][k] *mmul.btranspose[j][k]; + } + mmul.c[i][j]=innerProduct; + } + } + } + } + + public static void main(String[] args) { + int NUM_THREADS = 4; + int SIZE=600; + if (args.length>0) { + NUM_THREADS=Integer.parseInt(args[0]); + if (args.length>1) + SIZE=Integer.parseInt(args[1]); + } + + int p, q, r; + MatrixMultiply[] mm; + MatrixMultiply tmp; + MMul matrix; + + matrix = new MMul(SIZE, SIZE, SIZE); + matrix.setValues(); + matrix.transpose(); + mm = new MatrixMultiply[NUM_THREADS]; + int increment=SIZE/NUM_THREADS; + int base=0; + for(int i=0;i