run-doj-validation-test.sh: a single script that performs validation tests for all...
authoryeom <yeom>
Fri, 4 May 2012 02:04:30 +0000 (02:04 +0000)
committeryeom <yeom>
Fri, 4 May 2012 02:04:30 +0000 (02:04 +0000)
15 files changed:
Robust/src/Benchmarks/oooJava/barneshut/Barneshut.java
Robust/src/Benchmarks/oooJava/crypt/JGFCryptBench.java
Robust/src/Benchmarks/oooJava/kmeans/KMeans.java
Robust/src/Benchmarks/oooJava/labyrinth/Labyrinth.java
Robust/src/Benchmarks/oooJava/mergesort/BMergeSort4.java
Robust/src/Benchmarks/oooJava/mergesort/MergeSort.java
Robust/src/Benchmarks/oooJava/moldyn/JGFMolDynBenchSizeB.java
Robust/src/Benchmarks/oooJava/monte/JGFMonteCarloBench.java
Robust/src/Benchmarks/oooJava/power/Power.java
Robust/src/Benchmarks/oooJava/raytracer/JGFRayTracerBench.java
Robust/src/Benchmarks/oooJava/raytracer/RayTracer.java
Robust/src/Benchmarks/oooJava/raytracer/test.java
Robust/src/Benchmarks/oooJava/run-doj-validation-test.sh [new file with mode: 0755]
Robust/src/Benchmarks/oooJava/sor/JGFSORBench.java
Robust/src/Benchmarks/oooJava/voronoi/TestRunner.java

