changes to build SOR java version
authorbdemsky <bdemsky>
Wed, 19 Nov 2008 23:19:43 +0000 (23:19 +0000)
committerbdemsky <bdemsky>
Wed, 19 Nov 2008 23:19:43 +0000 (23:19 +0000)
Robust/src/Benchmarks/Prefetch/SOR/javasingle/JGFInstrumentor.java
Robust/src/Benchmarks/Prefetch/SOR/javasingle/JGFSORBench.java
Robust/src/Benchmarks/Prefetch/SOR/javasingle/JGFSORBenchSizeA.java
Robust/src/Benchmarks/Prefetch/SOR/javasingle/JGFSORBenchSizeC.java
Robust/src/Benchmarks/Prefetch/SOR/javasingle/JGFTimer.java
Robust/src/Benchmarks/Prefetch/SOR/javasingle/makefile
Robust/src/ClassLibrary/Math.java
Robust/src/ClassLibrary/String.java

index 69baf77f581bdcd944fcc1c7728798257b34e7e9..bfacd31f2aaf935366fe8b9af8eeb172e187c07d 100644 (file)
@@ -31,7 +31,7 @@ public class JGFInstrumentor{
   public static void addTimer (String name, HashMap timers){
 
     if (timers.containsKey(name)) {
-      System.out.println("JGFInstrumentor.addTimer: warning -  timer " + name + 
+      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
           " already exists");
     }
     else {
@@ -42,7 +42,7 @@ public class JGFInstrumentor{
   public static void addTimer (String name, String opname, HashMap timers){
 
     if (timers.containsKey(name)) {
-      System.out.println("JGFInstrumentor.addTimer: warning -  timer " + name + 
+      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
           " already exists");
     }
     else {
@@ -54,7 +54,7 @@ public class JGFInstrumentor{
   public static void addTimer (String name, String opname, int size, HashMap timers){
 
     if (timers.containsKey(name)) {
-      System.out.println("JGFInstrumentor.addTimer: warning -  timer " + name +
+      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name +
           " already exists");
     }
     else {
@@ -68,7 +68,7 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).start();
     }
     else {
-      System.out.println("JGFInstrumentor.startTimer: failed -  timer " + name + 
+      System.printString("JGFInstrumentor.startTimer: failed -  timer " + name + 
           " does not exist");
     }
 
@@ -79,7 +79,7 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).stop();
     }
     else {
-      System.out.println("JGFInstrumentor.stopTimer: failed -  timer " + name + 
+      System.printString("JGFInstrumentor.stopTimer: failed -  timer " + name + 
           " does not exist");
     }
   }
@@ -89,7 +89,7 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).addops(count);
     }
     else {
-      System.out.println("JGFInstrumentor.addOpsToTimer: failed -  timer " + name + 
+      System.printString("JGFInstrumentor.addOpsToTimer: failed -  timer " + name + 
           " does not exist");
     }
   }  
@@ -99,7 +99,7 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).addtime(added_time);
     }
     else {
-      System.out.println("JGFInstrumentor.addTimeToTimer: failed -  timer " + name +
+      System.printString("JGFInstrumentor.addTimeToTimer: failed -  timer " + name +
           " does not exist");
     }
 
@@ -113,7 +113,7 @@ public class JGFInstrumentor{
       time = ((JGFTimer) timers.get(name)).time;
     }
     else {
-      System.out.println("JGFInstrumentor.readTimer: failed -  timer " + name + 
+      System.printString("JGFInstrumentor.readTimer: failed -  timer " + name + 
           " does not exist");
       time = 0.0; 
     }
@@ -125,7 +125,7 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).reset();
     }
     else {
-      System.out.println("JGFInstrumentor.resetTimer: failed -  timer " + name +
+      System.printString("JGFInstrumentor.resetTimer: failed -  timer " + name +
           " does not exist");
     }
   }
@@ -135,7 +135,7 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).print();
     }
     else {
-      System.out.println("JGFInstrumentor.printTimer: failed -  timer " + name +
+      System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
           " does not exist");
     }
   }
@@ -145,7 +145,7 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).printperf();
     }
     else {
-      System.out.println("JGFInstrumentor.printTimer: failed -  timer " + name +
+      System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
           " does not exist");
     }
   }
@@ -186,15 +186,15 @@ public class JGFInstrumentor{
         header = base + "3 - Size B";
     }
 
-    System.out.println(header); 
+    System.printString(header); 
 
     if (nthreads == 1) {
-      System.out.println("Executing on " + nthreads + " thread");
+      System.printString("Executing on " + nthreads + " thread");
     }
     else {
-      System.out.println("Executing on " + nthreads + " threads");
+      System.printString("Executing on " + nthreads + " threads");
     }
 
-    System.out.println("");
+    System.printString("");
   } 
 }
