Clean up code
authoradash <adash>
Wed, 16 Apr 2008 01:26:40 +0000 (01:26 +0000)
committeradash <adash>
Wed, 16 Apr 2008 01:26:40 +0000 (01:26 +0000)
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node.java
Robust/src/ClassLibrary/System.java

index 2e2f363d253f0c369c8712ffde7069a9b93fd0a1..a5775672b9e7eb842d64145ef36cc46974e64d48 100644 (file)
@@ -65,6 +65,8 @@ public class Em3d extends Thread
       iteration = numIter;
     }
 
+    System.clearPrefetchCache();
+
     for (int i = 0; i < iteration; i++) {
       /* for  eNodes */
       atomic {
@@ -116,20 +118,6 @@ public class Em3d extends Thread
   {
     Em3d em = new Em3d();
     Em3d.parseCmdLine(args, em);
-    /*
-    atomic {
-       em = global new Em3d();
-    Em3d.parseCmdLine(args, em);
-    }
-    
-    boolean printMsgs, printResult;
-    int numIter;
-    atomic {
-      printMsgs = em.printMsgs;
-      numIter = em.numIter;
-      printResult = em.printResult;
-    }
-    */
     if (em.printMsgs) 
       System.printString("Initializing em3d random graph...");
     long start0 = System.currentTimeMillis();
@@ -140,14 +128,8 @@ public class Em3d extends Thread
       mybarr = global new Barrier(numThreads);
     }
     BiGraph graph;
-    BiGraph graph1;
     Random rand = new Random(783);
-   // atomic {
-      //rand = global new Random(783);
-    //}
     atomic {
-      //graph1 = global new BiGraph();
-      graph = global new BiGraph();
       graph =  BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand);
     }
 
@@ -165,8 +147,6 @@ public class Em3d extends Thread
 
     atomic {
       em3d[0] = global new Em3d(graph, 1, em.numNodes, em.numIter, mybarr);
-      //em3d[0] = global new Em3d(graph, 1, em.numNodes/2, em.numIter, mybarr);
-      //em3d[1] = global new Em3d(graph, (em.numNodes/2)+1, em.numNodes, em.numIter, mybarr);
     }
 
     int mid = (128<<24)|(195<<16)|(175<<8)|73;
@@ -188,33 +168,13 @@ public class Em3d extends Thread
 
     // print current field values
     if (em.printResult) {
-     // System.printString(graph.eNodes);
       StringBuffer retval = new StringBuffer();
-      double newtmp;
+      double dvalue;;
       atomic {
-        newtmp = graph.eNodes.value;
+        dvalue = graph.eNodes.value;
       }
-      int xtmp = (int)newtmp;
-      System.printString("Value = " +xtmp);
-      /*
-      while(newtmp!=null) {
-          Node n = newtmp;
-          retval.append("E: " + n + "\n");
-         // newtmp = newtmp.next;
-      }
-      */
-      /*
-      atomic {
-        newtmp = graph.hNodes;
-      }
-      while(newtmp!=null) {
-        Node n = newtmp;
-        retval.append("H: " + n + "\n");
-        newtmp = newtmp.next;
-      }
-
-      System.printString(retval.toString());
-      */
+      int intvalue = (int)dvalue;
+      System.printString("Value = " + intvalue + "\n");
     }
 
     if (em.printMsgs) {
@@ -242,31 +202,20 @@ public class Em3d extends Thread
       // check for options that require arguments
       if (arg.equals("-n")) {
         if (i < args.length) {
-          // atomic {
                em.numNodes = new Integer(args[i++]).intValue();
-          // }
         }
       } else if (arg.equals("-d")) {
         if (i < args.length) {
-           //atomic {
                em.numDegree = new Integer(args[i++]).intValue();
-           //}
         }
       } else if (arg.equals("-i")) {
         if (i < args.length) {
-          //atomic {
-            //em.numIter = global new Integer(args[i++]).intValue();
             em.numIter = new Integer(args[i++]).intValue();
-          //}
         }
       } else if (arg.equals("-p")) {
-         //atomic {
              em.printResult = true;
-         //}
       } else if (arg.equals("-m")) {
-         //atomic {
              em.printMsgs = true;
-         //}
       } else if (arg.equals("-h")) {
         em.usage();
       }
index c3467a3800b497d6e2beebe9f494980b25637d3b..15f95368308b7e78cddf8d08bf942cf29b2c48d5 100644 (file)
@@ -45,7 +45,6 @@ public class Node {
   {
     value = r.nextDouble();
     // create empty array for holding toNodes
-
     toNodes = global new Node[degree];
   }
 
@@ -136,20 +135,6 @@ public class Node {
     }
   }
 
-  /** 
-   * Get the new value of the current node based on its neighboring
-   * from_nodes and coefficients.
-   **/
-
-  /*
-     public void computeNewValue()
-     {
-     for (int i = 0; i < fromCount; i++) {
-     value -= coeffs[i] * fromNodes[i].value;
-     }
-     }
-     */
-
   /**
    * Override the toString method to return the value of the node.
    * @return the value of the node.
@@ -158,7 +143,6 @@ public class Node {
   {
     String returnString;
     returnString = "value " + (long)value + ", from_count " + fromCount;
-    //return "value " + value + ", from_count " + fromCount;
   }
 
 }
index 2595e5469961654df172618c7635ae4a8e7b13aa..124f3174115e8a193393453b9477565dfcf5ed2f 100644 (file)
@@ -13,4 +13,6 @@ public class System {
     }
 
     public static native void exit(int status);
+
+    public static native void clearPrefetchCache();
 }