changes to benchmark
authoradash <adash>
Mon, 28 Sep 2009 23:04:44 +0000 (23:04 +0000)
committeradash <adash>
Mon, 28 Sep 2009 23:04:44 +0000 (23:04 +0000)
Robust/src/Benchmarks/Distributed/RainForest/dsm/makefile
Robust/src/Benchmarks/Distributed/RainForest/java/RainForestClient.java
Robust/src/Benchmarks/Distributed/RainForest/java/RainForestServerExample.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile
Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile
Robust/src/Benchmarks/Prefetch/SOR/javasingle/JGFSORBench.java
Robust/src/Benchmarks/Prefetch/SOR/javasingle/SORRunner.java
Robust/src/Benchmarks/Prefetch/SOR/javasingle/makefile
Robust/src/Benchmarks/Prefetch/Tree/Tree.java
Robust/src/Benchmarks/Prefetch/Tree/makefile

index df0290dc57f2fef5cd5f85b570130a4d2aedcbb9..3df2a7976a34beb23c1ac2d9076e959cc899112c 100644 (file)
@@ -11,8 +11,8 @@ SRC=tmp${MAINCLASS}.java \
        AStarPathFinder.java 
 
 FLAGS1=-dsm -optimize -mainclass ${MAINCLASS}
-FLAGS2=-dsm -dsmcaching -transstats -abortreaders -optimize -mainclass ${MAINCLASS}
-FLAGS3=-dsm -dsmcaching -transstats -abortreaders -prefetch -optimize -mainclass ${MAINCLASS} -excprefetch BarrierServer.updateAge -excprefetch RainForest.main -excprefetch GameMap.hasRock -excprefetch GameMap.hasTree -trueprob 0.90
+FLAGS2=-dsm -dsmcaching -abortreaders -optimize -mainclass ${MAINCLASS}
+FLAGS3=-dsm -dsmcaching -abortreaders -prefetch -optimize -mainclass ${MAINCLASS} -excprefetch BarrierServer.updateAge -excprefetch RainForest.main -excprefetch GameMap.hasRock -excprefetch GameMap.hasTree -trueprob 0.90
 
 default:
        cpp ${MAINCLASS}.java > tmp1${MAINCLASS}.java
index 9005176c539149283973555bd75cedbadad0c10f..8d92eb61f318ef431aea98f35399c87709d329dd 100644 (file)
@@ -1,6 +1,6 @@
-#define ROW                 100  /* columns in the map */
+#define ROW                 400  /* columns in the map */
 #define COLUMN              100  /* rows of in the map */
-#define ROUNDS              256   /* Number of moves by each player */
+#define ROUNDS              512   /* Number of moves by each player */
 #define PLAYERS             20   /* Number of Players when num Players != num of client machines */
 #define RATI0               0.5  /* Number of lumberjacks to number of planters */
 #define BLOCK               3    /* Area around the gamer to consider */
index 8f9d3f56385196571adc371900a43c815879b337..efdf54c3556034e6f9115b1a13f186ba01a390cd 100644 (file)
@@ -1,4 +1,4 @@
-#define ROW                 100  /* columns in the map */
+#define ROW                 400  /* columns in the map */
 #define COLUMN              100  /* rows of in the map */
 
 public class RainForestServerExample {
index f7c448f531d9849354bfd5ab2a5b3a891e90c940..4580b2ee5a39d5abb60e87629c3035ec20f6f9d1 100644 (file)
@@ -11,10 +11,11 @@ SRC3=${MAINCLASS}2.java \
        ${MAINCLASS}Wrap.java \
        BiGraph2.java \
        Node2.java \
-       EVector.java 
+       EVector.java \
+    ../../../../ClassLibrary/JavaDSM/Barrier.java
 
 FLAGS=-dsm -prefetch -optimize -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -debug -mainclass ${MAINCLASS} -trueprob 0.85
-FLAGS1=-dsm -prefetch -dsmcaching -optimize -excprefetch Node.makeUniqueNeighbors -excprefetch EVector.ensureCapacity -excprefetch EVector.addElement -excprefetch BiGraph.makeFromNodes -excprefetch EVector.elementAt -excprefetch BiGraph.initializeNodes -excprefetch BiGraph.allocateNodes -mainclass ${MAINCLASS} -trueprob 0.85
+FLAGS1=-dsm -prefetch -transstats -dsmcaching -optimize -excprefetch Node.makeUniqueNeighbors -excprefetch EVector.ensureCapacity -excprefetch EVector.addElement -excprefetch BiGraph.makeFromNodes -excprefetch EVector.elementAt -excprefetch BiGraph.initializeNodes -excprefetch BiGraph.allocateNodes -mainclass ${MAINCLASS} -trueprob 0.85
 FLAGS2=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.85
 FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} -trueprob 0.85
 
