changed fillTable() to static method
authoradash <adash>
Mon, 14 Apr 2008 21:27:28 +0000 (21:27 +0000)
committeradash <adash>
Mon, 14 Apr 2008 21:27:28 +0000 (21:27 +0000)
Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node.java
Robust/src/Benchmarks/Prefetch/Em3d/java/Barrier.java
Robust/src/Benchmarks/Prefetch/Em3d/java/BiGraph.java
Robust/src/Benchmarks/Prefetch/Em3d/java/Em3d.java
Robust/src/Benchmarks/Prefetch/Em3d/java/Node.java

index 40ef25158f5bbd76376935c0661c11c2d4ce12a8..80099b92443063e92aaeb7daff4fd05e49425bbb 100644 (file)
@@ -38,14 +38,13 @@ public class BiGraph
 
   BiGraph create(int numNodes, int numDegree, boolean verbose, Random r)
   {
-    Node newnode = global new Node();
 
     // making nodes (we create a table)
     //if (verbose) System.printString("making nodes (tables in orig. version)");
     Node[] hTable = global new Node[numNodes];
     Node[] eTable = global new Node[numNodes];
-    hTable = newnode.fillTable(numNodes, numDegree, r);
-    eTable = newnode.fillTable(numNodes, numDegree, r);
+    hTable = Node.fillTable(numNodes, numDegree, r);
+    eTable = Node.fillTable(numNodes, numDegree, r);
 
     // making neighbors
     //if (verbose) System.printString("updating from and coeffs");
index 33e72ff44468c97936b98c59ec820e1574277ced..7e2e23e2758e48bb2c2b8d020d668100c6d60ca5 100644 (file)
@@ -60,15 +60,12 @@ public class Em3d extends Thread
 
   public void run() {
     int iteration;
-    int b;
 
     atomic {
       iteration = numIter;
-      b = mybarr.numthreads;
     }
 
     for (int i = 0; i < iteration; i++) {
-      Barrier runBarrier = new Barrier();
       /* for  eNodes */
       atomic {
         Node prev, curr;
@@ -85,7 +82,7 @@ public class Em3d extends Thread
           }
           curr = curr.next;
         }
-        runBarrier.enterBarrier(mybarr);
+        Barrier.enterBarrier(mybarr);
       }
 
       /* for  hNodes */
@@ -104,7 +101,7 @@ public class Em3d extends Thread
           }
           curr = curr.next;
         }
-        runBarrier.enterBarrier(mybarr);
+        Barrier.enterBarrier(mybarr);
       }
     }
   }
index 1284b7fd45e321847f099318ce27843bcac32407..02d7941a11d885065cbf7d9f0ed6e96b0d074db1 100644 (file)
@@ -63,7 +63,7 @@ public class Node {
      * @param degree the out degree of each node
      * @return a table containing all the nodes.
      **/
-    public Node[] fillTable(int size, int degree, Random r)
+    public static Node[] fillTable(int size, int degree, Random r)
     {
         Node[] table = global new Node[size];
 
index 47f40620484b1151da3f455b6d203ccbad968870..590b3a66519ec13da8cff618fd9cbfd4cee61545 100644 (file)
@@ -21,15 +21,13 @@ public class Barrier {
     int tmp;
     boolean retry=true;
 
-    if (b.numthreads == 1) 
-      return;
-
     do {
       if (!b.cleared) {
         b.entercount++;
         tmp = b.entercount;
         if (tmp==b.numthreads) {
-          b.cleared=true;
+          if(b.numthreads > 1)
+            b.cleared=true;
           b.entercount--;
           return;
         }
index a8a81070ee5ced62df015110b5e98fdc19074fbc..20ba94a3c70af66d09424d069d9c142569d379bc 100644 (file)
@@ -39,12 +39,10 @@ public class BiGraph
 
   BiGraph create(int numNodes, int numDegree, boolean verbose, Random r)
   {
-    Node newnode = new Node();
-
     // making nodes (we create a table)
     if (verbose) System.out.println("making nodes (tables in orig. version)");
-    Node[] hTable = newnode.fillTable(numNodes, numDegree, r);
-    Node[] eTable = newnode.fillTable(numNodes, numDegree, r);
+    Node[] hTable = Node.fillTable(numNodes, numDegree, r);
+    Node[] eTable = Node.fillTable(numNodes, numDegree, r);
 
     // making neighbors
     if (verbose) System.out.println("updating from and coeffs");
index 8ca449d1d0916226a8ac366224e8fefc625cf726..8021a83068043218ef892018e104b84dc276df0a 100644 (file)
@@ -43,7 +43,6 @@ public class Em3d extends Thread
 
     public void run() {
         for (int i = 0; i < numIter; i++) {
-            Barrier runBarrier = new Barrier();
             /* for  eNodes */
             Node prev = bg.eNodes;
             Node curr = null;
@@ -58,8 +57,7 @@ public class Em3d extends Thread
                 }
                 curr = curr.next;
             }
-            runBarrier.enterBarrier(mybarr);
-            //mybarr.reset();
+            Barrier.enterBarrier(mybarr);
 
             /* for  hNodes */
             prev = bg.hNodes;
@@ -75,8 +73,7 @@ public class Em3d extends Thread
                 }
                 curr = curr.next;
             }
-            runBarrier.enterBarrier(mybarr);
-            //mybarr.reset();
+            Barrier.enterBarrier(mybarr);
         }
     }
         
@@ -118,7 +115,6 @@ public class Em3d extends Thread
         BiGraph graph1 = new BiGraph();
         int num_threads = 2;
         Barrier mybarr = new Barrier(num_threads);
-        System.out.println("DEBUG -> num_threads = " + num_threads);
         BiGraph graph = graph1.create(em.numNodes, em.numDegree, em.printResult, rand);
         
         long end0 = System.currentTimeMillis();
index 24201df675ca7fb9963f218936c84c5d5717ac1f..abf7e5e16d945e4a52fecad6b9530d254b93a560 100644 (file)
@@ -66,7 +66,7 @@ public class Node {
      * @param degree the out degree of each node
      * @return a table containing all the nodes.
      **/
-    public Node[] fillTable(int size, int degree, Random r)
+    public static Node[] fillTable(int size, int degree, Random r)
     {
         Node[] table = new Node[size];