barrier bug fix -> new hack and align prints
authoradash <adash>
Wed, 30 Apr 2008 09:11:43 +0000 (09:11 +0000)
committeradash <adash>
Wed, 30 Apr 2008 09:11:43 +0000 (09:11 +0000)
Robust/src/Benchmarks/Prefetch/LUFact/dsm/Barrier.java
Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java
Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java
Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java
Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java

index 482b695aed817e75f39d8229b4ca075bf0bdd922..fda1503f1e6c835619a50178b7e71b82067d7e3e 100644 (file)
@@ -19,7 +19,7 @@ public class Barrier {
 
   public static void enterBarrier(Barrier b) {
     int tmp;
-    boolean retry=true;
+    boolean retry=true, ret1=false, ret2=true;;
 
     do {
       atomic {
@@ -30,21 +30,23 @@ public class Barrier {
             if(b.numthreads > 1)
               b.cleared=true;
             b.entercount--;
-            return;
+            //return;
+            ret1 = true;
           }
           retry=false;
         }
       }
     } while(retry);
-
-    while(true) {
+    if (ret1) return;
+    while(ret2) {
       atomic {
         if (b.cleared) {
           b.entercount--;
           int count = b.entercount;
           if (count==0)
             b.cleared=false;
-          return;
+          //return;
+          ret2=false;
         }
       }
     }
index fc737bec8b3752e607a971c4f1a7813e51154747..5e89ddb9be6736482fb068a4e03b72d267550dba 100644 (file)
@@ -31,7 +31,7 @@ public class JGFInstrumentor{
 
     if (timers.containsKey(name)) {
       System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
-          " already exists");
+          " already exists\n");
     }
     else {
       timers.put(name, new JGFTimer(name));
@@ -42,7 +42,7 @@ public class JGFInstrumentor{
 
     if (timers.containsKey(name)) {
       System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
-          " already exists");
+          " already exists\n");
     }
     else {
       timers.put(name, new JGFTimer(name,opname));
@@ -54,7 +54,7 @@ public class JGFInstrumentor{
 
     if (timers.containsKey(name)) {
       System.printString("JGFInstrumentor.addTimer: warning -  timer " + name +
-          " already exists");
+          " already exists\n");
     }
     else {
       timers.put(name, new JGFTimer(name,opname,size));
@@ -68,7 +68,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.startTimer: failed -  timer " + name + 
-          " does not exist");
+          " does not exist\n");
     }
 
   }
@@ -79,7 +79,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.stopTimer: failed -  timer " + name + 
-          " does not exist");
+          " does not exist\n");
     }
   }
 
@@ -89,7 +89,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.addOpsToTimer: failed -  timer " + name + 
-          " does not exist");
+          " does not exist\n");
     }
   }  
 
@@ -99,7 +99,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.addTimeToTimer: failed -  timer " + name +
-          " does not exist");
+          " does not exist\n");
     }
 
 
@@ -113,7 +113,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.readTimer: failed -  timer " + name + 
-          " does not exist");
+          " does not exist\n");
       time = 0.0; 
     }
     return time; 
@@ -125,7 +125,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.resetTimer: failed -  timer " + name +
-          " does not exist");
+          " does not exist\n");
     }
   }
 
@@ -135,7 +135,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
-          " does not exist");
+          " does not exist\n");
     }
   }
 
@@ -145,7 +145,7 @@ public class JGFInstrumentor{
     }
     else {
       System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
-          " does not exist");
+          " does not exist\n");
     }
   }
 
@@ -185,15 +185,15 @@ public class JGFInstrumentor{
         header = base + "3 - Size B";
     }
 
-    System.printString(header); 
+    System.printString(header+"\n"); 
 
     if (nthreads == 1) {
-      System.printString("Executing on " + nthreads + " thread");
+      System.printString("Executing on " + nthreads + " thread\n");
     }
     else {
-      System.printString("Executing on " + nthreads + " threads");
+      System.printString("Executing on " + nthreads + " threads\n");
     }
 
-    System.printString("");
+    System.printString("\n");
   } 
 }
