compile error fixes
authoradash <adash>
Mon, 14 Apr 2008 17:57:14 +0000 (17:57 +0000)
committeradash <adash>
Mon, 14 Apr 2008 17:57:14 +0000 (17:57 +0000)
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Barrier.java
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

index 2f0f05dde4d3fcb4f7dabd5fac8b0baa2ad1bc1c..482b695aed817e75f39d8229b4ca075bf0bdd922 100644 (file)
@@ -21,16 +21,14 @@ public class Barrier {
     int tmp;
     boolean retry=true;
 
-    if(b.numthreads == 1)
-      return;
-
     do {
       atomic {
         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 f952f7e27b51eec047f33fd975650ff207ef8eff..40ef25158f5bbd76376935c0661c11c2d4ce12a8 100644 (file)
@@ -38,12 +38,14 @@ public class BiGraph
 
   BiGraph create(int numNodes, int numDegree, boolean verbose, Random r)
   {
-    Node newnode = new Node();
+    Node newnode = global new Node();
 
     // making nodes (we create a table)
     //if (verbose) System.printString("making nodes (tables in orig. version)");
-    Node[] hTable = newnode.fillTable(numNodes, numDegree, r);
-    Node[] eTable = newnode.fillTable(numNodes, numDegree, r);
+    Node[] hTable = global new Node[numNodes];
+    Node[] eTable = global new Node[numNodes];
+    hTable = newnode.fillTable(numNodes, numDegree, r);
+    eTable = newnode.fillTable(numNodes, numDegree, r);
 
     // making neighbors
     //if (verbose) System.printString("updating from and coeffs");
@@ -79,7 +81,7 @@ public class BiGraph
       n.updateFromNodes(r);
     }
 
-    BiGraph g = new BiGraph(eTable[0], hTable[0]);
+    BiGraph g = global new BiGraph(eTable[0], hTable[0]);
     return g;
   }
 
index 28ffe641750bfb5e8db2dde1ed832815244cf1f7..33e72ff44468c97936b98c59ec820e1574277ced 100644 (file)
@@ -40,7 +40,6 @@ public class Em3d extends Thread
   BiGraph bg;
   int upperlimit;
   int lowerlimit;
-  //Random rand;
   Barrier mybarr;
 
   public Em3d() {
@@ -61,15 +60,18 @@ 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 */
-      Node prev, curr;
       atomic {
+        Node prev, curr;
         prev = bg.eNodes;
         curr = null;
         for(int j = 0; j<lowerlimit; j++){
@@ -84,11 +86,11 @@ public class Em3d extends Thread
           curr = curr.next;
         }
         runBarrier.enterBarrier(mybarr);
-        //mybarr.reset();
       }
 
       /* for  hNodes */
       atomic {
+        Node prev, curr;
         prev = bg.hNodes;
         curr = null;
         for(int j = 0; j<lowerlimit; j++){
@@ -103,7 +105,6 @@ public class Em3d extends Thread
           curr = curr.next;
         }
         runBarrier.enterBarrier(mybarr);
-        //mybarr.reset();
       }
     }
   }
@@ -116,7 +117,6 @@ public class Em3d extends Thread
    **/
   public static void main(String args[])
   {
-    Random rand = new Random(783);
     Em3d em;
     atomic {
       em = global new Em3d();
@@ -140,6 +140,10 @@ public class Em3d extends Thread
     }
     BiGraph graph;
     BiGraph graph1;
+    Random rand;
+    atomic {
+      rand = global new Random(783);
+    }
     atomic {
       graph1 = global new BiGraph();
       graph = global new BiGraph();
index 6c5095b5ca0c7670dc5a9ceee50f24f052a33c5f..1284b7fd45e321847f099318ce27843bcac32407 100644 (file)
@@ -45,7 +45,7 @@ public class Node {
     {
         value = r.nextDouble();
         // create empty array for holding toNodes
-        toNodes = new Node[degree];
+        toNodes = global new Node[degree];
 
         next = null;
         for (int i = 0; i<fromCount; i++) {
@@ -65,12 +65,12 @@ public class Node {
      **/
     public Node[] fillTable(int size, int degree, Random r)
     {
-        Node[] table = new Node[size];
+        Node[] table = global new Node[size];
 
-        Node prevNode = new Node(degree, r);
+        Node prevNode = global new Node(degree, r);
         table[0] = prevNode;
         for (int i = 1; i < size; i++) {
-            Node curNode = new Node(degree, r);
+            Node curNode = global new Node(degree, r);
             table[i] = curNode;
             prevNode.next = curNode;
             prevNode = curNode;
@@ -102,7 +102,7 @@ public class Node {
                 // find a node with the random index in the given table
                 otherNode = nodeTable[index];
 
-                for (k = 0; (k < filled) && (!isBreak); k++) {
+                for (k = 0; (k < filled) && (isBreak==false); k++) {
                     if (otherNode == toNodes[filled]) 
                         isBreak = true;
                         //break;
@@ -117,41 +117,6 @@ public class Node {
         }
     }
 
-    /*
-    public void makeUniqueNeighborsThread(Node[] nodeTable, Random rand, int l, int u)
-    {
-        for (int filled = 0; filled < toNodes.length; filled++) {
-            int k;
-            Node otherNode;
-            boolean isBreak;
-
-            do {
-                isBreak = false;
-                // generate a random number in the correct range
-                int index = rand.nextInt();
-                if (index < 0) index = -index;
-                index = index % nodeTable.length;
-
-                // find a node with the random index in the given table
-                otherNode = nodeTable[index];
-
-                for (k = 0; (k < filled) && (!isBreak); k++) {
-                    if (otherNode == toNodes[filled]) 
-                        isBreak = true;
-                        //break;
-                }
-            } while (k < filled);
-
-            // other node is definitely unique among "filled" toNodes
-            toNodes[filled] = otherNode;
-
-            // update fromCount for the other node
-            otherNode.fromCount++;
-        }
-    }
-    */
-
-
     /** 
      * Allocate the right number of FromNodes for this node. This
      * step can only happen once we know the right number of from nodes
@@ -161,8 +126,8 @@ public class Node {
      **/
     public void makeFromNodes()
     {
-        fromNodes = new Node[fromCount]; // nodes fill be filled in later
-        coeffs = new double[fromCount];
+        fromNodes = global new Node[fromCount]; // nodes fill be filled in later
+        coeffs = global new double[fromCount];
     }
 
     /**
@@ -183,18 +148,8 @@ public class Node {
      * Get the new value of the current node based on its neighboring
      * from_nodes and coefficients.
      **/
-    /*
-    public void run() {
-        Node tmp = this;
-        while(tmp!= null) {
-            Node n = tmp;
-            for (int i = 0; i < n.fromCount; i++) {
-                n.value -= n.coeffs[i] * n.fromNodes[i].value;
-            }
-            tmp = tmp.next;
-        }
-    }
 
+    /*
     public void computeNewValue()
     {
         for (int i = 0; i < fromCount; i++) {
index 732c00514bf070452b1ff90f8b160ba9df5d769a..47f40620484b1151da3f455b6d203ccbad968870 100644 (file)
@@ -25,7 +25,6 @@ public class Barrier {
       return;
 
     do {
-      //System.out.println("Inside do");
       if (!b.cleared) {
         b.entercount++;
         tmp = b.entercount;
@@ -39,7 +38,6 @@ public class Barrier {
     } while(retry);
 
     while(true) {
-      //System.out.println("Inside while");
       if (b.cleared) {
         b.entercount--;
         int count = b.entercount;