index 73d177867b3dd2bb920ad9b247cfb9d3e5cdf50a..3a312d8b42a93f232adca469ae2046cf97dcccef 100644 (file)
@@ -17,15 +17,15 @@ SRC1=${MAINCLASS1}.java \
        SORWrap.java \
     ../../../../ClassLibrary/JavaDSM/Barrier.java
 
-FLAGS=-dsm -prefetch -transstats -dsmcaching -optimize -excprefetch JGFSORBench.JGFSORBench -excprefetch JGFSORBenchSizeA.main -excprefetch JGFSORBench.RandomMatrix -excprefetch JGFSORBench.init_sync -excprefetch JGFSORBench.JGFkernel -trueprob 0.72
-FLAGS1=-dsm -dsmcaching -optimize -debug -mainclass ${MAINCLASS} 
+FLAGS=-dsm -prefetch -dsmcaching -optimize -excprefetch JGFSORBench.JGFSORBench -excprefetch JGFSORBenchSizeA.main -excprefetch JGFSORBench.RandomMatrix -excprefetch JGFSORBench.init_sync -excprefetch JGFSORBench.JGFkernel -trueprob 0.72
+FLAGS1=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} 
 FLAGS2=-dsm -optimize
 
 default:
        ../../../../buildscript ${FLAGS2} -mainclass ${MAINCLASS} -o ${MAINCLASS}NPNC ${SRC}
        ../../../../buildscript ${FLAGS} -mainclass ${MAINCLASS} -o ${MAINCLASS}N  ${SRC}
-       ../../../../buildscript ${FLAGS2} -mainclass ${MAINCLASS1} -o ${MAINCLASS1}NPNC ${SRC1}
-       ../../../../buildscript ${FLAGS} -mainclass ${MAINCLASS1} -o ${MAINCLASS1}N  ${SRC1}
+#      ../../../../buildscript ${FLAGS2} -mainclass ${MAINCLASS1} -o ${MAINCLASS1}NPNC ${SRC1}
+#      ../../../../buildscript ${FLAGS} -mainclass ${MAINCLASS1} -o ${MAINCLASS1}N  ${SRC1}
 
 clean:
        rm -rf tmpbuilddirectory
