still have some compile errors . Use Em3d with new Barrier class
authoradash <adash>
Wed, 6 Aug 2008 08:49:21 +0000 (08:49 +0000)
committeradash <adash>
Wed, 6 Aug 2008 08:49:21 +0000 (08:49 +0000)
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile

index b3559bed73fbda4460d4603125e77cac4a4ec686..93776f2eef6e340f81ef22ca94838db183de502e 100644 (file)
@@ -42,16 +42,17 @@ public class Em3d extends Thread {
   BiGraph bg;
   int upperlimit;
   int lowerlimit;
-  Barrier mybarr;
+ //Barrier barr;
+ String hostname;
     public Em3d() {
     }
 
-    public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr, int numDegree, int threadindex) {
+    public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, int numDegree, int threadindex, String name) {
     this.bg = bg;
     this.lowerlimit = lowerlimit;
     this.upperlimit = upperlimit;
     this.numIter = numIter;
-    this.mybarr = mybarr;
+    this.hostname = name;
     this.numDegree = numDegree;
     this.threadindex=threadindex;
   }
@@ -62,9 +63,9 @@ public class Em3d extends Thread {
     int degree;
     Random random;
 
+    barr = new Barrier(hostname);
     atomic {
        iteration = numIter;
-       barr=mybarr;
        degree = numDegree;
        random = new Random(lowerlimit);
     }
@@ -74,6 +75,7 @@ public class Em3d extends Thread {
        bg.allocateNodes ( lowerlimit, upperlimit, threadindex);
     }
     Barrier.enterBarrier(barr);
+    System.clearPrefetchCache();
 
     atomic {
        //initialize the eNodes
@@ -139,12 +141,21 @@ public class Em3d extends Thread {
     long start0 = System.currentTimeMillis();
     int numThreads = em.numThreads;
     int[] mid = new int[4];
+    String[] hostname;
+    atomic {
+      hostname = global new String[4];
+      hostname[0] = global new String("128.195.175.79");
+      hostname[1] =  global new String("128.195.175.73");
+      hostname[2] = global new String("128.195.175.78");
+      hostname[3] = global new String("128.195.175.69");
+    }
     mid[0] = (128<<24)|(195<<16)|(175<<8)|79;//dw-1
-    mid[1] = (128<<24)|(195<<16)|(175<<8)|80;//dw-2
-    mid[2] = (128<<24)|(195<<16)|(175<<8)|73;
-    mid[3] = (128<<24)|(195<<16)|(175<<8)|78;
+    mid[1] = (128<<24)|(195<<16)|(175<<8)|73;//dw-2
+    mid[2] = (128<<24)|(195<<16)|(175<<8)|78;
+    mid[3] = (128<<24)|(195<<16)|(175<<8)|69;
+
     System.printString("DEBUG -> numThreads = " + numThreads+"\n");
-    Barrier mybarr;
+    BarrierServer mybarr;
     BiGraph graph;
 
     
@@ -152,7 +163,7 @@ public class Em3d extends Thread {
    // System.printString( "Allocating BiGraph.\n" );
 
     atomic {
-      mybarr = global new Barrier(numThreads);
+      mybarr = global new BarrierServer(numThreads);
       graph =  BiGraph.create(em.numNodes, em.numDegree, numThreads);
     }
 
@@ -168,21 +179,25 @@ public class Em3d extends Thread {
       for(int i=0;i<numThreads;i++) {
          Em3d tmp;
          if ((i+1)==numThreads)
-             tmp = global new Em3d(graph, base, em.numNodes, em.numIter, mybarr, em.numDegree, i);
+             tmp = global new Em3d(graph, base, em.numNodes, em.numIter, em.numDegree, i, hostname[0]);
          else
-             tmp = global new Em3d(graph, base, base+increment, em.numIter, mybarr, em.numDegree, i);
+             tmp = global new Em3d(graph, base, base+increment, em.numIter, em.numDegree, i, hostname[0]);
          em3d[i]=new Em3dWrap(tmp);
          base+=increment;
       }
     }
 
+    //TODO check if correct
+    mybarr.start(mid[0]);
     for(int i = 0; i<numThreads; i++) {
-       em3d[i].em3d.start(mid[i]);
+      em3d[i].em3d.start(mid[i]);
     }
 
+    mybarr.join();
     for(int i = 0; i<numThreads; i++) {
-       em3d[i].em3d.join();
+      em3d[i].em3d.join();
     }
+    System.printString("Done!"+ "\n");
   }
 
 
index 83a99ce0e1314319a472582be51ff96c004bfc78..fb558fc2fb48f773efee8c2d41b4747021dbacbb 100644 (file)
@@ -7,23 +7,29 @@ SRC1=${MAINCLASS}Nold.java \
        BiGraphNold.java \
        Node.java \
        Barrier.java
+SRC3=${MAINCLASS}2.java \
+       ${MAINCLASS}Wrap.java \
+       BiGraph2.java \
+       Node2.java \
+       EVector.java 
 
-FLAGS=-dsm -prefetch -optimize -transstats -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -nooptimize -debug -mainclass ${MAINCLASS} -trueprob 0.91
+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.91
+FLAGS1=-dsm -prefetch -transstats -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.91
 FLAGS2=-dsm -optimize -transstats -mainclass ${MAINCLASS}
 
 default:
 #      ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
 #      ../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC}
-       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC1}
-       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
-       cp ${MAINCLASS}NNP.bin ${MAINCLASS}1NP.bin
-       cp ${MAINCLASS}N.bin ${MAINCLASS}1.bin
-       cp ${MAINCLASS}NNP.bin ${MAINCLASS}2NP.bin
-       cp ${MAINCLASS}N.bin ${MAINCLASS}2.bin
-       cp ${MAINCLASS}NNP.bin ${MAINCLASS}3NP.bin
-       cp ${MAINCLASS}N.bin ${MAINCLASS}3.bin
-       cp ${MAINCLASS}NNP.bin ${MAINCLASS}4NP.bin
-       cp ${MAINCLASS}N.bin ${MAINCLASS}4.bin
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC3}
+#      ../../../../buildscript ${FLAGS1} -o ${MAINCLASS}N ${SRC3}
+#      cp ${MAINCLASS}NNP.bin ${MAINCLASS}1NP.bin
+#      cp ${MAINCLASS}N.bin ${MAINCLASS}1.bin
+#      cp ${MAINCLASS}NNP.bin ${MAINCLASS}2NP.bin
+#      cp ${MAINCLASS}N.bin ${MAINCLASS}2.bin
+#      cp ${MAINCLASS}NNP.bin ${MAINCLASS}3NP.bin
+#      cp ${MAINCLASS}N.bin ${MAINCLASS}3.bin
+#      cp ${MAINCLASS}NNP.bin ${MAINCLASS}4NP.bin
+#      cp ${MAINCLASS}N.bin ${MAINCLASS}4.bin
 
 clean:
        rm -rf tmpbuilddirectory