index b0d6c4b4df92e1750a2ba68c9aa540e4f2ab3dbc..3155ab0158b53ed2402f70a89efa6503059ea5c0 100644 (file)
@@ -86,17 +86,11 @@ public class JGFSORBench {
 
     thobjects[0] = new SORRunner(0,omega,G,num_iterations,sor.sync,numthreads);
     thobjects[0].start();
-    try {
-      thobjects[0].join();
-    }
-    catch (InterruptedException e) {}
+    thobjects[0].join();
 
 
     for(int i=1;i<numthreads;i++) {
-      try {
         thobjects[i].join();
-      }
-      catch (InterruptedException e) {}
     }
 
     JGFInstrumentor.stopTimer("Section2:SOR:Kernel", instr.timers);
@@ -118,12 +112,15 @@ public class JGFSORBench {
 
   public void JGFvalidate(){
 
-    double refval[] = {0.498574406322512,1.1234778980135105,1.9954895063582696};
-    double dev = Math.abs(Gtotal - refval[size]);
-    if (dev > 1.0e-12 ){
-      System.out.println("Validation failed");
-      System.out.println("Gtotal = " + Gtotal + "  " + dev + "  " + size);
-    }
+      double refval[]=new double[3];
+      refval[0]=0.498574406322512;
+      refval[1]=1.1234778980135105;
+      refval[2]=1.9954895063582696;
+      double dev = Math.abs(Gtotal - refval[size]);
+      if (dev > 1.0e-12 ){
+         System.printString("Validation failed");
+         System.printString("Gtotal = " + Gtotal + "  " + dev + "  " + size);
+      }
   }
 
   /*
index c78f29a6c9a9d87211d31f19d079950ca91c8f0d..7b50df8f888c79c7cb0d0d6645310b0146e931cc 100644 (file)
@@ -28,8 +28,8 @@ public class JGFSORBenchSizeA{
     if(argv.length != 0 ) {
       nthreads = Integer.parseInt(argv[0]);
     } else {
-      System.out.println("The no of threads has not been specified, defaulting to 1");
-      System.out.println("  ");
+      System.printString("The no of threads has not been specified, defaulting to 1");
+      System.printString("  ");
       nthreads = 1;
     }
 
index 4a96077bf748b5492a3da3f6590c78a95039ce15..71b30f19b6a9f462fd89207f7346c33d19baa86d 100644 (file)
@@ -26,8 +26,8 @@ public class JGFSORBenchSizeC{
     if(argv.length != 0 ) {
       nthreads = Integer.parseInt(argv[0]);
     } else {
-      System.out.println("The no of threads has not been specified, defaulting to 1");
-      System.out.println("  ");
+      System.printString("The no of threads has not been specified, defaulting to 1");
+      System.printString("  ");
       nthreads = 1;
     }
 
index cf4daf5714cbb630ff7de4164a47c05d14fd5fc1..72a2a9b5f8c348b6763237438e7f9dfd37bc4d3c 100644 (file)
@@ -54,7 +54,7 @@ public class JGFTimer {
 
 
   public void start(){
-    if (on) System.out.println("Warning timer " + " was already turned on");
+    if (on) System.printString("Warning timer " + " was already turned on");
     on = true; 
     start_time = System.currentTimeMillis();
   }
@@ -62,7 +62,7 @@ public class JGFTimer {
 
   public void stop(){
     time += (double) (System.currentTimeMillis()-start_time) / 1000.;
-    if (!on) System.out.println("Warning timer " + " wasn't turned on");
+    if (!on) System.printString("Warning timer " + " wasn't turned on");
     calls++;
     on = false;  
   }
@@ -87,23 +87,23 @@ public class JGFTimer {
   }
 
   public void longprint(){
-    System.out.println("Timer            Calls         Time(s)       Performance("+opname+"/s)");   
-    System.out.println(name + "           " + calls +    "           "  +  time + "        " + this.perf());
+    System.printString("Timer            Calls         Time(s)       Performance("+opname+"/s)");   
+    System.printString(name + "           " + calls +    "           "  +  time + "        " + this.perf());
   }
 
   public void print(){
     if (opname.equals("")) {
-      System.out.println(name + "   " + time + " (s)");
+      System.printString(name + "   " + time + " (s)");
     }
     else {
       if(size == 0) {
-        System.out.println(name + ":SizeA" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + ":SizeA" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
       } else if (size == 1) {
-        System.out.println(name + ":SizeB" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + ":SizeB" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
       } else if (size == 2) {
-        System.out.println(name + ":SizeC" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + ":SizeC" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
       } else{
-        System.out.println(name + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
+        System.printString(name + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)");
       }
     }
   }
@@ -117,7 +117,7 @@ public class JGFTimer {
     // pad name to 40 characters
     while ( name.length() < 40 ) name = name + " "; 
 
-    System.out.println(name + "\t" + this.perf() + "\t"
+    System.printString(name + "\t" + this.perf() + "\t"
         + " ("+opname+"/s)");  
   }
 
index a430bb51d02854a32d6a9c186bde53a415bca3d1..3e1a37c873f0b4586c4db5c09e8e0cb05ba12b05 100644 (file)
@@ -1,4 +1,4 @@
-MAINCLASS=JGFSORBenchSizeC
+MAINCLASS=JGFSORBenchSizeA
 SRC=${MAINCLASS}.java \
 JGFInstrumentor.java \
 JGFTimer.java \
index 6f3e56bd3f47b4ed4c5f67ac1d837936dd4bec41..8a500e46b9a1f52a0d8479e713fc4683f191c516 100644 (file)
@@ -13,6 +13,14 @@ public class Math {
     }
   }
 
+  public static double abs(double x) {
+    if (x < 0) {
+      return -x;
+    } else {
+      return x;
+    }
+  }
+
   public static float abs(float a) {
     if (a<0)
       return -a;
index 6ae7fcfa93defc849f186d8b32cc3bd455f4c26d..5bdaf0fb57aeba07838ef9b402ae098ca264bd50 100644 (file)
@@ -270,6 +270,10 @@ public class String {
     return new String(chararray);
   }
 
+  public static String valueOf(double x) {
+      return valueOf((long)x);
+  }
+
   public static String valueOf(long x) {
     int length=0;
     long tmp;