index e71f57fe151b70a340d71d7d8943b1472f183f25..6c42f20972886b1d311cd04bd5680b3f9ecbec1f 100644 (file)
@@ -24,8 +24,8 @@ public class JGFLUFactBenchSizeA {
     if(argv.length != 0 ) { 
       nthreads = Integer.parseInt(argv[0]); 
     } else { 
-      System.printString("The no of threads has not been specified, defaulting to 1");
-      System.printString("  ");
+      System.printString("The no of threads has not been specified, defaulting to 1\n");
+      System.printString("  \n");
       nthreads = 1;
     }
 
@@ -33,24 +33,24 @@ public class JGFLUFactBenchSizeA {
     JGFInstrumentor.printHeader(2,0,nthreads);
     JGFLUFactBench lub;
     atomic {
-      //lub = global new JGFLUFactBench(nthreads, instr); 
       lub = global new JGFLUFactBench(nthreads); 
     }
 
     int size = 0;
-    //lub.JGFrun(0);
     JGFInstrumentor.addTimer("Section2:LUFact:Kernel", "Mflops", size, instr.timers);
     atomic {
       lub.JGFsetsize(size); 
       lub.JGFinitialise();
     }
     JGFLUFactBench.JGFkernel(lub);
+    System.printString("End of JGFkernel\n");
     int retval;
     atomic {
       retval = lub.JGFvalidate();
     }
+    System.printString("End of JGFvalidate\n");
     if(retval == 1) {
-      System.printString("Validation failed");
+      System.printString("Validation failed\n");
     }
     //JGFLUFactBench.JGFvalidate(lub);
 
index d65f4010b90338d971d5422a5c5fc7fe800a4ce1..4e1d168f94ca0653b0f2ba39adfae1fe9114446a 100644 (file)
@@ -53,7 +53,7 @@ public class JGFTimer {
 
 
   public void start(){
-    if (on) System.printString("Warning timer " + " was already turned on");
+    if (on) System.printString("Warning timer " + " was already turned on\n");
     on = true; 
     start_time = System.currentTimeMillis();
   }
@@ -61,7 +61,7 @@ public class JGFTimer {
 
   public void stop(){
     time += (double) (System.currentTimeMillis()-start_time) / 1000.;
-    if (!on) System.printString("Warning timer " + " wasn't turned on");
+    if (!on) System.printString("Warning timer " + " wasn't turned on\n");
     calls++;
     on = false;  
   }
@@ -86,23 +86,23 @@ public class JGFTimer {
   }
 
   public void longprint(){
-    System.printString("Timer            Calls         Time(s)       Performance("+opname+"/s)");   
-    System.printString(name + "           " + calls +    "           "  +  (long)time + "        " + (long)this.perf());
+    System.printString("Timer            Calls         Time(s)       Performance("+opname+"/s)\n");   
+    System.printString(name + "           " + calls +    "           "  +  (long)time + "        " + (long)this.perf() + "\n");
   }
 
   public void print(){
     if (opname.equals("")) {
-      System.printString(name + "   " + (long)time + " (s)");
+      System.printString(name + "   " + (long)time + " (s)\n");
     }
     else {
       if(size == 0) {
-        System.printString(name + ":SizeA" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + ":SizeA" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n");
       } else if (size == 1) {
-        System.printString(name + ":SizeB" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + ":SizeB" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n");
       } else if (size == 2) {
-        System.printString(name + ":SizeC" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + ":SizeC" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n");
       } else{
-        System.printString(name + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n");
       }
     }
   }
@@ -117,7 +117,7 @@ public class JGFTimer {
     while ( name.length() < 40 ) name = name + " "; 
 
     System.printString(name + "\t" + (long)this.perf() + "\t"
-        + " ("+opname+"/s)");  
+        + " ("+opname+"/s)\n");  
   }
 
 }
index e19fa177c2e2d001c59bdcc24279226c6f44c75a..e3d3f8805aad1111890230971b35f7721379098b 100644 (file)
@@ -70,6 +70,8 @@ class LinpackRunner extends Thread {
              }
              // synchronise threads
              Barrier.enterBarrier(tmpbr);
+          System.clearPrefetchCache();
+
              // zero pivot implies this column already triangularized
              boolean b;
              atomic {
@@ -77,6 +79,7 @@ class LinpackRunner extends Thread {
              }
              if (b) {
                  Barrier.enterBarrier(tmpbr);
+          System.clearPrefetchCache();
                  // interchange if necessary
                  atomic {
                      if(lid == 0 ) {
@@ -89,6 +92,7 @@ class LinpackRunner extends Thread {
                  }
                  // synchronise threads
                  Barrier.enterBarrier(tmpbr);
+          System.clearPrefetchCache();
                  // compute multipliers
                  atomic {
                      t = -1.0/col_k[k];
@@ -98,6 +102,7 @@ class LinpackRunner extends Thread {
                  }
                  // synchronise threads
                  Barrier.enterBarrier(tmpbr);
+       System.clearPrefetchCache();
                  // row elimination with column indexing
                  atomic {
                      slice = ((nlocal-kp1) + nthreads-1)/nthreads;
@@ -118,10 +123,12 @@ class LinpackRunner extends Thread {
                  }
                  // synchronise threads
                  Barrier.enterBarrier(tmpbr);
+          System.clearPrefetchCache();
              } else {
                  info = k;
              }
              Barrier.enterBarrier(tmpbr);
+          System.clearPrefetchCache();
          }
       }