index 7bc6e6a88130f40dcd02ae4770a9f1fd31d7f1fa..699b64e19a2b593d4f1930f9be206c231a2183f5 100644 (file)
@@ -37,8 +37,11 @@ public final class Barneshut {
 
   private  boolean isFirstRun;
   
+  public boolean validationTest;
+  
   public  Barneshut(){
     isFirstRun = true;
+    validationTest=false;
   }
 
   private  void ReadInput(String filename) {
@@ -54,7 +57,7 @@ public final class Barneshut {
     epssq = eps * eps;
     itolsq = 1.0 / (tol * tol);
     
-    if (isFirstRun) {
+    if (isFirstRun && !validationTest) {
       System.out.println("configuration: " + nbodies + " bodies, " + ntimesteps + " time steps");
       System.out.println("");
     }
@@ -207,17 +210,23 @@ public   void ComputeCenterOfMass(ArrayIndexedGraph octree, ArrayIndexedNode roo
     mintime =9223372036854775807L;
     run = 0;
     
+    if (args.length > 1 ) {
+      bh.validationTest=true;
+    }
+    
 //    while (((run < 3) || (Math.abs(lasttime-runtime)*64 > min(lasttime, runtime))) && (run < 7)) {
       runtime = bh.run(args);
       if (runtime < mintime) mintime = runtime;
       run++;
 //    }
-    System.out.println("minimum runtime: " + mintime + " ms");
-    System.out.println("");
+    if(!bh.validationTest){
+      System.out.println("minimum runtime: " + mintime + " ms");
+      System.out.println("");
+    }
   }
 
   public  long run(String args[]) {
-    if (isFirstRun) {
+    if (isFirstRun && !validationTest) {
       System.out.println("Lonestar Benchmark Suite v2.1");
       System.out.println("Copyright (C) 2007, 2008, 2009 The University of Texas at Austin");
       System.out.println("http://iss.ices.utexas.edu/lonestar/");
@@ -228,14 +237,16 @@ public   void ComputeCenterOfMass(ArrayIndexedGraph octree, ArrayIndexedNode roo
       System.out.println("http://iss.ices.utexas.edu/lonestar/barneshut.html");
       System.out.println("");
     }
-    if (args.length != 1) {
+    if (args.length ==0 ) {
       System.out.println("arguments: input_file_name");
       System.exit(-1);
     }
     long fstart_time = System.currentTimeMillis();
     ReadInput(args[0]);
     long fend_time = System.currentTimeMillis();
-    System.out.println("file reading time="+(fend_time-fstart_time));
+    if(!validationTest){
+      System.out.println("file reading time="+(fend_time-fstart_time));
+    }
     long runtime = 0;
     int local_nbodies=nbodies;
     int local_ntimesteps=ntimesteps;
@@ -280,15 +291,17 @@ public   void ComputeCenterOfMass(ArrayIndexedGraph octree, ArrayIndexedNode roo
     long end_time=System.currentTimeMillis();
     
     if (isFirstRun) {
-      /*
-        for (int i = 0; i < local_nbodies; i++) {
-          System.out.println(body[i].posx + " " + body[i].posy + " " + body[i].posz); // print result
+        if(validationTest){
+          for (int i = 0; i < local_nbodies; i++) {
+            System.out.println(body[i].posx + " " + body[i].posy + " " + body[i].posz); // print result
+          }     
+          System.out.println("");
         }
-     */
-      System.out.println("");
     }
     runtime += (end_time-start_time);
-    System.out.println("runtime: " + runtime + " ms");
+    if(!validationTest){
+      System.out.println("runtime: " + runtime + " ms");
+    }
 
     isFirstRun = false;
     return runtime;
index 159a8da26cce8c2f14b804abeccef049be880b3d..29d3c520d8973bb9ac69525bab5cb4f2be68e268 100644 (file)
@@ -32,6 +32,8 @@ public class JGFCryptBench {
   short[] userkey; // Key for encryption/decryption.
   int[] Z; // Encryption subkey (userkey derived).
   int[] DK; // Decryption subkey (userkey derived).
+  
+  public boolean validationTest;
 
   // buildTestData
   // Builds the data used for the test -- each time the test is run.
@@ -279,6 +281,7 @@ public class JGFCryptBench {
     datasizes[0] = 3000000;
     datasizes[1] = 20000000;
     datasizes[2] = 1000000000;
+    validationTest=false;
   }
 
   public void JGFsetsize(int size, int nWorker) {
@@ -355,20 +358,25 @@ public class JGFCryptBench {
     }   
     int p=plain2[0];
     long endT=System.currentTimeMillis();
-    System.out.println(p+"runningtime="+(endT-startT));
-
-//    boolean error = false; 
-//    for (int i = 0; i < array_rows; i++){
-//      error = (plain1 [i] != plain2 [i]); 
-//      if (error){
-//        System.out.println("Validation failed");
-//        System.out.println("Original Byte " + i + " = " + plain1[i]); 
-//        System.out.println("Encrypted Byte " + i + " = " + crypt1[i]); 
-//        System.out.println("Decrypted Byte " + i + " = " + plain2[i]); 
-//        return;
-//      }
-//    }
-//    System.out.println("Validation Success");
+    if(!validationTest){
+      System.out.println(p+"runningtime="+(endT-startT));
+    }
+    
+    if(validationTest){
+      boolean error = false; 
+      for (int i = 0; i < array_rows; i++){
+        error = (plain1 [i] != plain2 [i]); 
+        if (error){
+          System.out.println("Validation failed");
+          System.out.println("Original Byte " + i + " = " + plain1[i]); 
+          System.out.println("Encrypted Byte " + i + " = " + crypt1[i]); 
+          System.out.println("Decrypted Byte " + i + " = " + plain2[i]); 
+          return;
+        }
+      }
+      System.out.println("VALID");
+    }
+
   }
 
   public void JGFrun(int size, int nWorker) {
@@ -379,7 +387,9 @@ public class JGFCryptBench {
     long endT=System.currentTimeMillis();
     JGFkernel();
     
-    System.out.println("init="+(endT-startT));
+    if(!validationTest){
+      System.out.println("init="+(endT-startT));
+    }
   }
 
   public static void main(String argv[]) {
@@ -396,6 +406,10 @@ public class JGFCryptBench {
     if (argv.length > 1) {
       nWorker = Integer.parseInt(argv[1]);
     }
+    
+    if(argv.length > 2){
+     cb.validationTest=true;
+    }
 
     cb.JGFrun(problem_size, nWorker);
 
index 8f0823434a13740124c959de9d5b65967b31fe47..9ab3336360e185f4f6185223f117c1e0a9dc081b 100644 (file)
@@ -135,6 +135,8 @@ public class KMeans /*extends Thread*/ {
    * Output: Cluster centers
    **/
   float[][] cluster_centres;
+  
+  public boolean validationTest;
 
   public KMeans() {
     max_nclusters = 13;
@@ -143,6 +145,7 @@ public class KMeans /*extends Thread*/ {
     use_zscore_transform = 1;
     threshold = (float) 0.001;
     best_nclusters=0;
+    validationTest=false;
   }
 
   public KMeans(int threadid, GlobalArgs g_args) {
@@ -272,24 +275,24 @@ public class KMeans /*extends Thread*/ {
     }
 
     long endT=System.currentTimeMillis();
+    if(!kms.validationTest){
     System.out.println("running time="+(endT-startT));
+    }
 //    System.out.println("TIME="+g_args.global_time);
 
     System.out.println("Printing output......");
     System.out.println("Best_nclusters= " + kms.best_nclusters);
 
     /* Output: the coordinates of the cluster centres */
-    /*
-    {
-      for (int i = 0; i < kms.best_nclusters; i++) {
-        System.out.print(i + " ");
-        for (int j = 0; j < numAttributes; j++) {
-          System.out.print(kms.cluster_centres[i][j] + " ");
-        }
-        System.out.println("\n");
-      }
+    if(kms.validationTest){      
+        for (int i = 0; i < kms.best_nclusters; i++) {
+          System.out.print(i + " ");
+          for (int j = 0; j < numAttributes; j++) {
+            System.out.print(kms.cluster_centres[i][j] + " ");
+          }
+          System.out.println("\n");
+        }      
     }
-    */
 
     System.out.println("Finished......");
 
@@ -329,6 +332,8 @@ public class KMeans /*extends Thread*/ {
         }
       } else if(arg.equals("-h")) {
         km.usage();
+      } else if(arg.equals("-v")){
+        km.validationTest=true;
       }
     }
     if(km.nthreads == 0 || km.filename == null) {
index bd7e7e6a147083f2da6aed21efd4105b97d874bc..56b2ceda05062b1c5381c32fc632812fab7b5e34 100644 (file)
@@ -228,7 +228,7 @@ public class Labyrinth
         if(!stats)
             System.out.println("Verification not passed");
         else 
-            System.out.println("Verification passed.");
+            System.out.println("VALID");
         
         System.out.println("Finished");    
     }
index 899a3bbf128fd5ee94417f2069d58084b3ebfb6d..a7fb956fc1cb991f329941ee8090e088001de176 100644 (file)
@@ -3,22 +3,30 @@
  */\r
 \r
 public class MergeSort4 extends MergeSort {\r
+  \r
+  public  boolean validationTest;\r
 \r
   public static void main(String[] args) {\r
     int problemSize = 4194304;\r
     int parallelBranch=32;\r
+    \r
+    MergeSort4 sort = new MergeSort4();\r
+    \r
     if (args.length > 0) {\r
       problemSize = Integer.parseInt(args[0]);\r
     }\r
     if (args.length > 1) {\r
       parallelBranch = Integer.parseInt(args[1]);\r
     }\r
-    MergeSort4 sort = new MergeSort4();\r
+    if (args.length > 2){\r
+     sort.validationTest=true;\r
+    }\r
     sort.run(problemSize,parallelBranch);\r
   }\r
 \r
   public MergeSort4() {\r
     super();\r
+    validationTest=false;\r
   }\r
 \r
   public void runWorkAndTest() {\r
@@ -28,9 +36,11 @@ public class MergeSort4 extends MergeSort {
       long endT=System.currentTimeMillis();\r
       System.out.println("running time="+(endT-startT));\r
     }\r
-//    sese test{\r
-//      checkSorted(output);\r
-//    }\r
+    if(validationTest){\r
+      sese test{\r
+        checkSorted(output);\r
+      }\r
+    }\r
   }\r
 \r
   public int[] serializedSort(int A[], int low, int high) {\r
index 4289bf13c36388292411623a33cfa7426eb103aa..7b65bcdab23ebe91c98c5faf12f38c86aff55db9 100644 (file)
@@ -79,7 +79,7 @@ public class MergeSort {
         return;\r
       }\r
     }\r
-    System.out.println("Validation Success.");\r
+    System.out.println("VALID");\r
   }\r
 \r
   protected void merge(int A[], int B[], int out[]) {\r
index 5400b06668007eba9300cd4e1664a53059b868a6..ee5851fb9d4aaa45d9fcac4d9f44d5305b8e01e3 100644 (file)
@@ -55,6 +55,8 @@ public class JGFMolDynBenchSizeB {
     if (l != r ){
       System.printString("Validation failed\n");
       System.printString("Kinetic Energy = " + (long)dval + "  " + (long)dev + "  " + size + "\n");
+    }else{
+      System.printString("VALID\n");
     }
 
     System.printString("Finished\n");
index 40c2a350a37bd64939c7829c991070aaedfd37f5..721dccc257cb5b685e6fd0d7dfbb8e14d41cc132 100644 (file)
@@ -38,7 +38,7 @@ public class JGFMonteCarloBench extends CallAppDemo {
       System.out.println(" expectedReturnRate= " + getAppDemo().JGFavgExpectedReturnRateMC  + "  " + dev
           + "  " + size);
     }else{
-      System.out.println("Validation success");
+      System.out.println("VALID");
     }
   }
 
index 33dde4823a944471f225e8053332c23a7676fe81..d6704a86073273c9e4eeb184c4af49d05b783248 100644 (file)
@@ -35,10 +35,14 @@ public class Power {
         **/
        public static void main(String args[]) {
 
-               boolean printResults = false;
+               boolean validationTest = false;
                boolean printMsgs =true;
                // the input size is fixed, but the user may want the result printed
                // parseCmdLine(args);
+               
+               if(args.length>0){
+                 validationTest=true;
+               }
 
                // initial pass
                long start0 = System.currentTimeMillis();
@@ -55,18 +59,18 @@ public class Power {
 
                while (true) {
                        r.compute();
-                       if (printResults)
+                       if (validationTest)
                                System.out.println(r);
 
                        if (r.reachedLimit())
                                break;
 
-                       r.nextIter(printResults);
+                       r.nextIter(validationTest);
                } /* while */
 
                long end1 = System.currentTimeMillis();
 
-               if (printMsgs) {
+               if (printMsgs && (!validationTest)) {
                        System.out.println("Power build time " + (end0 - start0) / 1000.0);
                        System.out
                                        .println("Power compute time " + (end1 - start1) / 1000.0);
index 027f05bfcebf4535b100add9370329a4b6dbfe96..6aa27283ae01894afaec9bd83f379492c8ece3d3 100644 (file)
@@ -38,7 +38,7 @@ public class JGFRayTracerBench extends RayTracer {
 
        }
 
-       public void JGFapplication() {
+       public void JGFapplication(boolean vtest) {
 
 //             instr.startTimer("Section3:RayTracer:Run");
 
@@ -47,7 +47,7 @@ public class JGFRayTracerBench extends RayTracer {
                Interval interval = new Interval(0, width, height, 0, height, 1);
 
                // Do the business!
-               render(interval);
+               render(interval,vtest);
 //             System.out.println("DONE");
 //             instr.stopTimer("Section3:RayTracer:Run");
 
@@ -76,7 +76,7 @@ public class JGFRayTracerBench extends RayTracer {
                // System.gc();
        }
 
-       public void JGFrun(int size, JGFInstrumentor instr) {
+       public void JGFrun(int size, JGFInstrumentor instr,boolean vtest) {
 
 //             instr.addTimer("Section3:RayTracer:Total", "Solutions", size);
 //             instr.addTimer("Section3:RayTracer:Init", "Objects", size);
@@ -87,7 +87,7 @@ public class JGFRayTracerBench extends RayTracer {
 //             instr.startTimer("Section3:RayTracer:Total");
 
                JGFinitialise();
-               JGFapplication();
+               JGFapplication(vtest);
 //             JGFvalidate();
 //             JGFtidyup();
 
index 758d895dc60147a638eded0a7b117cab1f608677..eedf4f02b1c599f63c0fdef43091f442fa7ec354 100644 (file)
@@ -187,7 +187,7 @@ public class RayTracer {
                view = scene.getView();
        }
 
-       public void render(Interval interval) {
+       public void render(Interval interval,boolean vtest) {
                
 //             long checksum;
 //             checksum=0;
@@ -289,7 +289,9 @@ public class RayTracer {
                        
                } // end for (y)
 
-               System.out.println("END OF WORK");
+               if(!vtest){
+                 System.out.println("END OF WORK");
+               }
                
        }
        
index 8dc74ae4069e5038a34deca0f6eb208a82745d06..060a8fccb63558faf1eba6eac33f7d6194688639 100644 (file)
@@ -1,15 +1,21 @@
 public class test {
 
        public static void main(String argv[]) {
-               JGFInstrumentor instr = new JGFInstrumentor();
-               instr.printHeader(3, 0);
-
-               JGFRayTracerBench rtb = new JGFRayTracerBench(instr);
+         boolean vtest=false;
                int size=1;
                if( argv.length>0 ){
                    size=Integer.parseInt(argv[0]);
+                   if(argv.length>1){
+                     vtest=true;
+                   }
                }
-               rtb.JGFrun(size, instr);
+    JGFInstrumentor instr = new JGFInstrumentor();
+    if(!vtest){
+      instr.printHeader(3, 0);
+    }
+
+    JGFRayTracerBench rtb = new JGFRayTracerBench(instr);
+               rtb.JGFrun(size, instr,vtest);
        }
 
 }
diff --git a/Robust/src/Benchmarks/oooJava/run-doj-validation-test.sh b/Robust/src/Benchmarks/oooJava/run-doj-validation-test.sh
new file mode 100755 (executable)
index 0000000..3f6bd53
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/bash
+
+CURDIR=`pwd`
+SINGF=output.sing
+DOJF=output.doj
+DIF=$CURDIR/validation-result.txt
+rm -f $DIF
+
+BDIR=( raytracer barneshut tracking voronoi kmeans power )
+BCOM=( test Barneshut TrackingBench TestRunner KMeans Power )
+BARGS=( "1 1" "./inputs/BarnesHutLarge.in 1" "" "1000000 -p" "-m 40 -n 40 -t 0.00001 -i inputs/random-n65536-d32-c16.txt -nthreads 1 -v"  "1" )
+
+for((i=0; i<${#BDIR[@]}; i++))
+do
+cd $CURDIR/${BDIR[$i]}
+  rm -f $SINGF
+  rm -f $DOJF
+  make clean;
+  make single;make rcrpointer
+  ./${BCOM[$i]}s.bin ${BARGS[$i]} > $SINGF
+  ./${BCOM[$i]}r.bin ${BARGS[$i]} > $DOJF
+  echo ${BDIR[$i]} >> $DIF
+  diff $SINGF $DOJF >> $DIF  
+  rm -f $SINGF
+  rm -f $DOJF
+  make clean;
+done
+
+BDIR2=( crypt monte moldyn labyrinth sor mergesort )
+BCOM2=( JGFCryptBench JGFMonteCarloBench JGFMolDynBenchSizeB Labyrinth JGFSORBenchSizeD MergeSort4 )
+BARGS2=( "2 43 1" "" "1 215" "-w 22 -i ./inputs/random-x7-y512-z512-n512.txt" "" "134217728 32 1" )
+
+for((i=0; i<${#BDIR2[@]}; i++))
+do
+cd $CURDIR/${BDIR2[$i]}
+  make rcrpointer
+  ./${BCOM2[$i]}r.bin ${BARGS2[$i]} > $DOJF
+  if [ $(grep -c VALID $DOJF) -ne 0 ]
+  then
+    echo ${BDIR2[$i]} >> $DIF    
+  else
+    echo ${BDIR2[$i]} "FAIL" >> $DIF  
+  fi
+  rm -f $DOJF
+  make clean;
+done
\ No newline at end of file
index 2d56f36d052e690edcad6cd3d52e430cf6ca3937..cc24ba7e78942020901444031473a1bf3a943862 100644 (file)
@@ -86,7 +86,7 @@ public class JGFSORBench {
       System.out.println("Validation failed");
       System.out.println("Gtotal = " + Gtotal + "  dev=" + dev + "  sizeParam=" + size);
     }else{
-      System.out.println("Validataion Success! dev="+dev);
+      System.out.println("VALID dev="+dev);
     }
 
   }
index 51fea46e36f8b87e318025ecccefc0d8e782127d..7d0d37306c35147a608db08b7868f6e557c1197a 100644 (file)
@@ -73,10 +73,12 @@ public class TestRunner // Voronoi
     long start1 = System.currentTimeMillis();
     Edge edge = point.buildDelaunayTriangulation(extra, 0);
     long end1 = System.currentTimeMillis();
-    System.out.println("Build time " + (end0 - start0) / 1000.0);
-    System.out.println("Compute  time " + (end1 - start1) / 1000.0);
-    System.out.println("Total time " + (end1 - start0) / 1000.0);
-    System.out.println("Done!");
+    if (!printResults){
+      System.out.println("Build time " + (end0 - start0) / 1000.0);
+      System.out.println("Compute  time " + (end1 - start1) / 1000.0);
+      System.out.println("Total time " + (end1 - start0) / 1000.0);
+      System.out.println("Done!");
+    }
 
     if (printResults)
       edge.outputVoronoiDiagram();