index 3b22060da56c7d0f3ab5e9324c11b0f866151ef2..325baefbd3843b1c2e73e02b6da549adc916d9c2 100644 (file)
@@ -17,9 +17,6 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-
-import java.util.Random;
-
 public class JGFSORBench { 
 
   int size; 
@@ -27,16 +24,10 @@ public class JGFSORBench {
   int JACOBI_NUM_ITER;
   long RANDOM_SEED;
   public int nthreads;
-  Random R;
   public double Gtotal;
-  public int cachelinesize;
-  public long sync[][];
 
-  public JGFInstrumentor instr;
-
-  public JGFSORBench(int nthreads, JGFInstrumentor instr){
+  public JGFSORBench(int nthreads){
     this.nthreads = nthreads;
-    this.instr = instr;
     datasizes = new int[4];
     datasizes[0] = 1000;
     datasizes[1] = 1500;
@@ -44,120 +35,65 @@ public class JGFSORBench {
     datasizes[3] = 8000;
     JACOBI_NUM_ITER = 100;
     RANDOM_SEED = 10101010;
-    R = new Random(RANDOM_SEED);
     Gtotal = 0.0;
-    cachelinesize = 128;
   }
 
   public void JGFsetsize(int size){
     this.size = size;
   }
 
-  public static void JGFkernel(JGFSORBench sor, JGFInstrumentor instr) {
-    int numthreads;
-    numthreads = sor.nthreads;
+  public static void JGFkernel(JGFSORBench sor) {
+    int numthreads, datasize;
 
-    double G[][] = sor.RandomMatrix(sor.datasizes[sor.size], sor.datasizes[sor.size], sor.R);
-    int M = G.length;
-    int N = G[0].length;
-    double omega = 1.25;
-    int num_iterations = sor.JACOBI_NUM_ITER;
+    double[][] G;
+    int num_iterations;
 
+    numthreads = sor.nthreads;
+    datasize = sor.datasizes[sor.size];
+    G =  new double[datasize][];
+    num_iterations = sor.JACOBI_NUM_ITER;
 
+    double omega = 1.25;
     double omega_over_four = omega * 0.25;
     double one_minus_omega = 1.0 - omega;
 
     // update interior points
     //
-    int Mm1 = M-1;
-    int Nm1 = N-1;
-
     //spawn threads
-    int cachelinesize = sor.cachelinesize;
 
-    SORRunner thobjects[] = new SORRunner[numthreads];
-    sor.sync = sor.init_sync(numthreads, cachelinesize);
+    SORWrap[] thobjects = new SORWrap[numthreads];
 
-    JGFInstrumentor.startTimer("Section2:SOR:Kernel", instr.timers); 
+       for(int i=0;i<numthreads;i++) {
+           thobjects[i] =  new SORWrap( new SORRunner(i,omega,G,num_iterations,numthreads));
+       }
 
-    for(int i=1;i<numthreads;i++) {
-      thobjects[i] = new SORRunner(i,omega,G,num_iterations,sor.sync,numthreads);
-      thobjects[i].start();
+    for(int i=0;i<numthreads;i++) {
+      thobjects[i].sor.run();
     }
 
-    thobjects[0] = new SORRunner(0,omega,G,num_iterations,sor.sync,numthreads);
-    thobjects[0].start();
-    thobjects[0].join();
-
-
-    for(int i=1;i<numthreads;i++) {
-        thobjects[i].join();
-    }
-
-    JGFInstrumentor.stopTimer("Section2:SOR:Kernel", instr.timers);
-
-    for (int i=1; i<Nm1; i++) {
-      for (int j=1; j<Nm1; j++) {
-        sor.Gtotal += G[i][j];
-      }
-    }               
-
-  }
-
-  private long[][] init_sync(int nthreads, int cachelinesize) {
-    long sync[][] = new long [nthreads][cachelinesize];
-    for (int i = 0; i<nthreads; i++)
-      sync[i][0] = 0;
-    return sync;
+    //JGFInstrumentor.stopTimer("Section2:SOR:Kernel", instr.timers);
+       for (int i=1; i<G.length-1; i++) {
+           for (int j=1; j<G.length-1; j++) {
+               sor.Gtotal += G[i][j];
+           }
+       }               
   }
 
-  public void JGFvalidate(){
-
-      double refval[]=new double[3];
-      refval[0]=0.498574406322512;
-      refval[1]=1.1234778980135105;
-      refval[2]=1.9954895063582696;
-      double dev = Math.abs(Gtotal - refval[size]);
-      if (dev > 1.0e-12 ){
-         System.printString("Validation failed");
-         System.printString("Gtotal = " + Gtotal + "  " + dev + "  " + size);
-      }
-  }
-
-  /*
-     public void JGFtidyup(){
-     System.gc();
-     }  
-
-     public void JGFrun(int size){
-
-
-     JGFInstrumentor.addTimer("Section2:SOR:Kernel", "Iterations",size);
-
-     JGFsetsize(size); 
-     JGFinitialise(); 
-     JGFkernel(); 
-     JGFvalidate(); 
-     JGFtidyup(); 
-
-
-     JGFInstrumentor.addOpsToTimer("Section2:SOR:Kernel", (double) (JACOBI_NUM_ITER));
-
-     JGFInstrumentor.printTimer("Section2:SOR:Kernel"); 
-     }
-     */
-
-  public double[][] RandomMatrix(int M, int N, Random R)
-  {
-    double A[][] = new double[M][N];
-
-    for (int i=0; i<N; i++)
-      for (int j=0; j<N; j++)
-      {
-        A[i][j] = R.nextDouble() * 1e-6;
-      }      
-    return A;
+  public int JGFvalidate(){
+
+    double refval[];
+    refval = new double[4];
+    refval[0] = 0.498574406322512;
+    refval[1] = 1.1234778980135105;
+    refval[2] = 1.9954895063582696;
+    refval[3] = 2.654895063582696;
+    double dev = Math.fabs(Gtotal - refval[size]);
+    long l = (long) refval[size] * 1000000;
+    long r = (long) Gtotal * 1000000;
+    if (l != r ){
+      return 1;
+    } else {
+      return 0;
+    }
   }
-
-
 }
index cc3242bb7be2a55cbe0a463926830fc2f54895d7..94d72e50b7ca7cd06bbac72718747b1ec36e5879 100644 (file)
@@ -1,66 +1,80 @@
 /**************************************************************************
-*                                                                         *
-*         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
-*                                                                         *
-*                            produced by                                  *
-*                                                                         *
-*                  Java Grande Benchmarking Project                       *
-*                                                                         *
-*                                at                                       *
-*                                                                         *
-*                Edinburgh Parallel Computing Centre                      *
-*                                                                         *
-*                email: epcc-javagrande@epcc.ed.ac.uk                     *
-*                                                                         *
-*      adapted from SciMark 2.0, author Roldan Pozo (pozo@cam.nist.gov)   *
-*                                                                         *
-*      This version copyright (c) The University of Edinburgh, 2001.      *
-*                         All rights reserved.                            *
-*                                                                         *
-**************************************************************************/
+ *                                                                         *
+ *         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
+ *                                                                         *
+ *                            produced by                                  *
+ *                                                                         *
+ *                  Java Grande Benchmarking Project                       *
+ *                                                                         *
+ *                                at                                       *
+ *                                                                         *
+ *                Edinburgh Parallel Computing Centre                      *
+ *                                                                         *
+ *                email: epcc-javagrande@epcc.ed.ac.uk                     *
+ *                                                                         *
+ *      adapted from SciMark 2.0, author Roldan Pozo (pozo@cam.nist.gov)   *
+ *                                                                         *
+ *      This version copyright (c) The University of Edinburgh, 2001.      *
+ *                         All rights reserved.                            *
+ *                                                                         *
+ **************************************************************************/
 
 class SORRunner extends Thread {
 
-  int id,num_iterations;
+  int id, num_iterations;
   double G[][],omega;
-  long sync[][];
   int nthreads;
 
-  public SORRunner(int id, double omega, double G[][], int num_iterations,long[][] sync, int nthreads) {
+  public SORRunner(int id, double omega, double G[][], int num_iterations, int nthreads) {
     this.id = id;
     this.omega=omega;
     this.G=G;
     this.num_iterations=num_iterations;
-    this.sync=sync;
     this.nthreads = nthreads;
   }
 
   public void run() {
+    int tmpid, M, N, numthreads;
+    double omega_over_four, one_minus_omega;
+    int numiterations;
+    int ilow, iupper, slice, tslice, ttslice, Mm1, Nm1;
+
+    N = M = G.length;
+
+    omega_over_four = omega * 0.25;
+    one_minus_omega = 1.0 - omega;
+    numthreads = nthreads;
+    tmpid = id;
+    numiterations = num_iterations;
+    Mm1 = M-1;
+    Nm1 = N-1;
+    tslice = (Mm1) / 2;
+    ttslice = (tslice + numthreads-1)/numthreads;
+    slice = ttslice*2;
+    ilow=tmpid*slice+1;
+    iupper = ((tmpid+1)*slice)+1;
+    if (iupper > Mm1) iupper =  Mm1+1;
+    if (tmpid == (numthreads-1)) iupper = Mm1+1;
+    G[0]= new double[N];
+    for(int i=ilow;i<iupper;i++) {
+      G[i]= new double[N];
+    }
 
-    int M = G.length;
-    int N = G[0].length;
-
-    double omega_over_four = omega * 0.25;
-    double one_minus_omega = 1.0 - omega;
+    Random rand=new Random();
+    double[] R = G[0];
+    for(int j=0;j<M;j++)
+      R[j]=rand.nextDouble() * 1e-6;
+    for(int i=ilow;i<iupper;i++) {
+      R=G[i];
+      for(int j=0;j<M;j++)
+        R[j]=rand.nextDouble() * 1e-6;
+    }
 
     // update interior points
     //
-    int Mm1 = M-1;
-    int Nm1 = N-1;
-
-
-    int ilow, iupper, slice, tslice, ttslice;
-
-    tslice = (Mm1) / 2;
-    ttslice = (tslice + nthreads-1)/nthreads;
-    slice = ttslice*2;
 
-    ilow=id*slice+1;
-    iupper = ((id+1)*slice)+1;
-    if (iupper > Mm1) iupper =  Mm1+1;
-    if (id == (nthreads-1)) iupper = Mm1+1;
 
-    for (int p=0; p<2*num_iterations; p++) {
+    for (int p=0; p<2*numiterations; p++) {
       for (int i=ilow+(p%2); i<iupper; i=i+2) {
 
         double [] Gi = G[i];
@@ -76,6 +90,26 @@ class SORRunner extends Thread {
           }
         } else if (i == Mm1) {
 
+        } else {
+
+          double [] Gip1 = G[i+1];
+
+          for (int j=1; j<Nm1; j=j+2){
+            Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
+                + Gi[j+1]) + one_minus_omega * Gi[j];
+
+          }
+        }
+      }
+
+      for (int i=ilow+(p%2); i<iupper; i=i+2) {
+
+        double [] Gi = G[i];
+        double [] Gim1 = G[i-1];
+
+        if(i == 1) { 
+        } else if (i == Mm1) {
+
           double [] Gim2 = G[i-2];
 
           for (int j=1; j<Nm1; j=j+2){
@@ -87,33 +121,17 @@ class SORRunner extends Thread {
 
         } else {
 
-          double [] Gip1 = G[i+1];
           double [] Gim2 = G[i-2];
 
           for (int j=1; j<Nm1; j=j+2){
-            Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
-                + Gi[j+1]) + one_minus_omega * Gi[j];
-
             if((j+1) != Nm1) {
               Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
                   + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
             }
           }
         }
-
-      }
-
-      // Signal this thread has done iteration
-      sync[id][0]++;
-
-      // Wait for neighbours;
-      if (id > 0) {
-        while (sync[id-1][0] < sync[id][0]) ;
-      }
-      if (id < nthreads -1) {
-        while (sync[id+1][0] < sync[id][0]) ;
       }
-    }
 
-  }
+    }//end of for
+  } //end of run()
 }
index 733713a221d07a5a289f596da4ecd3acf730be00..338da540ac6101f2098bf2669a4eeaa62bf3827b 100644 (file)
@@ -16,7 +16,7 @@ FLAGS2=-thread -optimize -mainclass ${MAINCLASS2} -o ${MAINCLASS2}
 FLAGS=-thread -optimize -mainclass ${MAINCLASS} -o ${MAINCLASS}
 
 default:
-       ../../../../buildscript ${FLAGS} ${SRC1}
+#      ../../../../buildscript ${FLAGS} ${SRC1}
        ../../../../buildscript ${FLAGS2} ${SRC2}
 
 clean:
index 91a65657c19c214a35a820d12b2a69c4cb915ce4..0f2cfbd1a2e5a0d7736cd991f16d94ab991a26dd 100644 (file)
@@ -11,8 +11,8 @@ public class TreeT extends Thread {
     TreeT t;
     atomic {
       t=global new TreeT();
-      t.numTrees=5000;
-      t.TreeDepth=10;
+      t.numTrees=20000;
+      t.TreeDepth=5;
     }
        t.start((128<<24)|(195<<16)|(136<<8)|162);
        t.join();
@@ -27,11 +27,29 @@ public class TreeT extends Thread {
       tt = global new Tree[numTrees];
       for(int i =0; i<numTrees; i++) {
         tt[i] = global new Tree(TreeDepth); 
-        tt[i].Populate(tt[i].root);
+        int depth = tt[i].iDepth;
+        tt[i].Populate(tt[i].root, depth);
       }
     }
   }
 
+  public void exec() {
+    Random r = new Random(241);
+    for (int i=0; i <numTrees; i++) {
+      Node n = tt[i].root;
+      while (n != null) {
+        int choice = r.nextInt(2);
+        if (choice == 0) {
+          //System.out.println("i= " + i + " n.data= " +n.element);
+          n = n.left;
+        } else {
+          //System.out.println("i= " + i + " n.data= " +n.element);
+          n = n.right;
+        }
+      }
+    }
+  }
+  /*
   public void exec() {
     Random r = new Random(241);
     for(int i=0; i<numTrees; i++) {
@@ -46,6 +64,7 @@ public class TreeT extends Thread {
       }
     }
   }
+    */
 }
 
 class Tree {
@@ -63,25 +82,23 @@ class Tree {
   }
 
   // Build tree top down, assigning to older objects.
-  public void Populate(Node n) {
+  public void Populate(Node n, int depth) {
     Random r = new Random(0);
     //pick a random seed
-    if (iDepth<=0) {
+    if (depth<=0) {
       return;
     } else {
-      iDepth--;
+      depth--;
       //n.left = global new Node(r.nextInt(100));
       //n.right = global new Node(r.nextInt(100));
-      n.left = global new Node(iDepth);
+      n.left = global new Node(depth);
       n.left.parent = n;
-      n.right = global new Node(iDepth+100);
+      n.right = global new Node(depth+100);
       n.right.parent = n;
-      this.Populate(n.left);
-      this.Populate(n.right);
+      Populate(n.left, depth);
+      Populate(n.right, depth);
     }
   }
-
-  
 }
 
 // Basic node stored in unbalanced binary search trees
index 2e8a9e1573df94a3dc15845a632d5d03309990b9..096d211b4482ce97e3c6a32c53f7729d181120ff 100644 (file)
@@ -1,6 +1,6 @@
 MAINCLASS=TreeT
 SRC1=Tree.java
-FLAGS=-dsm -transstats -debug -prefetch -dsmcaching -optimize -excprefetch Tree.Populate -excprefetch Node.Inorder -excprefetch Node.Postorder -excprefetch TreeT.run -excprefetch TreeT.main -mainclass ${MAINCLASS} -trueprob 0.90
+FLAGS=-dsm -prefetch -dsmcaching -optimize -excprefetch Tree.Populate -excprefetch Node.Inorder -excprefetch Node.Postorder -excprefetch TreeT.run -excprefetch TreeT.main -mainclass ${MAINCLASS} -trueprob 0.98
 FLAGS1=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.98
 FLAGS2=-dsm -optimize -mainclass ${MAINCLASS}
 default: