Remove unnecessary files
authoradash <adash>
Wed, 14 May 2008 00:19:06 +0000 (00:19 +0000)
committeradash <adash>
Wed, 14 May 2008 00:19:06 +0000 (00:19 +0000)
Remove print statements from benchmarks
Modify java version for Moldyn benchmark
make changes to most makefiles to be compliant with our run.sh script
add a new script(ang.sh) to calculate averages in the runlog directory

35 files changed:
Robust/src/Benchmarks/Prefetch/Array/makefile
Robust/src/Benchmarks/Prefetch/Chase/makefile
Robust/src/Benchmarks/Prefetch/Crypt/dsm/crypt/IDEATest.java
Robust/src/Benchmarks/Prefetch/Crypt/dsm/makefile
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Barrier.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraphN.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d1.java [deleted file]
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java [deleted file]
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d4.java [deleted file]
Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dN.java
Robust/src/Benchmarks/Prefetch/Em3d/dsm/README [new file with mode: 0644]
Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile
Robust/src/Benchmarks/Prefetch/LUFact/dsm/Barrier.java
Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile
Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply1.java [deleted file]
Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply2.java [deleted file]
Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply4.java [deleted file]
Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile
Robust/src/Benchmarks/Prefetch/Moldyn/dsm/DebugBarrier.java
Robust/src/Benchmarks/Prefetch/Moldyn/java/Barrier.java [new file with mode: 0644]
Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFInstrumentor.java
Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBench.java
Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBenchSizeA.java
Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFTimer.java
Robust/src/Benchmarks/Prefetch/Moldyn/java/makefile
Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile
Robust/src/Benchmarks/Prefetch/avg.sh [new file with mode: 0755]
Robust/src/Benchmarks/Prefetch/bm.txt
Robust/src/Benchmarks/Prefetch/run.sh
Robust/src/Benchmarks/Prefetch/threadv1.0/section2/JGFCryptBenchSizeA.java [deleted file]
Robust/src/Benchmarks/Prefetch/threadv1.0/section2/crypt/IDEATest.java [deleted file]
Robust/src/Benchmarks/Prefetch/threadv1.0/section2/crypt/JGFCryptBench.java [deleted file]
Robust/src/Benchmarks/Prefetch/threadv1.0/section2/jgfutil/JGFInstrumentor.java [deleted file]
Robust/src/Benchmarks/Prefetch/threadv1.0/section2/jgfutil/JGFTimer.java [deleted file]
Robust/src/Benchmarks/Prefetch/threadv1.0/section2/makefile [deleted file]

index b1ebcdbfd0231de00ae5d250d96b53fa83902163..4ea4c33df1d9f519994324a867b95f5269279f36 100644 (file)
@@ -1,10 +1,12 @@
 MAINCLASS=Array
 SRC1=${MAINCLASS}.java
-FLAGS=-dsm -prefetch -optimize -debug -excprefetch Array.Array -mainclass ${MAINCLASS} -trueprob 0.7
-FLAGS2=-dsm -optimize -debug -excprefetch Array.Array -mainclass ${MAINCLASS} -trueprob 0.7
+FLAGS=-dsm -prefetch -optimize -debug -excprefetch Array.Array -mainclass ${MAINCLASS} -trueprob 0.98
+FLAGS2=-dsm -optimize -debug -excprefetch Array.Array -mainclass ${MAINCLASS}
 default:
        ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC1}
        ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
+       cp ${MAINCLASS}NP.bin ${MAINCLASS}1NP.bin
+       cp ${MAINCLASS}P.bin ${MAINCLASS}1.bin
 
 clean:
        rm *.bin
index 96dc9711f8e0c55fdb040b43a74e2b3ae1d330e6..89d610d825e26e211762e1e781d94c2357e16faa 100644 (file)
@@ -2,9 +2,13 @@ MAINCLASS=Chase
 SRC1=${MAINCLASS}.java
 FLAGS=-dsm -prefetch -optimize -debug -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.7
 FLAGS2=-dsm -optimize -debug -mainclass ${MAINCLASS} -trueprob 0.7
+#for testing no java option
+#FLAGS=-dsm -prefetch -optimize -debug -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.99 -nojava
 default:
        ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC1}
        ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
+       cp ${MAINCLASS}NP.bin ${MAINCLASS}1NP.bin
+       cp ${MAINCLASS}P.bin ${MAINCLASS}1.bin
 
 clean:
        rm *.bin
index 02a76446993d50fd4adc298e8f9d711c732b62f0..550224daa6718da63cecaf5d99eb574c4b157294 100644 (file)
@@ -39,6 +39,7 @@
 
 //import java.util.*;
 //import jgfutil.*; 
+/*
 
 class IDEATest
 {
@@ -58,21 +59,21 @@ class IDEATest
     int [] Z;             // Encryption subkey (userkey derived).
     int [] DK;            // Decryption subkey (userkey derived).
 
-    void Do(int nthreads, JGFInstrumentor instr)
+    void Do(int nthreads)
     {
 
         int mid = (128<<24)|(195<<16)|(175<<8)|73;
 
-        IDEARunner tmp;
         IDEARunner[] th;
         atomic {
             th = global new IDEARunner [nthreads];
         }
 
         // Start the stopwatch.       
-        instr.startTimer("Section2:Crypt:Kernel");             
+        //instr.startTimer("Section2:Crypt:Kernel");           
 
         // Encrypt plain1.
+        IDEARunner tmp;
         for(int i=1;i<nthreads;i++) {
             atomic {
                 th[i] = global new IDEARunner(i,plain1,crypt1,Z,nthreads);
@@ -120,7 +121,7 @@ class IDEATest
 
 
         // Stop the stopwatch.
-        instr.stopTimer("Section2:Crypt:Kernel");
+        //instr.stopTimer("Section2:Crypt:Kernel");
 
     }
 
@@ -136,12 +137,13 @@ class IDEATest
         // Create three byte arrays that will be used (and reused) for
         // encryption/decryption operations.
 
-        plain1 = new byte [array_rows];
-        crypt1 = new byte [array_rows];
-        plain2 = new byte [array_rows];
 
+        plain1 = global new byte [array_rows];
+        crypt1 = global new byte [array_rows];
+        plain2 = global new byte [array_rows];
 
-        Random rndnum = new Random(136506717L);  // Create random number generator.
+
+        Random rndnum = global new Random(136506717L);  // Create random number generator.
 
 
         // Allocate three arrays to hold keys: userkey is the 128-bit key.
@@ -154,9 +156,9 @@ class IDEATest
         // then a final output transform with four of the keys; (8 * 6)
         // + 4 = 52 subkeys.
 
-        userkey = new short [8];  // User key has 8 16-bit shorts.
-        Z = new int [52];         // Encryption subkey (user key derived).
-        DK = new int [52];        // Decryption subkey (user key derived).
+        userkey = global new short [8];  // User key has 8 16-bit shorts.
+        Z = global new int [52];         // Encryption subkey (user key derived).
+        DK = global new int [52];        // Decryption subkey (user key derived).
 
         // Generate user key randomly; eight 16-bit values in an array.
 
@@ -418,10 +420,10 @@ class IDEATest
     }
 
 }
+*/
 
 
-
-class IDEARunner extends Thread {
+public class IDEARunner extends Thread {
 
     int id,key[];
     byte text1[],text2[];
@@ -588,12 +590,3 @@ class IDEARunner extends Thread {
 
     }   // End routine.
 }  // End of class
-
-
-
-
-
-
-
-
-
index f11310c5cc61f60eb4d8697cb6ff53175eb8f70f..c1f54177f37984effeb62f4f7300194c6aed6843 100644 (file)
@@ -4,7 +4,7 @@ jgfutil/JGFInstrumentor.java \
 jgfutil/JGFTimer.java \
 crypt/JGFCryptBench.java
 FLAGS=-dsm -prefetch -excprefetch JGFCryptBench.buildTestData -excprefetch JGFCryptBench.JGFvalidate -excprefetch JGFCryptBench.calcDecryptKey -excprefetch JGFCryptBench.freeTestData -excprefetch JGFCryptBench.calcEncryptKey -excprefetch JGFCryptBenchSizeA.main -excprefetch JGFCryptBench.JGFinitialise -excprefetch JGFCryptBench.JGFvalidate -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8
-FLAGS2=-dsm -excprefetch JGFCryptBench.buildTestData -excprefetch JGFCryptBench.JGFvalidate -excprefetch JGFCryptBench.calcDecryptKey -excprefetch JGFCryptBench.freeTestData -excprefetch JGFCryptBench.calcEncryptKey -excprefetch JGFCryptBenchSizeA.main -excprefetch JGFCryptBench.JGFinitialise -excprefetch JGFCryptBench.JGFvalidate -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP
+FLAGS2=-dsm -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP
 
 default:
        ../../../../buildscript ${FLAGS2} ${SRC}
index fda1503f1e6c835619a50178b7e71b82067d7e3e..8429289d6d9dca15cab4c5133fbd8f225593afc4 100644 (file)
@@ -30,14 +30,15 @@ public class Barrier {
             if(b.numthreads > 1)
               b.cleared=true;
             b.entercount--;
-            //return;
             ret1 = true;
           }
           retry=false;
         }
       }
     } while(retry);
-    if (ret1) return;
+    if (ret1) {
+      return;
+    }
     while(ret2) {
       atomic {
         if (b.cleared) {
@@ -45,7 +46,6 @@ public class Barrier {
           int count = b.entercount;
           if (count==0)
             b.cleared=false;
-          //return;
           ret2=false;
         }
       }
index 19793c1d8d0a9ed2c9a8b56081f3c215a63e90c5..fdcf37b1dda8f05207a6045d80fe7f99d11b150b 100644 (file)
@@ -97,7 +97,7 @@ public class BiGraph
    **/
   public void makeNeighbors( int indexBegin, int indexEnd, Random r )
   {
-      System.printString( "Making unique neighbors for hNodes...\n" );
+      //System.printString( "Making unique neighbors for hNodes...\n" );
 
       // making neighbors
       //if (verbose) System.printString("updating from and coeffs");
@@ -106,7 +106,7 @@ public class BiGraph
          n.makeUniqueNeighbors(eNodes, r);
       }
 
-      System.printString( "Making unique neighbors for eNodes...\n" );
+      //System.printString( "Making unique neighbors for eNodes...\n" );
 
       for (int i = indexBegin; i < indexEnd; i++) {
          Node n = eNodes[i];
@@ -117,7 +117,7 @@ public class BiGraph
 
   public void makeFromNodes( int indexBegin, int indexEnd )
   {
-      System.printString( "Making h fromNodes...\n" );
+      //System.printString( "Making h fromNodes...\n" );
 
       // Create the fromNodes and coeff field
       //if (verbose) System.printString("filling from fields");
@@ -126,7 +126,7 @@ public class BiGraph
          n.makeFromNodes();
       }
       
-      System.printString( "Making e fromNodes...\n" );
+      //System.printString( "Making e fromNodes...\n" );
 
       for(int i = indexBegin; i < indexEnd; i++) {
          Node n = eNodes[i];
@@ -137,7 +137,7 @@ public class BiGraph
 
   public void makeFromLinks( int indexBegin, int indexEnd, Random r )
   {
-      System.printString( "Updating h fromNodes...\n" );
+      //System.printString( "Updating h fromNodes...\n" );
 
       // Update the fromNodes
       for(int i = indexBegin; i < indexEnd; i++) {
@@ -145,7 +145,7 @@ public class BiGraph
          n.updateFromNodes(r);
       }
 
-      System.printString( "Updating e fromNodes...\n" );
+      //System.printString( "Updating e fromNodes...\n" );
 
       for(int i = indexBegin; i < indexEnd; i++) {
          Node n = eNodes[i];
diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d1.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d1.java
deleted file mode 100644 (file)
index b9a04f5..0000000
+++ /dev/null
@@ -1,237 +0,0 @@
-/** 
- *
- *
- * Java implementation of the <tt>em3d</tt> Olden benchmark.  This Olden
- * benchmark models the propagation of electromagnetic waves through
- * objects in 3 dimensions. It is a simple computation on an irregular
- * bipartite graph containing nodes representing electric and magnetic
- * field values.
- *
- * <p><cite>
- * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von 
- * Eicken and K. Yelick. "Parallel Programming in Split-C".  Supercomputing
- * 1993, pages 262-273.
- * </cite>
- **/
-public class Em3d extends Thread
-{
-
-  /**
-   * The number of nodes (E and H) 
-   **/
-  private int numNodes;
-  /**
-   * The out-degree of each node.
-   **/
-  private int numDegree;
-  /**
-   * The number of compute iterations 
-   **/
-  private int numIter;
-  /**
-   * Should we print the results and other runtime messages
-   **/
-  private boolean printResult;
-  /**
-   * Print information messages?
-   **/
-  private boolean printMsgs;
-
-  BiGraph bg;
-  int upperlimit;
-  int lowerlimit;
-  Barrier mybarr;
-
-  public Em3d() {
-    numNodes = 0;
-    numDegree = 0;
-    numIter = 1;
-    printResult = false;
-    printMsgs = false;
-  }
-
-  public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) {
-    this.bg = bg;
-    this.lowerlimit = lowerlimit;
-    this.upperlimit = upperlimit;
-    this.numIter = numIter;
-    this.mybarr = mybarr;
-  }
-
-  public void run() {
-    int iteration;
-    Barrier barr;
-    Node enodebase;
-    Node hnodebase;
-
-    atomic {
-      iteration = numIter;
-      barr=mybarr;
-    }
-    atomic {
-       enodebase=bg.eNodes;
-       hnodebase=bg.hNodes;
-       for(int j = 0; j<lowerlimit; j++){
-           enodebase = enodebase.next;
-           hnodebase = hnodebase.next;
-       }
-    }
-
-    for (int i = 0; i < iteration; i++) {
-      /* for  eNodes */
-       atomic {
-           Node n = enodebase;
-           for(int j = lowerlimit; j<upperlimit; j++) {
-               for (int k = 0; k < n.fromCount; k++) {
-                   n.value -= n.coeffs[k] * n.fromNodes[k].value;
-               }
-               n = n.next;
-           }
-       }
-       
-       Barrier.enterBarrier(barr);
-       System.clearPrefetchCache();
-
-       /* for  hNodes */
-       atomic {
-           Node n = hnodebase;
-           for(int j = lowerlimit; j<upperlimit; j++) {
-               for (int k = 0; k < n.fromCount; k++) {
-                   n.value -= n.coeffs[k] * n.fromNodes[k].value;
-               }
-               n=n.next;
-           }
-       }
-       Barrier.enterBarrier(barr);
-       System.clearPrefetchCache();
-    }
-  }
-
-  /**
-   * The main roitine that creates the irregular, linked data structure
-   * that represents the electric and magnetic fields and propagates the
-   * waves through the graph.
-   * @param args the command line arguments
-   **/
-  public static void main(String args[]) {
-    Em3d em = new Em3d();
-    Em3d.parseCmdLine(args, em);
-    if (em.printMsgs) 
-      System.printString("Initializing em3d random graph...\n");
-    long start0 = System.currentTimeMillis();
-    int numThreads = 1;
-    int[] mid = new int[numThreads];
-    mid[0] = (128<<24)|(195<<16)|(175<<8)|79;
-    System.printString("DEBUG -> numThreads = " + numThreads+"\n");
-    Barrier mybarr;
-    atomic {
-      mybarr = global new Barrier(numThreads);
-    }
-    BiGraph graph;
-    Random rand = new Random(783);
-    atomic {
-      graph =  BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand);
-    }
-
-    long end0 = System.currentTimeMillis();
-
-    // compute a single iteration of electro-magnetic propagation
-    if (em.printMsgs) 
-      System.printString("Propagating field values for " + em.numIter + 
-          " iteration(s)...\n");
-    long start1 = System.currentTimeMillis();
-    Em3d[] em3d;
-    atomic {
-      em3d = global new Em3d[numThreads];
-      em3d[0] = global new Em3d(graph, 0, em.numNodes, em.numIter, mybarr);
-    }
-
-    Em3d tmp;
-    for(int i = 0; i<numThreads; i++) {
-      atomic {
-        tmp = em3d[i];
-      }
-      tmp.start(mid[i]);
-    }
-
-    for(int i = 0; i<numThreads; i++) {
-      atomic { 
-        tmp = em3d[i];
-      }
-      tmp.join();
-    }
-    long end1 = System.currentTimeMillis();
-
-    // print current field values
-    if (em.printResult) {
-      StringBuffer retval = new StringBuffer();
-      double dvalue;
-      atomic {
-        dvalue = graph.hNodes.value;
-      }
-      int intvalue = (int)dvalue;
-    }
-
-    if (em.printMsgs) {
-      System.printString("EM3D build time "+ (long)((end0 - start0)/1000.0) + "\n");
-      System.printString("EM3D compute time " + (long)((end1 - start1)/1000.0) + "\n");
-      System.printString("EM3D total time " + (long)((end1 - start0)/1000.0) + "\n");
-    }
-    System.printString("Done!"+ "\n");
-  }
-
-
-  /**
-   * Parse the command line options.
-   * @param args the command line options.
-   **/
-
-  public static void parseCmdLine(String args[], Em3d em)
-  {
-    int i = 0;
-    String arg;
-
-    while (i < args.length && args[i].startsWith("-")) {
-      arg = args[i++];
-
-      // check for options that require arguments
-      if (arg.equals("-N")) {
-        if (i < args.length) {
-               em.numNodes = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-d")) {
-        if (i < args.length) {
-               em.numDegree = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-i")) {
-        if (i < args.length) {
-            em.numIter = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-p")) {
-             em.printResult = true;
-      } else if (arg.equals("-m")) {
-             em.printMsgs = true;
-      } else if (arg.equals("-h")) {
-        em.usage();
-      }
-    }
-
-    if (em.numNodes == 0 || em.numDegree == 0) 
-      em.usage();
-  }
-
-  /**
-   * The usage routine which describes the program options.
-   **/
-  public void usage()
-  {
-    System.printString("usage: java Em3d -N <nodes> -d <degree> [-p] [-m] [-h]\n");
-    System.printString("    -N the number of nodes\n");
-    System.printString("    -d the out-degree of each node\n");
-    System.printString("    -i the number of iterations\n");
-    System.printString("    -p (print detailed results\n)");
-    System.printString("    -m (print informative messages)\n");
-    System.printString("    -h (this message)\n");
-  }
-
-}
diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java
deleted file mode 100644 (file)
index 22bda0a..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-/** 
- *
- *
- * Java implementation of the <tt>em3d</tt> Olden benchmark.  This Olden
- * benchmark models the propagation of electromagnetic waves through
- * objects in 3 dimensions. It is a simple computation on an irregular
- * bipartite graph containing nodes representing electric and magnetic
- * field values.
- *
- * <p><cite>
- * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von 
- * Eicken and K. Yelick. "Parallel Programming in Split-C".  Supercomputing
- * 1993, pages 262-273.
- * </cite>
- **/
-public class Em3d extends Thread
-{
-
-  /**
-   * The number of nodes (E and H) 
-   **/
-  private int numNodes;
-  /**
-   * The out-degree of each node.
-   **/
-  private int numDegree;
-  /**
-   * The number of compute iterations 
-   **/
-  private int numIter;
-  /**
-   * Should we print the results and other runtime messages
-   **/
-  private boolean printResult;
-  /**
-   * Print information messages?
-   **/
-  private boolean printMsgs;
-
-  BiGraph bg;
-  int upperlimit;
-  int lowerlimit;
-  Barrier mybarr;
-
-  public Em3d() {
-    numNodes = 0;
-    numDegree = 0;
-    numIter = 1;
-    printResult = false;
-    printMsgs = false;
-  }
-
-  public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) {
-    this.bg = bg;
-    this.lowerlimit = lowerlimit;
-    this.upperlimit = upperlimit;
-    this.numIter = numIter;
-    this.mybarr = mybarr;
-  }
-
-  public void run() {
-    int iteration;
-    Barrier barr;
-    Node enodebase;
-    Node hnodebase;
-
-    atomic {
-      iteration = numIter;
-      barr=mybarr;
-    }
-    atomic {
-       enodebase=bg.eNodes;
-       hnodebase=bg.hNodes;
-       for(int j = 0; j<lowerlimit; j++){
-           enodebase = enodebase.next;
-           hnodebase = hnodebase.next;
-       }
-    }
-
-    for (int i = 0; i < iteration; i++) {
-      /* for  eNodes */
-       atomic {
-           Node n = enodebase;
-           for(int j = lowerlimit; j<upperlimit; j++) {
-               for (int k = 0; k < n.fromCount; k++) {
-                   n.value -= n.coeffs[k] * n.fromNodes[k].value;
-               }
-               n = n.next;
-           }
-       }
-       
-       Barrier.enterBarrier(barr);
-       System.clearPrefetchCache();
-
-       /* for  hNodes */
-       atomic {
-           Node n = hnodebase;
-           for(int j = lowerlimit; j<upperlimit; j++) {
-               for (int k = 0; k < n.fromCount; k++) {
-                   n.value -= n.coeffs[k] * n.fromNodes[k].value;
-               }
-               n=n.next;
-           }
-       }
-       Barrier.enterBarrier(barr);
-       System.clearPrefetchCache();
-    }
-  }
-
-  /**
-   * The main roitine that creates the irregular, linked data structure
-   * that represents the electric and magnetic fields and propagates the
-   * waves through the graph.
-   * @param args the command line arguments
-   **/
-  public static void main(String args[]) {
-    Em3d em = new Em3d();
-    Em3d.parseCmdLine(args, em);
-    if (em.printMsgs) 
-      System.printString("Initializing em3d random graph...\n");
-    long start0 = System.currentTimeMillis();
-    int numThreads = 2;
-    int[] mid = new int[numThreads];
-    mid[0] = (128<<24)|(195<<16)|(175<<8)|78;
-    mid[1] = (128<<24)|(195<<16)|(175<<8)|79;
-    System.printString("DEBUG -> numThreads = " + numThreads+"\n");
-    Barrier mybarr;
-    atomic {
-      mybarr = global new Barrier(numThreads);
-    }
-    BiGraph graph;
-    Random rand = new Random(783);
-    atomic {
-      graph =  BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand);
-    }
-
-    long end0 = System.currentTimeMillis();
-
-    // compute a single iteration of electro-magnetic propagation
-    if (em.printMsgs) 
-      System.printString("Propagating field values for " + em.numIter + 
-          " iteration(s)...\n");
-    long start1 = System.currentTimeMillis();
-    Em3d[] em3d;
-    atomic {
-      em3d = global new Em3d[numThreads];
-      em3d[0] = global new Em3d(graph, 0, em.numNodes/2, em.numIter, mybarr);
-      em3d[1] = global new Em3d(graph, (em.numNodes/2) + 1, em.numNodes, em.numIter, mybarr);
-    }
-
-    Em3d tmp;
-    for(int i = 0; i<numThreads; i++) {
-      atomic {
-        tmp = em3d[i];
-      }
-      tmp.start(mid[i]);
-    }
-
-    for(int i = 0; i<numThreads; i++) {
-      atomic { 
-        tmp = em3d[i];
-      }
-      tmp.join();
-    }
-    long end1 = System.currentTimeMillis();
-
-    // print current field values
-    if (em.printResult) {
-      StringBuffer retval = new StringBuffer();
-      double dvalue;
-      atomic {
-        dvalue = graph.hNodes.value;
-      }
-      int intvalue = (int)dvalue;
-    }
-
-    if (em.printMsgs) {
-      System.printString("EM3D build time "+ (long)((end0 - start0)/1000.0) + "\n");
-      System.printString("EM3D compute time " + (long)((end1 - start1)/1000.0) + "\n");
-      System.printString("EM3D total time " + (long)((end1 - start0)/1000.0) + "\n");
-    }
-    System.printString("Done!"+ "\n");
-  }
-
-
-  /**
-   * Parse the command line options.
-   * @param args the command line options.
-   **/
-
-  public static void parseCmdLine(String args[], Em3d em)
-  {
-    int i = 0;
-    String arg;
-
-    while (i < args.length && args[i].startsWith("-")) {
-      arg = args[i++];
-
-      // check for options that require arguments
-      if (arg.equals("-N")) {
-        if (i < args.length) {
-               em.numNodes = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-d")) {
-        if (i < args.length) {
-               em.numDegree = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-i")) {
-        if (i < args.length) {
-            em.numIter = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-p")) {
-             em.printResult = true;
-      } else if (arg.equals("-m")) {
-             em.printMsgs = true;
-      } else if (arg.equals("-h")) {
-        em.usage();
-      }
-    }
-
-    if (em.numNodes == 0 || em.numDegree == 0) 
-      em.usage();
-  }
-
-  /**
-   * The usage routine which describes the program options.
-   **/
-  public void usage()
-  {
-    System.printString("usage: java Em3d -N <nodes> -d <degree> [-p] [-m] [-h]\n");
-    System.printString("    -N the number of nodes\n");
-    System.printString("    -d the out-degree of each node\n");
-    System.printString("    -i the number of iterations\n");
-    System.printString("    -p (print detailed results\n)");
-    System.printString("    -m (print informative messages)\n");
-    System.printString("    -h (this message)\n");
-  }
-
-}
diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d4.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d4.java
deleted file mode 100644 (file)
index 73c71fa..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-/** 
- *
- *
- * Java implementation of the <tt>em3d</tt> Olden benchmark.  This Olden
- * benchmark models the propagation of electromagnetic waves through
- * objects in 3 dimensions. It is a simple computation on an irregular
- * bipartite graph containing nodes representing electric and magnetic
- * field values.
- *
- * <p><cite>
- * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von 
- * Eicken and K. Yelick. "Parallel Programming in Split-C".  Supercomputing
- * 1993, pages 262-273.
- * </cite>
- **/
-public class Em3d extends Thread
-{
-
-  /**
-   * The number of nodes (E and H) 
-   **/
-  private int numNodes;
-  /**
-   * The out-degree of each node.
-   **/
-  private int numDegree;
-  /**
-   * The number of compute iterations 
-   **/
-  private int numIter;
-  /**
-   * Should we print the results and other runtime messages
-   **/
-  private boolean printResult;
-  /**
-   * Print information messages?
-   **/
-  private boolean printMsgs;
-
-  BiGraph bg;
-  int upperlimit;
-  int lowerlimit;
-  Barrier mybarr;
-
-  public Em3d() {
-    numNodes = 0;
-    numDegree = 0;
-    numIter = 1;
-    printResult = false;
-    printMsgs = false;
-  }
-
-  public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) {
-    this.bg = bg;
-    this.lowerlimit = lowerlimit;
-    this.upperlimit = upperlimit;
-    this.numIter = numIter;
-    this.mybarr = mybarr;
-  }
-
-  public void run() {
-    int iteration;
-    Barrier barr;
-    Node enodebase;
-    Node hnodebase;
-
-    atomic {
-      iteration = numIter;
-      barr=mybarr;
-    }
-    atomic {
-       enodebase=bg.eNodes;
-       hnodebase=bg.hNodes;
-       for(int j = 0; j<lowerlimit; j++){
-           enodebase = enodebase.next;
-           hnodebase = hnodebase.next;
-       }
-    }
-
-    for (int i = 0; i < iteration; i++) {
-      /* for  eNodes */
-       atomic {
-           Node n = enodebase;
-           for(int j = lowerlimit; j<upperlimit; j++) {
-               for (int k = 0; k < n.fromCount; k++) {
-                   n.value -= n.coeffs[k] * n.fromNodes[k].value;
-               }
-               n = n.next;
-           }
-       }
-       
-       Barrier.enterBarrier(barr);
-       System.clearPrefetchCache();
-
-       /* for  hNodes */
-       atomic {
-           Node n = hnodebase;
-           for(int j = lowerlimit; j<upperlimit; j++) {
-               for (int k = 0; k < n.fromCount; k++) {
-                   n.value -= n.coeffs[k] * n.fromNodes[k].value;
-               }
-               n=n.next;
-           }
-       }
-       Barrier.enterBarrier(barr);
-       System.clearPrefetchCache();
-    }
-  }
-
-  /**
-   * The main roitine that creates the irregular, linked data structure
-   * that represents the electric and magnetic fields and propagates the
-   * waves through the graph.
-   * @param args the command line arguments
-   **/
-  public static void main(String args[]) {
-    Em3d em = new Em3d();
-    Em3d.parseCmdLine(args, em);
-    if (em.printMsgs) 
-      System.printString("Initializing em3d random graph...\n");
-    long start0 = System.currentTimeMillis();
-    int numThreads = 4;
-    int[] mid = new int[numThreads];
-    mid[0] = (128<<24)|(195<<16)|(175<<8)|80;
-    mid[1] = (128<<24)|(195<<16)|(175<<8)|78;
-    mid[2] = (128<<24)|(195<<16)|(175<<8)|73;
-    mid[3] = (128<<24)|(195<<16)|(175<<8)|79;
-    System.printString("DEBUG -> numThreads = " + numThreads+"\n");
-    Barrier mybarr;
-    atomic {
-      mybarr = global new Barrier(numThreads);
-    }
-    BiGraph graph;
-    Random rand = new Random(783);
-    atomic {
-      graph =  BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand);
-    }
-
-    long end0 = System.currentTimeMillis();
-
-    // compute a single iteration of electro-magnetic propagation
-    if (em.printMsgs) 
-      System.printString("Propagating field values for " + em.numIter + 
-          " iteration(s)...\n");
-    long start1 = System.currentTimeMillis();
-    Em3d[] em3d;
-    atomic {
-      em3d = global new Em3d[numThreads];
-      em3d[0] = global new Em3d(graph, 0, em.numNodes/4, em.numIter, mybarr);
-      em3d[1] = global new Em3d(graph, (em.numNodes/4) + 1, em.numNodes/2, em.numIter, mybarr);
-      em3d[2] = global new Em3d(graph, (em.numNodes/2) + 1, (3*em.numNodes)/4, em.numIter, mybarr);
-      em3d[3] = global new Em3d(graph, ((3*em.numNodes)/4 + 1), em.numNodes, em.numIter, mybarr);
-    }
-
-    Em3d tmp;
-    for(int i = 0; i<numThreads; i++) {
-      atomic {
-        tmp = em3d[i];
-      }
-      tmp.start(mid[i]);
-    }
-
-    for(int i = 0; i<numThreads; i++) {
-      atomic { 
-        tmp = em3d[i];
-      }
-      tmp.join();
-    }
-    long end1 = System.currentTimeMillis();
-
-    // print current field values
-    if (em.printResult) {
-      StringBuffer retval = new StringBuffer();
-      double dvalue;
-      atomic {
-        dvalue = graph.hNodes.value;
-      }
-      int intvalue = (int)dvalue;
-    }
-
-    if (em.printMsgs) {
-      System.printString("EM3D build time "+ (long)((end0 - start0)/1000.0) + "\n");
-      System.printString("EM3D compute time " + (long)((end1 - start1)/1000.0) + "\n");
-      System.printString("EM3D total time " + (long)((end1 - start0)/1000.0) + "\n");
-    }
-    System.printString("Done!"+ "\n");
-  }
-
-
-  /**
-   * Parse the command line options.
-   * @param args the command line options.
-   **/
-
-  public static void parseCmdLine(String args[], Em3d em)
-  {
-    int i = 0;
-    String arg;
-
-    while (i < args.length && args[i].startsWith("-")) {
-      arg = args[i++];
-
-      // check for options that require arguments
-      if (arg.equals("-N")) {
-        if (i < args.length) {
-               em.numNodes = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-d")) {
-        if (i < args.length) {
-               em.numDegree = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-i")) {
-        if (i < args.length) {
-            em.numIter = new Integer(args[i++]).intValue();
-        }
-      } else if (arg.equals("-p")) {
-             em.printResult = true;
-      } else if (arg.equals("-m")) {
-             em.printMsgs = true;
-      } else if (arg.equals("-h")) {
-        em.usage();
-      }
-    }
-
-    if (em.numNodes == 0 || em.numDegree == 0) 
-      em.usage();
-  }
-
-  /**
-   * The usage routine which describes the program options.
-   **/
-  public void usage()
-  {
-    System.printString("usage: java Em3d -N <nodes> -d <degree> [-p] [-m] [-h]\n");
-    System.printString("    -N the number of nodes\n");
-    System.printString("    -d the out-degree of each node\n");
-    System.printString("    -i the number of iterations\n");
-    System.printString("    -p (print detailed results\n)");
-    System.printString("    -m (print informative messages)\n");
-    System.printString("    -h (this message)\n");
-  }
-
-}
index b90711c6136a0908e9911c9c9fd9b926e9061e63..49113568f530a98fbc549b3f9668f6cb34b5926c 100644 (file)
@@ -166,8 +166,8 @@ public class Em3d extends Thread
     long start0 = System.currentTimeMillis();
     int numThreads = em.numThreads;
     int[] mid = new int[4];
-    mid[0] = (128<<24)|(195<<16)|(175<<8)|69;//dw-1
-    mid[1] = (128<<24)|(195<<16)|(175<<8)|70;//dw-2
+    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;
     System.printString("DEBUG -> numThreads = " + numThreads+"\n");
@@ -177,7 +177,7 @@ public class Em3d extends Thread
 
     
     // initialization step 1: allocate BiGraph
-    System.printString( "Allocating BiGraph.\n" );
+   // System.printString( "Allocating BiGraph.\n" );
 
     atomic {
       mybarr = global new Barrier(numThreads);
@@ -195,7 +195,7 @@ public class Em3d extends Thread
 
 
     // initialization step 2: divide work of allocating nodes
-    System.printString( "Launching distributed allocation of nodes.\n" );
+   // System.printString( "Launching distributed allocation of nodes.\n" );
 
     atomic {
       em3d = global new Em3d[numThreads];
@@ -225,7 +225,7 @@ public class Em3d extends Thread
 
     // initialization step 3: link together the ends of segments
     // that were allocated and internally linked in step 2
-    System.printString( "Linking together allocated segments.\n" );
+    // System.printString( "Linking together allocated segments.\n" );
 
     base = 0;
     for(int i = 0; i < numThreads - 1; i++) {
@@ -236,7 +236,7 @@ public class Em3d extends Thread
     }    
 
     // initialization step 4: divide work of making links
-    System.printString( "Launching distributed neighbor initialization.\n" );
+   // System.printString( "Launching distributed neighbor initialization.\n" );
 
     atomic {
       em3d = global new Em3d[numThreads];
@@ -265,7 +265,7 @@ public class Em3d extends Thread
     }
 
     // initialization step 5: divide work of making from links
-    System.printString( "Launching distributed makeFromNodes initialization.\n" );
+    //System.printString( "Launching distributed makeFromNodes initialization.\n" );
 
     atomic {
       em3d = global new Em3d[numThreads];
@@ -294,7 +294,7 @@ public class Em3d extends Thread
     }
 
     // initialization step 6: divide work of making from links
-    System.printString( "Launching distributed fromLink initialization.\n" );
+    //System.printString( "Launching distributed fromLink initialization.\n" );
 
     atomic {
       em3d = global new Em3d[numThreads];
@@ -323,7 +323,7 @@ public class Em3d extends Thread
     }
 
     // initialization complete
-    System.printString( "Initialization complete.\n" );
+    //System.printString( "Initialization complete.\n" );
 
     long end0 = System.currentTimeMillis();
 
diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/README b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/README
new file mode 100644 (file)
index 0000000..05de81f
--- /dev/null
@@ -0,0 +1,6 @@
+Create the dstm.conf file
+To compile:
+    make
+To run the Em3dNP.bin on single machine 
+    ./Em3dNP.bin master -T <number of threads> -N <number of nodes> -d <no of iteration> -p
+    
index f5ec498ff7dcb3d8ee019dbabbc85fe3f910012d..87b5a1271966b2b8d7d89decc9e5969980b0a64a 100644 (file)
@@ -3,17 +3,27 @@ SRC=${MAINCLASS}.java \
        BiGraph.java \
        Node.java \
        Barrier.java
-SRC1=${MAINCLASS}N.java \
-       BiGraphN.java \
+SRC1=${MAINCLASS}Nold.java \
+       BiGraphNold.java \
        Node.java \
        Barrier.java
 
-FLAGS=-dsm -prefetch -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}
-FLAGS2=-dsm -nooptimize -debug -mainclass ${MAINCLASS}
+FLAGS=-dsm -prefetch -profile -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
+FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS}
 
 default:
-       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC1}
-       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
+       ../../../../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
 
 clean:
        rm -rf tmpbuilddirectory
index fda1503f1e6c835619a50178b7e71b82067d7e3e..eb2bedeca5bb817c9d80137e1be1909ee9f74d9f 100644 (file)
@@ -30,7 +30,6 @@ public class Barrier {
             if(b.numthreads > 1)
               b.cleared=true;
             b.entercount--;
-            //return;
             ret1 = true;
           }
           retry=false;
@@ -45,7 +44,6 @@ public class Barrier {
           int count = b.entercount;
           if (count==0)
             b.cleared=false;
-          //return;
           ret2=false;
         }
       }
index 8b7b40f24fd2728f5989773012dfd238b9f4a6ca..3ad1cc01040d5f4718b649ed3f00dce03a782a48 100644 (file)
@@ -4,14 +4,21 @@ JGFLUFactBench.java \
 JGFInstrumentor.java \
 JGFTimer.java \
 Barrier.java \
-Linpack.java \
 LinpackRunner.java
-FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFLUFactBench.JGFkernel -excprefetch JGFLUFactBench.dmxpy -excprefetch JGFLUFactBench.JGFvalidate -excprefetch JGFLUFactBench.JGFinitialise -excprefetch JGFLUFactBench.matgen -excprefetch JGFLUFactBench.dgesl -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8
-FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP
+FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFLUFactBench.JGFkernel -excprefetch JGFLUFactBench.dmxpy -excprefetch JGFLUFactBench.JGFvalidate -excprefetch JGFLUFactBench.JGFinitialise -excprefetch JGFLUFactBench.matgen -excprefetch JGFLUFactBench.dgesl -mainclass ${MAINCLASS} -trueprob 0.95
+FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS}
 
 default:
-       ../../../../buildscript ${FLAGS2} ${SRC}
-       ../../../../buildscript ${FLAGS} ${SRC}
+#../../../../buildscript ${FLAGS2} ${SRC}
+#      ../../../../buildscript ${FLAGS} ${SRC}
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC}
+       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}1  ${SRC}
+       cp ${MAINCLASS}1NP.bin ${MAINCLASS}2NP.bin
+       cp ${MAINCLASS}1.bin ${MAINCLASS}2.bin
+       cp ${MAINCLASS}1NP.bin ${MAINCLASS}3NP.bin
+       cp ${MAINCLASS}1.bin ${MAINCLASS}3.bin
+       cp ${MAINCLASS}1NP.bin ${MAINCLASS}4NP.bin
+       cp ${MAINCLASS}1.bin ${MAINCLASS}4.bin
 
 clean:
        rm -rf tmpbuilddirectory
diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply1.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply1.java
deleted file mode 100644 (file)
index dc3b4bc..0000000
+++ /dev/null
@@ -1,174 +0,0 @@
-public class MatrixMultiply extends Thread{
-       MMul mmul;
-       public int x0, y0, x1, y1;
-
-       public MatrixMultiply(MMul mmul, int x0, int y0, int x1, int y1) {
-               this.mmul = mmul;
-               this.x0 = x0;
-               this.y0 = y0;
-               this.x1 = x1;
-               this.y1 = y1;
-       }
-
-       public void run() {
-               double localresults[][];
-
-               atomic {
-                   //compute the results
-                   localresults=new double[1+x1-x0][1+y1-y0];
-               
-                   //Use b transpose for cache performance
-                   for(int i = x0; i<= x1; i++){
-                       double a[]=mmul.a[i];
-                       int M=mmul.M;
-                       for (int j = y0; j <= y1; j++) {
-                           double innerProduct=0;
-                           double b[] = mmul.btranspose[j];
-                           for(int k = 0; k < M; k++) {
-                               innerProduct += a[k] *b[k];
-                           }
-                           localresults[i-x0][j-y0]=innerProduct;
-                       }
-                   }
-               }
-
-               atomic {
-                   //write the results
-                   for(int i=x0;i<=x1;i++) {
-                       double c[]=mmul.c[i];
-                       for(int j=y0;j<=y1;j++) {
-                           c[j]=localresults[i-x0][j-y0];
-                       }
-                   }
-               }
-       }
-
-    public static void main(String[] args) {
-      int NUM_THREADS = 1;
-      int[] mid = new int[NUM_THREADS];
-      mid[0] = (128<<24)|(195<<16)|(175<<8)|79;
-      int p, q, r;
-      MatrixMultiply[] mm;
-      MatrixMultiply tmp;
-      MMul matrix;
-
-      atomic {
-        matrix = global new MMul(600, 600, 600);
-        matrix.setValues();
-        matrix.transpose();
-      }
-
-      atomic{
-        mm = global new MatrixMultiply[NUM_THREADS];
-      }
-
-      atomic {
-        mm[0] = global new MatrixMultiply(matrix,0,0,599,599);
-      }
-
-      atomic {
-        p = matrix.L;
-        q = matrix.M;
-        r = matrix.N;
-      }
-
-      // print out the matrices to be multiplied
-      System.printString("\n");
-      System.printString("MatrixMultiply: L=");
-      System.printInt(p);
-      System.printString("\t");
-      System.printString("M=");
-      System.printInt(q);
-      System.printString("\t");
-      System.printString("N=");
-      System.printInt(r);
-      System.printString("\n");
-
-      // start a thread to compute each c[l,n]
-      for (int i = 0; i < NUM_THREADS; i++) {
-        atomic {
-          tmp = mm[i];
-        }
-        tmp.start(mid[i]);
-      }
-
-      // wait for them to finish
-      for (int i = 0; i < NUM_THREADS; i++) {
-        atomic {
-          tmp = mm[i];
-        }
-        tmp.join();
-      }
-
-      // print out the result of the matrix multiply
-      System.printString("Starting\n");
-      System.printString("Matrix Product c =\n");
-      double val;
-      atomic {
-        for (int i = 0; i < p; i++) {
-          double c[]=matrix.c[i];
-          for (int j = 0; j < r; j++) {
-            val = c[j];
-          }
-        }
-      }
-      System.printString("Finished\n");
-    }
-}
-
-public class MMul{
-
-  public int L, M, N;
-  public double[][] a;
-  public double[][] b;
-  public double[][] c;
-  public double[][] btranspose;
-
-  public MMul(int L, int M, int N) {
-    this.L = L;
-    this.M = M;
-    this.N = N;
-    a = global new double[L][M];  
-    b = global new double[M][N]; 
-    c = global new double[L][N]; 
-    btranspose = global new double[N][M];
-  }
-
-  public void setValues() {
-    for(int i = 0; i < L; i++) {
-      double ai[] = a[i];
-      for(int j = 0; j < M; j++) {
-        ai[j] = j+1;
-      }
-    }
-
-    for(int i = 0; i < M; i++) {
-      double bi[] = b[i];
-      for(int j = 0; j < N; j++) {
-        bi[j] = j+1;
-      }
-    }
-
-    for(int i = 0; i < L; i++) {
-      double ci[] = c[i];
-      for(int j = 0; j < N; j++) {
-        ci[j] = 0;
-      }
-    }
-    for(int i = 0; i < N; i++) {
-      double btransposei[] = btranspose[i];
-      for(int j = 0; j < M; j++) {
-        btransposei[j] = 0;
-      }
-    }
-  }
-
-  public void transpose() {
-    for(int row = 0; row < M; row++) {
-      double brow[] = b[row];
-      for(int col = 0; col < N; col++) {
-        btranspose[col][row] = brow[col];
-      }
-    }
-  }
-}
diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply2.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply2.java
deleted file mode 100644 (file)
index 1b17dd8..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-public class MatrixMultiply extends Thread{
-       MMul mmul;
-       public int x0, y0, x1, y1;
-
-       public MatrixMultiply(MMul mmul, int x0, int y0, int x1, int y1) {
-               this.mmul = mmul;
-               this.x0 = x0;
-               this.y0 = y0;
-               this.x1 = x1;
-               this.y1 = y1;
-       }
-
-       public void run() {
-               double localresults[][];
-
-               atomic {
-                   //compute the results
-                   localresults=new double[1+x1-x0][1+y1-y0];
-               
-                   //Use b transpose for cache performance
-                   for(int i = x0; i<= x1; i++){
-                       double a[]=mmul.a[i];
-                       int M=mmul.M;
-                       for (int j = y0; j <= y1; j++) {
-                           double innerProduct=0;
-                           double b[] = mmul.btranspose[j];
-                           for(int k = 0; k < M; k++) {
-                               innerProduct += a[k] *b[k];
-                           }
-                           localresults[i-x0][j-y0]=innerProduct;
-                       }
-                   }
-               }
-
-               atomic {
-                   //write the results
-                   for(int i=x0;i<=x1;i++) {
-                       double c[]=mmul.c[i];
-                       for(int j=y0;j<=y1;j++) {
-                           c[j]=localresults[i-x0][j-y0];
-                       }
-                   }
-               }
-       }
-
-    public static void main(String[] args) {
-      int NUM_THREADS = 2;
-      int[] mid = new int[NUM_THREADS];
-      mid[0] = (128<<24)|(195<<16)|(175<<8)|79;
-      mid[1] = (128<<24)|(195<<16)|(175<<8)|78;
-      int p, q, r;
-      MatrixMultiply[] mm;
-      MatrixMultiply tmp;
-      MMul matrix;
-
-      atomic {
-        matrix = global new MMul(600, 600, 600);
-        matrix.setValues();
-        matrix.transpose();
-      }
-
-      atomic{
-        mm = global new MatrixMultiply[NUM_THREADS];
-      }
-
-      atomic {
-        mm[0] = global new MatrixMultiply(matrix,0,0,599,300);
-        mm[1] = global new MatrixMultiply(matrix,0,301,599,599);
-      }
-
-      atomic {
-        p = matrix.L;
-        q = matrix.M;
-        r = matrix.N;
-      }
-
-      // print out the matrices to be multiplied
-      System.printString("\n");
-      System.printString("MatrixMultiply: L=");
-      System.printInt(p);
-      System.printString("\t");
-      System.printString("M=");
-      System.printInt(q);
-      System.printString("\t");
-      System.printString("N=");
-      System.printInt(r);
-      System.printString("\n");
-
-      // start a thread to compute each c[l,n]
-      for (int i = 0; i < NUM_THREADS; i++) {
-        atomic {
-          tmp = mm[i];
-        }
-        tmp.start(mid[i]);
-      }
-
-      // wait for them to finish
-      for (int i = 0; i < NUM_THREADS; i++) {
-        atomic {
-          tmp = mm[i];
-        }
-        tmp.join();
-      }
-
-      // print out the result of the matrix multiply
-      System.printString("Starting\n");
-      System.printString("Matrix Product c =\n");
-      double val;
-      atomic {
-        for (int i = 0; i < p; i++) {
-          double c[]=matrix.c[i];
-          for (int j = 0; j < r; j++) {
-            val = c[j];
-          }
-        }
-      }
-      System.printString("Finished\n");
-    }
-}
-
-public class MMul{
-
-  public int L, M, N;
-  public double[][] a;
-  public double[][] b;
-  public double[][] c;
-  public double[][] btranspose;
-
-  public MMul(int L, int M, int N) {
-    this.L = L;
-    this.M = M;
-    this.N = N;
-    a = global new double[L][M];  
-    b = global new double[M][N]; 
-    c = global new double[L][N]; 
-    btranspose = global new double[N][M];
-  }
-
-  public void setValues() {
-    for(int i = 0; i < L; i++) {
-      double ai[] = a[i];
-      for(int j = 0; j < M; j++) {
-        ai[j] = j+1;
-      }
-    }
-
-    for(int i = 0; i < M; i++) {
-      double bi[] = b[i];
-      for(int j = 0; j < N; j++) {
-        bi[j] = j+1;
-      }
-    }
-
-    for(int i = 0; i < L; i++) {
-      double ci[] = c[i];
-      for(int j = 0; j < N; j++) {
-        ci[j] = 0;
-      }
-    }
-    for(int i = 0; i < N; i++) {
-      double btransposei[] = btranspose[i];
-      for(int j = 0; j < M; j++) {
-        btransposei[j] = 0;
-      }
-    }
-  }
-
-  public void transpose() {
-    for(int row = 0; row < M; row++) {
-      double brow[] = b[row];
-      for(int col = 0; col < N; col++) {
-        btranspose[col][row] = brow[col];
-      }
-    }
-  }
-}
diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply4.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply4.java
deleted file mode 100644 (file)
index 029ead4..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-public class MatrixMultiply extends Thread{
-       MMul mmul;
-       public int x0, y0, x1, y1;
-
-       public MatrixMultiply(MMul mmul, int x0, int y0, int x1, int y1) {
-               this.mmul = mmul;
-               this.x0 = x0;
-               this.y0 = y0;
-               this.x1 = x1;
-               this.y1 = y1;
-       }
-
-       public void run() {
-               double localresults[][];
-
-               atomic {
-                   //compute the results
-                   localresults=new double[1+x1-x0][1+y1-y0];
-               
-                   //Use b transpose for cache performance
-                   for(int i = x0; i<= x1; i++){
-                       double a[]=mmul.a[i];
-                       int M=mmul.M;
-                       for (int j = y0; j <= y1; j++) {
-                           double innerProduct=0;
-                           double b[] = mmul.btranspose[j];
-                           for(int k = 0; k < M; k++) {
-                               innerProduct += a[k] *b[k];
-                           }
-                           localresults[i-x0][j-y0]=innerProduct;
-                       }
-                   }
-               }
-
-               atomic {
-                   //write the results
-                   for(int i=x0;i<=x1;i++) {
-                       double c[]=mmul.c[i];
-                       for(int j=y0;j<=y1;j++) {
-                           c[j]=localresults[i-x0][j-y0];
-                       }
-                   }
-               }
-       }
-
-       public static void main(String[] args) {
-      int NUM_THREADS = 4;
-      int[] mid = new int[NUM_THREADS];
-      mid[0] = (128<<24)|(195<<16)|(175<<8)|80;
-      mid[1] = (128<<24)|(195<<16)|(175<<8)|73;
-      mid[2] = (128<<24)|(195<<16)|(175<<8)|78;
-      mid[3] = (128<<24)|(195<<16)|(175<<8)|79;
-               //int mid1 = (128<<24)|(195<<16)|(175<<8)|69;
-               //int mid2 = (128<<24)|(195<<16)|(175<<8)|73;
-               int p, q, r;
-               MatrixMultiply[] mm;
-               MatrixMultiply tmp;
-               MMul matrix;
-
-               atomic {
-                       matrix = global new MMul(600, 600, 600);
-                       matrix.setValues();
-                       matrix.transpose();
-               }
-
-               atomic{
-                       mm = global new MatrixMultiply[NUM_THREADS];
-               }
-
-               atomic {
-                       mm[0] = global new MatrixMultiply(matrix,0,0,300,300);
-                       mm[1] = global new MatrixMultiply(matrix,0,301,300,599);
-                       mm[2] = global new MatrixMultiply(matrix,301,0,599,300);
-                       mm[3] = global new MatrixMultiply(matrix,301,301,599,599);
-               }
-
-               atomic {
-                       p = matrix.L;
-                       q = matrix.M;
-                       r = matrix.N;
-               }
-
-               // print out the matrices to be multiplied
-               System.printString("\n");
-               System.printString("MatrixMultiply: L=");
-               System.printInt(p);
-               System.printString("\t");
-               System.printString("M=");
-               System.printInt(q);
-               System.printString("\t");
-               System.printString("N=");
-               System.printInt(r);
-               System.printString("\n");
-
-               // start a thread to compute each c[l,n]
-               for (int i = 0; i < NUM_THREADS; i++) {
-                       atomic {
-                               tmp = mm[i];
-                       }
-                       tmp.start(mid[i]);
-               }
-
-               // wait for them to finish
-               for (int i = 0; i < NUM_THREADS; i++) {
-                       atomic {
-                               tmp = mm[i];
-                       }
-                       tmp.join();
-               }
-
-               // print out the result of the matrix multiply
-               System.printString("Starting\n");
-               System.printString("Matrix Product c =\n");
-               double val;
-               atomic {
-                       for (int i = 0; i < p; i++) {
-                               double c[]=matrix.c[i];
-                               for (int j = 0; j < r; j++) {
-                                       val = c[j];
-                               }
-                       }
-               }
-               System.printString("Finished\n");
-       }
-}
-
-public class MMul{
-
-       public int L, M, N;
-       public double[][] a;
-       public double[][] b;
-       public double[][] c;
-       public double[][] btranspose;
-
-       public MMul(int L, int M, int N) {
-               this.L = L;
-               this.M = M;
-               this.N = N;
-               a = global new double[L][M];  
-               b = global new double[M][N]; 
-               c = global new double[L][N]; 
-               btranspose = global new double[N][M];
-       }
-
-       public void setValues() {
-               for(int i = 0; i < L; i++) {
-            double ai[] = a[i];
-                       for(int j = 0; j < M; j++) {
-                               ai[j] = j+1;
-                       }
-               }
-
-               for(int i = 0; i < M; i++) {
-            double bi[] = b[i];
-                       for(int j = 0; j < N; j++) {
-                               bi[j] = j+1;
-                       }
-               }
-
-               for(int i = 0; i < L; i++) {
-            double ci[] = c[i];
-                       for(int j = 0; j < N; j++) {
-                               ci[j] = 0;
-                       }
-               }
-               for(int i = 0; i < N; i++) {
-            double btransposei[] = btranspose[i];
-                       for(int j = 0; j < M; j++) {
-                               btransposei[j] = 0;
-                       }
-               }
-       }
-
-       public void transpose() {
-               for(int row = 0; row < M; row++) {
-            double brow[] = b[row];
-                       for(int col = 0; col < N; col++) {
-                               btranspose[col][row] = brow[col];
-                       }
-               }
-       }
-}
index dcbce88ec22f48fc324c5a95babc93a269b27149..b73534f070b0c57ae3c4eeef23fce656a60d01da 100644 (file)
@@ -1,13 +1,19 @@
 MAINCLASS=MatrixMultiply
 SRC1=${MAINCLASS}N.java
 SRC2=${MAINCLASS}Nrun.java
-FLAGS=-dsm -prefetch -optimize -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.7
+FLAGS=-dsm -prefetch -optimize -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.90
 FLAGS2=-dsm -optimize -debug -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS}
 default:
-       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC1}
-       ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
-       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NrunNP ${SRC2}
-       ../../../buildscript ${FLAGS} -o ${MAINCLASS}NrunP ${SRC2}
+       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC1}
+       ../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
+       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC2}
+       ../../../buildscript ${FLAGS} -o ${MAINCLASS}1 ${SRC2}
+       cp ${MAINCLASS}1NP.bin ${MAINCLASS}2NP.bin
+       cp ${MAINCLASS}1.bin ${MAINCLASS}2.bin
+       cp ${MAINCLASS}1NP.bin ${MAINCLASS}3NP.bin
+       cp ${MAINCLASS}1.bin ${MAINCLASS}3.bin
+       cp ${MAINCLASS}1NP.bin ${MAINCLASS}4NP.bin
+       cp ${MAINCLASS}1.bin ${MAINCLASS}4.bin
 
 clean:
        rm *.bin
index eaddc75c35f62d193d0e3abd090f69c1d01abb9a..8dca6d7a9d267431a5dc3dd8ccb7ac65ae2fcc14 100644 (file)
@@ -4,7 +4,7 @@ public class Barrier {
   boolean cleared;
 
   public Barrier(int n) {
-      System.printString("Initializing barrier for "+n+" threads.\n");
+    //System.printString("Initializing barrier for "+n+" threads.\n");
     numthreads=n;
     cleared = false;
     entercount = 0;
@@ -24,7 +24,7 @@ public class Barrier {
 
     do {
       atomic {
-         System.printString("Entering barrier with ec="+b.entercount+" cl="+b.cleared+"\n");
+        //System.printString("Entering barrier with ec="+b.entercount+" cl="+b.cleared+"\n");
         if (!b.cleared) {
           b.entercount++;
           tmp = b.entercount;
@@ -32,14 +32,14 @@ public class Barrier {
             if(b.numthreads > 1)
               b.cleared=true;
             b.entercount--;
-           System.printString("Exiting Barrier #1\n");
+            //System.printString("Exiting Barrier #1\n");
             return;
           }
           retry=false;
         }
       }
     } while(retry);
-    System.printString("Waiting for last thread to enter\n");
+    //System.printString("Waiting for last thread to enter\n");
     while(true) {
       atomic {
         if (b.cleared) {
@@ -47,7 +47,7 @@ public class Barrier {
           int count = b.entercount;
           if (count==0)
             b.cleared=false;
-         System.printString("Exiting Barrier #2\n");
+          //System.printString("Exiting Barrier #2\n");
           return;
         }
       }
diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/Barrier.java b/Robust/src/Benchmarks/Prefetch/Moldyn/java/Barrier.java
new file mode 100644 (file)
index 0000000..590b3a6
--- /dev/null
@@ -0,0 +1,48 @@
+public class Barrier {
+  int numthreads;
+  int entercount;
+  boolean cleared;
+
+  public Barrier(int n) {
+    numthreads=n;
+    cleared = false;
+  }
+
+  public Barrier() {
+
+  }
+
+  public void reset() {
+    cleared = false;
+    entercount = 0;
+  }
+
+  public static void enterBarrier(Barrier b) {
+    int tmp;
+    boolean retry=true;
+
+    do {
+      if (!b.cleared) {
+        b.entercount++;
+        tmp = b.entercount;
+        if (tmp==b.numthreads) {
+          if(b.numthreads > 1)
+            b.cleared=true;
+          b.entercount--;
+          return;
+        }
+        retry=false;
+      }
+    } while(retry);
+
+    while(true) {
+      if (b.cleared) {
+        b.entercount--;
+        int count = b.entercount;
+        if (count==0)
+          b.cleared=false;
+        return;
+      }
+    }
+  }
+}
index 772949fa678448e345ee33bd81fcc49c6927dec8..3f9f580c0b6a7207e074b20cf138fd4a9fd2b072 100644 (file)
@@ -17,9 +17,6 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-
-import java.util.*;
-
 public class JGFInstrumentor{
 
   protected HashMap timers;
@@ -33,8 +30,8 @@ public class JGFInstrumentor{
   public static void addTimer (String name, HashMap timers){
 
     if (timers.containsKey(name)) {
-      System.out.println("JGFInstrumentor.addTimer: warning -  timer " + name + 
-          " already exists");
+      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
+          " already exists\n");
     }
     else {
       timers.put(name, new JGFTimer(name));
@@ -44,8 +41,8 @@ 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 + 
-          " already exists");
+      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
+          " already exists\n");
     }
     else {
       timers.put(name, new JGFTimer(name,opname));
@@ -56,8 +53,8 @@ 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 +
-          " already exists");
+      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name +
+          " already exists\n");
     }
     else {
       timers.put(name, new JGFTimer(name,opname,size));
@@ -70,8 +67,8 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).start();
     }
     else {
-      System.out.println("JGFInstrumentor.startTimer: failed -  timer " + name + 
-          " does not exist");
+      System.printString("JGFInstrumentor.startTimer: failed -  timer " + name + 
+          " does not exist\n");
     }
 
   }
@@ -81,8 +78,8 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).stop();
     }
     else {
-      System.out.println("JGFInstrumentor.stopTimer: failed -  timer " + name + 
-          " does not exist");
+      System.printString("JGFInstrumentor.stopTimer: failed -  timer " + name + 
+          " does not exist\n");
     }
   }
 
@@ -91,8 +88,8 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).addops(count);
     }
     else {
-      System.out.println("JGFInstrumentor.addOpsToTimer: failed -  timer " + name + 
-          " does not exist");
+      System.printString("JGFInstrumentor.addOpsToTimer: failed -  timer " + name + 
+          " does not exist\n");
     }
   }  
 
@@ -101,8 +98,8 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).addtime(added_time);
     }
     else {
-      System.out.println("JGFInstrumentor.addTimeToTimer: failed -  timer " + name +
-          " does not exist");
+      System.printString("JGFInstrumentor.addTimeToTimer: failed -  timer " + name +
+          " does not exist\n");
     }
 
 
@@ -115,8 +112,8 @@ public class JGFInstrumentor{
       time = ((JGFTimer) timers.get(name)).time;
     }
     else {
-      System.out.println("JGFInstrumentor.readTimer: failed -  timer " + name + 
-          " does not exist");
+      System.printString("JGFInstrumentor.readTimer: failed -  timer " + name + 
+          " does not exist\n");
       time = 0.0; 
     }
     return time; 
@@ -127,8 +124,8 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).reset();
     }
     else {
-      System.out.println("JGFInstrumentor.resetTimer: failed -  timer " + name +
-          " does not exist");
+      System.printString("JGFInstrumentor.resetTimer: failed -  timer " + name +
+          " does not exist\n");
     }
   }
 
@@ -137,8 +134,8 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).print();
     }
     else {
-      System.out.println("JGFInstrumentor.printTimer: failed -  timer " + name +
-          " does not exist");
+      System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
+          " does not exist\n");
     }
   }
 
@@ -147,8 +144,8 @@ public class JGFInstrumentor{
       ((JGFTimer) timers.get(name)).printperf();
     }
     else {
-      System.out.println("JGFInstrumentor.printTimer: failed -  timer " + name +
-          " does not exist");
+      System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
+          " does not exist\n");
     }
   }
 
@@ -167,46 +164,36 @@ public class JGFInstrumentor{
     header = "";
     base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; 
 
-    switch (section) {
-      case 1: 
-        header = base + "1";
-        break;
-      case 2:
-        switch (size) {
-          case 0:
-            header = base + "2 - Size A";
-            break;
-          case 1:
-            header = base + "2 - Size B";
-            break;
-          case 2:
-            header = base + "2 - Size C";
-            break;
-        }
-        break; 
-      case 3:    
-        switch (size) {
-          case 0:
-            header = base + "3 - Size A";
-            break;
-          case 1:
-            header = base + "3 - Size B";
-            break;
-        }
-        break; 
-    }
-
-    System.out.println(header); 
+    if (section == 1)
+    {
+      header = base + "1";
+    }
+    else if (section == 2)
+    {
+      if (size == 0)
+        header = base + "2 - Size A";
+      else if (size == 1)
+        header = base + "2 - Size B";
+      else if (size == 2)
+        header = base + "2 - Size C";
+    }
+    else if (section == 3)
+    {
+      if (size == 0)
+        header = base + "3 - Size A";
+      else if (size == 1)
+        header = base + "3 - Size B";
+    }
+
+    System.printString(header + "\n"); 
 
     if (nthreads == 1) {
-      System.out.println("Executing on " + nthreads + " thread");
+      System.printString("Executing on " + nthreads + " thread\n");
     }
     else {
-      System.out.println("Executing on " + nthreads + " threads");
+      System.printString("Executing on " + nthreads + " threads\n");
     }
 
-    System.out.println("");
-
+    System.printString(" \n");
   } 
-
 }
index fef7a041db61d49bdb4ac1ad7fe4a44acc0c4b3f..0f7b8a77c317fdab677a39b0b7125b3843a2125a 100644 (file)
@@ -17,9 +17,6 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-
-import java.io.*;
-
 public class JGFMolDynBench {
   public int ITERS;
   public double LENGTH;
@@ -44,9 +41,8 @@ public class JGFMolDynBench {
   public int nthreads;
   public JGFInstrumentor instr;
 
-  public JGFMolDynBench(int nthreads, JGFInstrumentor instr) {
+  public JGFMolDynBench(int nthreads) {
     this.nthreads=nthreads;
-    this.instr = instr;
   }
 
   public void JGFsetsize(int size){
@@ -68,50 +64,66 @@ public class JGFMolDynBench {
     kb = 1.38066e-23;
     TSIM = 50;
     deltat = 5e-16;
-
-    //initialise();
   }
 
-  public void JGFapplication() { 
+  public static void JGFapplication(JGFMolDynBench mold) { 
     // Create new arrays 
-    epot = new double [nthreads];
-    vir  = new double [nthreads];
-    ek   = new double [nthreads];
+      mold.epot = new double [mold.nthreads];
+      mold.vir  = new double [mold.nthreads];
+      mold.ek   = new double [mold.nthreads];
+      mold.interacts = new int [mold.nthreads];
 
-    interacts = new int [nthreads];
+    int partsize, numthreads;
+      partsize = mold.PARTSIZE;
+      numthreads = mold.nthreads;
 
-    double sh_force [][] = new double[3][PARTSIZE];
-    double sh_force2 [][][] = new double[3][nthreads][PARTSIZE];
+    double sh_force [][];
+    double sh_force2 [][][];
+      sh_force = new double[3][partsize];
+      sh_force2 = new double[3][numthreads][partsize];
 
     // spawn threads 
-    Thread thobjects[] = new Thread [nthreads];
-    TournamentBarrier br= new TournamentBarrier(nthreads);
-    //Barrier br = new Barrier(nthreads);
-
-    for(int i=1;i<nthreads;i++) {
-      thobjects[i] = new mdRunner(i,mm,sh_force,sh_force2,br,instr,nthreads,this);
-      thobjects[i].start();
+    mdRunner[] thobjects;
+    Barrier br;
+      thobjects = new mdRunner[numthreads];
+      br= new Barrier(numthreads);
+
+    int[] mid = new int[2];
+    mid[0] = (128<<24)|(195<<16)|(175<<8)|73;
+    mid[1] = (128<<24)|(195<<16)|(175<<8)|69;
+    mdRunner tmp;
+
+    for(int i=1;i<numthreads;i++) {
+        thobjects[i] = new mdRunner(i,mold.mm,sh_force,sh_force2,br,mold.nthreads,mold);
+        tmp = thobjects[i];
+      //System.printString("Starting thread  "+ i + "\n");
+      tmp.start();
     }
-
-    thobjects[0] = new mdRunner(0,mm,sh_force,sh_force2,br,instr,nthreads,this);
-    thobjects[0].run();
-
-    for(int i=1;i<nthreads;i++) {
-      try {
-        thobjects[i].join();
-      }
-      catch (InterruptedException e) {}
+    //System.printString("Finished starting rest threads\n");
+
+      thobjects[0] = new mdRunner(0,mold.mm,sh_force,sh_force2,br,mold.nthreads,mold);
+      tmp = thobjects[0];
+    //System.printString("Starting thread 0\n");
+    tmp.start();
+    tmp.join();
+    //System.printString("Finishing start\n");
+
+    for(int i=1;i<numthreads;i++) {
+      //System.printString("Joining thread  "+ i + "\n");
+        tmp = thobjects[i];
+      tmp.join();
     }
+    //System.printString("Finished joining all threads\n");
   } 
 
   public void JGFvalidate(){
     double[] refval = new double[2];
     refval[0] = 1731.4306625334357;
     refval[1] = 7397.392307839352;
-    double dev = Math.abs(ek[0] - refval[size]);
+    double dev = Math.fabs(ek[0] - refval[size]);
     if (dev > 1.0e-10 ){
-      System.out.println("Validation failed");
-      System.out.println("Kinetic Energy = " + ek[0] + "  " + dev + "  " + size);
+      //System.printString("Validation failed\n");
+      //System.printString("Kinetic Energy = " + (long)ek[0] + "  " + (long)dev + "  " + size + "\n");
     }
   }
 }
@@ -119,7 +131,7 @@ public class JGFMolDynBench {
 class mdRunner extends Thread {
 
   double count;
-  int id,i,j,k,lg,mdsize,move,mm;
+  int id,i,j,k,lg,mdsize,mm;
   double l,rcoff,rcoffs,side,sideh,hsq,hsq2,vel,velt;
   double a,r,sum,tscale,sc,ekin,ts,sp;
   double den;
@@ -137,26 +149,21 @@ class mdRunner extends Thread {
   int irep;
   int istop;
   int iprint;
-  int movemx;
 
-  TournamentBarrier br;
-  //Barrier br;
+  Barrier br;
   random randnum;
-  JGFInstrumentor instr;
   JGFMolDynBench mymd;
   int nthreads;
 
   particle[] one;
 
-  public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,TournamentBarrier br, 
-  //public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,Barrier br, 
-      JGFInstrumentor instr, int nthreads, JGFMolDynBench mymd) {
+  public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,Barrier br, 
+                 int nthreads, JGFMolDynBench mymd) {
     this.id=id;
     this.mm=mm;
     this.sh_force=sh_force;
     this.sh_force2=sh_force2;
     this.br=br;
-    this.instr = instr;
     this.nthreads = nthreads;
     this.mymd = mymd;
     count = 0.0;
@@ -166,297 +173,315 @@ class mdRunner extends Thread {
     irep = 10;
     istop = 19;
     iprint = 10;
-    movemx = 50;
   } 
 
   public void run() {
 
+    //System.printString("Start run method\n");
+
     /* Parameter determination */
 
-    mdsize = mymd.PARTSIZE;
-    one = new particle [mdsize];
-    l = mymd.LENGTH;
-
-    side = Math.pow((mdsize/den),0.3333333);
-    rcoff = mm/4.0;
-
-    a = side/mm;
-    sideh = side*0.5;
-    hsq = h*h;
-    hsq2 = hsq*0.5;
-    npartm = mdsize - 1;
-    rcoffs = rcoff * rcoff;
-    tscale = 16.0 / (1.0 * mdsize - 1.0);
-    vaver = 1.13 * Math.sqrt(tref / 24.0);
-    vaverh = vaver * h;
-
-    /* Particle Generation */
-
-    xvelocity = 0.0;
-    yvelocity = 0.0;
-    zvelocity = 0.0;
-
-    ijk = 0;
-    for (lg=0; lg<=1; lg++) {
-      for (i=0; i<mm; i++) {
-        for (j=0; j<mm; j++) {
-          for (k=0; k<mm; k++) {
-            one[ijk] = new particle((i*a+lg*a*0.5),(j*a+lg*a*0.5),(k*a),
-                xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,this);
-            ijk = ijk + 1;
+    int tmpmdsize;
+    double tmpden;
+    int movemx=50;
+    Barrier tmpbr;
+
+      tmpbr=br;
+      mdsize = mymd.PARTSIZE;
+      one = new particle[mdsize];
+      l = mymd.LENGTH;
+      tmpmdsize = mdsize;
+      tmpden = den;
+      side = Math.pow((tmpmdsize/tmpden),0.3333333);
+      rcoff = mm/4.0;
+
+      a = side/mm;
+      sideh = side*0.5;
+      hsq = h*h;
+      hsq2 = hsq*0.5;
+      npartm = tmpmdsize - 1;
+      rcoffs = rcoff * rcoff;
+      tscale = 16.0 / (1.0 * tmpmdsize - 1.0);
+      vaver = 1.13 * Math.sqrt(tref / 24.0);
+      vaverh = vaver * h;
+
+      /* Particle Generation */
+
+      xvelocity = 0.0;
+      yvelocity = 0.0;
+      zvelocity = 0.0;
+      ijk = 0;
+
+      for (lg=0; lg<=1; lg++) {
+        for (i=0; i<mm; i++) {
+          for (j=0; j<mm; j++) {
+            for (k=0; k<mm; k++) {
+              one[ijk] = new particle((i*a+lg*a*0.5),(j*a+lg*a*0.5),(k*a),
+                  xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,this);
+              ijk = ijk + 1;
+            }
           }
         }
       }
-    }
-    for (lg=1; lg<=2; lg++) {
-      for (i=0; i<mm; i++) {
-        for (j=0; j<mm; j++) {
-          for (k=0; k<mm; k++) {
-            one[ijk] = new particle((i*a+(2-lg)*a*0.5),(j*a+(lg-1)*a*0.5),
-                (k*a+a*0.5),xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,this);
-            ijk = ijk + 1;
+
+      for (lg=1; lg<=2; lg++) {
+        for (i=0; i<mm; i++) {
+          for (j=0; j<mm; j++) {
+            for (k=0; k<mm; k++) {
+              one[ijk] = new particle((i*a+(2-lg)*a*0.5),(j*a+(lg-1)*a*0.5),
+                  (k*a+a*0.5),xvelocity,yvelocity,zvelocity,sh_force,sh_force2,id,this);
+              ijk = ijk + 1;
+            }
           }
         }
       }
-    }
-
 
-    /* Initialise velocities */
+      /* Initialise velocities */
 
-    iseed = 0;
-    v1 = 0.0;
-    v2 = 0.0;
+      iseed = 0;
+      v1 = 0.0;
+      v2 = 0.0;
+      randnum = new random(iseed,v1,v2);
 
-    randnum = new random(iseed,v1,v2);
-
-    for (i=0; i<mdsize; i+=2) {
-      r  = randnum.seed();
-      one[i].xvelocity = r*randnum.v1;
-      one[i+1].xvelocity  = r*randnum.v2;
-    }
-
-    for (i=0; i<mdsize; i+=2) {
-      r  = randnum.seed();
-      one[i].yvelocity = r*randnum.v1;
-      one[i+1].yvelocity  = r*randnum.v2;
-    }
+      for (i=0; i<tmpmdsize; i+=2) {
+        r  = randnum.seed();
+        one[i].xvelocity = r*randnum.v1;
+        one[i+1].xvelocity  = r*randnum.v2;
+      }
 
-    for (i=0; i<mdsize; i+=2) {
-      r  = randnum.seed();
-      one[i].zvelocity = r*randnum.v1;
-      one[i+1].zvelocity  = r*randnum.v2;
-    }
+      for (i=0; i<tmpmdsize; i+=2) {
+        r  = randnum.seed();
+        one[i].yvelocity = r*randnum.v1;
+        one[i+1].yvelocity  = r*randnum.v2;
+      }
 
+      for (i=0; i<tmpmdsize; i+=2) {
+        r  = randnum.seed();
+        one[i].zvelocity = r*randnum.v1;
+        one[i+1].zvelocity  = r*randnum.v2;
+      }
 
-    /* velocity scaling */
 
-    ekin = 0.0;
-    sp = 0.0;
+      /* velocity scaling */
 
-    for(i=0;i<mdsize;i++) {
-      sp = sp + one[i].xvelocity;
-    }
-    sp = sp / mdsize;
+      ekin = 0.0;
+      sp = 0.0;
 
-    for(i=0;i<mdsize;i++) {
-      one[i].xvelocity = one[i].xvelocity - sp;
-      ekin = ekin + one[i].xvelocity*one[i].xvelocity;
-    }
+      for(i=0;i<tmpmdsize;i++) {
+        sp = sp + one[i].xvelocity;
+      }
+      sp = sp / tmpmdsize;
 
-    sp = 0.0;
-    for(i=0;i<mdsize;i++) {
-      sp = sp + one[i].yvelocity;
-    }
-    sp = sp / mdsize;
+      for(i=0;i<tmpmdsize;i++) {
+        one[i].xvelocity = one[i].xvelocity - sp;
+        ekin = ekin + one[i].xvelocity*one[i].xvelocity;
+      }
 
-    for(i=0;i<mdsize;i++) {
-      one[i].yvelocity = one[i].yvelocity - sp;
-      ekin = ekin + one[i].yvelocity*one[i].yvelocity;
-    }
+      sp = 0.0;
+      for(i=0;i<tmpmdsize;i++) {
+        sp = sp + one[i].yvelocity;
+      }
+      sp = sp / tmpmdsize;
 
+      for(i=0;i<tmpmdsize;i++) {
+        one[i].yvelocity = one[i].yvelocity - sp;
+        ekin = ekin + one[i].yvelocity*one[i].yvelocity;
+      }
 
-    sp = 0.0;
-    for(i=0;i<mdsize;i++) {
-      sp = sp + one[i].zvelocity;
-    }
-    sp = sp / mdsize;
 
-    for(i=0;i<mdsize;i++) {
-      one[i].zvelocity = one[i].zvelocity - sp;
-      ekin = ekin + one[i].zvelocity*one[i].zvelocity;
-    }
+      sp = 0.0;
+      for(i=0;i<tmpmdsize;i++) {
+        sp = sp + one[i].zvelocity;
+      }
+      sp = sp / tmpmdsize;
 
-    ts = tscale * ekin;
-    sc = h * Math.sqrt(tref/ts);
+      for(i=0;i<tmpmdsize;i++) {
+        one[i].zvelocity = one[i].zvelocity - sp;
+        ekin = ekin + one[i].zvelocity*one[i].zvelocity;
+      }
 
+      ts = tscale * ekin;
+      sc = h * Math.sqrt(tref/ts);
 
-    for(i=0;i<mdsize;i++) {
 
-      one[i].xvelocity = one[i].xvelocity * sc;     
-      one[i].yvelocity = one[i].yvelocity * sc;     
-      one[i].zvelocity = one[i].zvelocity * sc;     
+      for(i=0;i<tmpmdsize;i++) {
 
-    }
+        one[i].xvelocity = one[i].xvelocity * sc;     
+        one[i].yvelocity = one[i].yvelocity * sc;     
+        one[i].zvelocity = one[i].zvelocity * sc;     
 
+      }
 
     /* Synchronise threads and start timer before MD simulation */
 
-    br.DoBarrier(id);
-    //Barrier.enterBarrier(br);
-    if (id == 0) JGFInstrumentor.startTimer("Section3:MolDyn:Run", instr.timers);
-   // Barrier.enterBarrier(br);
-    br.DoBarrier(id);
-
+    Barrier.enterBarrier(tmpbr);
+    //System.clearPrefetchCache();
+    //int myid;
+    //atomic {
+    // myid = id;
+    //}
+    //TournamentBarrier.enterBarrier(myid, tmpbr);
+    //if (id == 0) JGFInstrumentor.startTimer("Section3:MolDyn:Run", instr.timers);
+    //Barrier.enterBarrier(tmpbr);
 
     /* MD simulation */
 
-    move = 0;
-    for (move=0;move<movemx;move++) {
-
-      /* move the particles and update velocities */
+    for (int move=0;move<movemx;move++) {
+        /* move the particles and update velocities */
 
-      for (i=0;i<mdsize;i++) {
-        one[i].domove(side,i);       
-      }
+        for (i=0;i<tmpmdsize;i++) {
+          one[i].domove(side,i);       
+        }
 
       /* Barrier */
-      br.DoBarrier(id);
-      //Barrier.enterBarrier(br);
-
-      if(id==0) {
-        for(j=0;j<3;j++) {
-          for (i=0;i<mdsize;i++) {
-            sh_force[j][i] = 0.0;
+      //System.printString("Barrier #2\n");
+      Barrier.enterBarrier(tmpbr);
+      //System.clearPrefetchCache();
+      //TournamentBarrier.enterBarrier(myid, tmpbr);
+
+        if(id==0) {
+          for(j=0;j<3;j++) {
+            for (i=0;i<tmpmdsize;i++) {
+              sh_force[j][i] = 0.0;
+            }
           }
         }
-      }
 
-      mymd.epot[id] = 0.0;
-      mymd.vir[id] = 0.0;
-      mymd.interacts[id] = 0;
-
-      /* Barrier */
-      //Barrier.enterBarrier(br);
-      br.DoBarrier(id);
+        mymd.epot[id] = 0.0;
+        mymd.vir[id] = 0.0;
+        mymd.interacts[id] = 0;
 
 
+      /* Barrier */
+      //System.printString("Barrier #3\n");
+      Barrier.enterBarrier(tmpbr);
+      //System.clearPrefetchCache();
+      //TournamentBarrier.enterBarrier(myid, tmpbr);
 
-      /* compute forces */
+        /* compute forces */
 
-      for (i=0+id;i<mdsize;i+=nthreads) {
-        one[i].force(side,rcoff,mdsize,i,xx,yy,zz,mymd); 
-      }
+        for (i=0+id;i<tmpmdsize;i+=nthreads) {
+          one[i].force(side,rcoff,tmpmdsize,i,xx,yy,zz,mymd); 
+        }
 
       /* Barrier */
-      //Barrier.enterBarrier(br);
-      br.DoBarrier(id);
+      //System.printString("Barrier #4\n");
+      Barrier.enterBarrier(tmpbr);
+      //System.clearPrefetchCache();
+      //TournamentBarrier.enterBarrier(myid, tmpbr);
 
       /* update force arrays */
-
-      if(id == 0) {
-        for(int k=0;k<3;k++) {
-          for(i=0;i<mdsize;i++) {
-            for(j=0;j<nthreads;j++) {
-              sh_force[k][i] += sh_force2[k][j][i];
+        if(id == 0) {
+          for(int k=0;k<3;k++) {
+            for(i=0;i<tmpmdsize;i++) {
+              for(j=0;j<nthreads;j++) {
+                sh_force[k][i] += sh_force2[k][j][i];
+              }
             }
           }
         }
-      }
 
-      if(id == 0) {
-        for(int k=0;k<3;k++) {
-          for(i=0;i<mdsize;i++) {
-            for(j=0;j<nthreads;j++) {
-              sh_force2[k][j][i] = 0.0;
+        if(id == 0) {
+          for(int k=0;k<3;k++) {
+            for(i=0;i<tmpmdsize;i++) {
+              for(j=0;j<nthreads;j++) {
+                sh_force2[k][j][i] = 0.0;
+              }
             }
           }
         }
-      }
 
-      if(id==0) {
-        for(j=1;j<nthreads;j++) {
-          mymd.epot[0] += mymd.epot[j];
-          mymd.vir[0] += mymd.vir[j];
-        }
-        for(j=1;j<nthreads;j++) {       
-          mymd.epot[j] = mymd.epot[0];
-          mymd.vir[j] = mymd.vir[0];
-        }
-        for(j=0;j<nthreads;j++) {
-          mymd.interactions += mymd.interacts[j]; 
+        if(id==0) {
+          for(j=1;j<nthreads;j++) {
+            mymd.epot[0] += mymd.epot[j];
+            mymd.vir[0] += mymd.vir[j];
+          }
+          for(j=1;j<nthreads;j++) {       
+            mymd.epot[j] = mymd.epot[0];
+            mymd.vir[j] = mymd.vir[0];
+          }
+          for(j=0;j<nthreads;j++) {
+            mymd.interactions += mymd.interacts[j]; 
+          }
         }
-      }
 
       /* Barrier */
-      //Barrier.enterBarrier(br);
-      br.DoBarrier(id);
-
-      if(id == 0) {
-        for (j=0;j<3;j++) {
-          for (i=0;i<mdsize;i++) {
-            sh_force[j][i] = sh_force[j][i] * hsq2;
+      //System.printString("Barrier #5\n");
+      Barrier.enterBarrier(tmpbr);
+      //System.clearPrefetchCache();
+      //TournamentBarrier.enterBarrier(myid, tmpbr);
+
+        if(id == 0) {
+          for (j=0;j<3;j++) {
+            for (i=0;i<tmpmdsize;i++) {
+              sh_force[j][i] = sh_force[j][i] * hsq2;
+            }
           }
         }
-      }
 
-      sum = 0.0;
+        sum = 0.0;
+
 
       /* Barrier */
-      //Barrier.enterBarrier(br);
-      br.DoBarrier(id);
+      //System.printString("Barrier #6\n");
+      Barrier.enterBarrier(tmpbr);
+      //System.clearPrefetchCache();
+      //TournamentBarrier.enterBarrier(myid, tmpbr);
 
-      /*scale forces, update velocities */
+        /*scale forces, update velocities */
 
-      for (i=0;i<mdsize;i++) {
-        sum = sum + one[i].mkekin(hsq2,i);  
-      }
+        for (i=0;i<tmpmdsize;i++) {
+          sum = sum + one[i].mkekin(hsq2,i);  
+        }
 
-      ekin = sum/hsq;
+        ekin = sum/hsq;
 
-      vel = 0.0;
-      count = 0.0;
+        vel = 0.0;
+        count = 0.0;
 
-      /* average velocity */
+        /* average velocity */
 
-      for (i=0;i<mdsize;i++) {
-        velt = one[i].velavg(vaverh,h);
-        if(velt > vaverh) { count = count + 1.0; }
-        vel = vel + velt;                    
-      }
+        for (i=0;i<tmpmdsize;i++) {
+          velt = one[i].velavg(vaverh,h);
+          if(velt > vaverh) { count = count + 1.0; }
+          vel = vel + velt;                    
+        }
 
-      vel = vel / h;
+        vel = vel / h;
 
-      /* temperature scale if required */
+        /* temperature scale if required */
 
-      if((move < istop) && (((move+1) % irep) == 0)) {
-        sc = Math.sqrt(tref / (tscale*ekin));
-        for (i=0;i<mdsize;i++) {
-          one[i].dscal(sc,1);
+        if((move < istop) && (((move+1) % irep) == 0)) {
+          sc = Math.sqrt(tref / (tscale*ekin));
+          for (i=0;i<tmpmdsize;i++) {
+            one[i].dscal(sc,1);
+          }
+          ekin = tref / tscale;
         }
-        ekin = tref / tscale;
-      }
 
-      /* sum to get full potential energy and virial */
+        /* sum to get full potential energy and virial */
 
-      if(((move+1) % iprint) == 0) {
-        mymd.ek[id] = 24.0*ekin;
-        mymd.epot[id] = 4.0*mymd.epot[id];
-        etot = mymd.ek[id] + mymd.epot[id];
-        temp = tscale * ekin;
-        pres = den * 16.0 * (ekin - mymd.vir[id]) / mdsize;
-        vel = vel / mdsize; 
-        rp = (count / mdsize) * 100.0;
-      }
-
-      //Barrier.enterBarrier(br);
-      br.DoBarrier(id);
+        if(((move+1) % iprint) == 0) {
+          mymd.ek[id] = 24.0*ekin;
+          mymd.epot[id] = 4.0*mymd.epot[id];
+          etot = mymd.ek[id] + mymd.epot[id];
+          temp = tscale * ekin;
+          pres = tmpden * 16.0 * (ekin - mymd.vir[id]) / tmpmdsize;
+          vel = vel / tmpmdsize; 
+          rp = (count / tmpmdsize) * 100.0;
+        }
+      //System.printString("Barrier #7\n");
+      Barrier.enterBarrier(tmpbr);
+      //System.clearPrefetchCache();
+      //TournamentBarrier.enterBarrier(myid, tmpbr);
     }
 
-
-    //Barrier.enterBarrier(br);
-    br.DoBarrier(id);
-    if (id == 0) JGFInstrumentor.stopTimer("Section3:MolDyn:Run", instr.timers);
-
+    //System.printString("Barrier #8\n");
+    Barrier.enterBarrier(tmpbr);
+    //System.clearPrefetchCache();
+    //TournamentBarrier.enterBarrier(myid, tmpbr);
+    //if (id == 0) JGFInstrumentor.stopTimer("Section3:MolDyn:Run", instr.timers);
+    //System.printString("End run method\n");
   }
 
 }
index 630ed78b8324145a21068f8dc638c9a532ac926a..51b52f24ad0ce96608f852e753932f2614431a3b 100644 (file)
@@ -17,9 +17,6 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-import java.io.*;
-import java.util.*;
-
 public class JGFMolDynBenchSizeA { 
 
     public static void main(String argv[]){
@@ -27,30 +24,54 @@ public class JGFMolDynBenchSizeA {
     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\n");
+      System.printString("  " + "\n");
       nthreads = 1;
     }
 
     JGFInstrumentor instr = new JGFInstrumentor();
     JGFInstrumentor.printHeader(3,0,nthreads);
 
-    JGFMolDynBench mold = new JGFMolDynBench(nthreads, instr); 
+    JGFMolDynBench mold;
+    mold = new JGFMolDynBench(nthreads); 
     int size = 0;
     JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers);
     JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers);
 
-    mold.JGFsetsize(size); 
+      mold.JGFsetsize(size); 
 
     JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers);
 
-    mold.JGFinitialise(); 
-    mold.JGFapplication(); 
-    mold.JGFvalidate(); 
+    JGFMolDynBench tmp;
+      mold.JGFinitialise(); 
+    JGFMolDynBench.JGFapplication(mold); 
+    /* Validate data */
+    double[] refval = new double[2];
+    refval[0] = 1731.4306625334357;
+    refval[1] = 7397.392307839352;
+    double dval;
+    //System.printString("Here #1\n");
+      dval = mold.ek[0];
+    //System.printString("Here #2\n");
+    double dev = Math.fabs(dval - refval[size]);
+    //long ldev = (long)dev * 1000000;
+    //System.printString("ldev= "+ldev);
+    //long ltmp = (long)1.0e-10 * 1000000;
+    //System.printString("ltmp= "+ltmp);
+    if (dev > 1.0e-10 ){
+    //if (ldev > ltmp ){
+      System.printString("Validation failed\n");
+      System.printString("Kinetic Energy = " + (long)dval + "  " + (long)dev + "  " + size + "\n");
+    }
+    System.printString("End of JGFvalidate\n");
 
     JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers);
+    double interactions;
+    System.printString("Here #3\n");
+    interactions = mold.interactions;
+    System.printString("Here #4\n");
 
-    JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) (mold.interactions), instr.timers);
+    JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers);
     JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers);
 
     JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers); 
index 8644d2c894a9a7e8e8578b574905a10292b14139..4e1d168f94ca0653b0f2ba39adfae1fe9114446a 100644 (file)
@@ -45,13 +45,15 @@ public class JGFTimer {
   }
 
   public JGFTimer(String name){
-    this(name,""); 
+    this.name = name;
+    this.opname = "";
+    reset();
   }
 
 
 
   public void start(){
-    if (on) System.out.println("Warning timer " + name + " was already turned on");
+    if (on) System.printString("Warning timer " + " was already turned on\n");
     on = true; 
     start_time = System.currentTimeMillis();
   }
@@ -59,7 +61,7 @@ public class JGFTimer {
 
   public void stop(){
     time += (double) (System.currentTimeMillis()-start_time) / 1000.;
-    if (!on) System.out.println("Warning timer " + name + " wasn't turned on");
+    if (!on) System.printString("Warning timer " + " wasn't turned on\n");
     calls++;
     on = false;  
   }
@@ -84,35 +86,24 @@ 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)\n");   
+    System.printString(name + "           " + calls +    "           "  +  (long)time + "        " + (long)this.perf() + "\n");
   }
 
   public void print(){
     if (opname.equals("")) {
-      System.out.println(name + "   " + time + " (s)");
+      System.printString(name + "   " + (long)time + " (s)\n");
     }
     else {
-
-      switch(size) {
-        case 0:
-          System.out.println(name + ":SizeA" + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
-              + " ("+opname+"/s)");
-          break;
-        case 1:
-          System.out.println(name + ":SizeB" + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
-              + " ("+opname+"/s)");
-          break;
-        case 2:
-          System.out.println(name + ":SizeC" + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
-              + " ("+opname+"/s)");
-          break;
-        default:
-          System.out.println(name + "\t" + time + " (s) \t " + (float)this.perf() + "\t"
-              + " ("+opname+"/s)");
-          break;
+      if(size == 0) {
+        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)\n");
+      } else if (size == 2) {
+        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)\n");
       }
-
     }
   }
 
@@ -125,8 +116,8 @@ public class JGFTimer {
     // pad name to 40 characters
     while ( name.length() < 40 ) name = name + " "; 
 
-    System.out.println(name + "\t" + (float)this.perf() + "\t"
-        + " ("+opname+"/s)");  
+    System.printString(name + "\t" + (long)this.perf() + "\t"
+        + " ("+opname+"/s)\n");  
   }
 
 }
index 1b029f9a7d3b41ef610b8d3abf770f2eb03280fa..7589d000f2af3e2aa796b1032336cb9c6cfec831 100644 (file)
@@ -1,8 +1,26 @@
-SRC = JGFMolDynBenchSizeA
+
+#SRC = JGFMolDynBenchSizeA
+#default:
+#      javac ${SRC}.java
+#run:
+#      java ${SRC} 2
+#
+#clean:
+#      rm *.class
+
+MAINCLASS=JGFMolDynBenchSizeA
+SRC=${MAINCLASS}.java \
+JGFInstrumentor.java \
+JGFTimer.java \
+JGFMolDynBench.java \
+Barrier.java
+#FLAGS=-dsm -prefetch -excprefetch particle.force -excprefetch particle.domove -excprefetch particle.mkekin -excprefetch TournamentBarrier.DoBarrier -excprefetch JGFMolDynBench.JGFvalidate -excprefetch JGFMolDynBench.JGFapplication -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8
+FLAGS2= -thread -mainclass ${MAINCLASS} -o ${MAINCLASS}NP
+
 default:
-       javac ${SRC}.java
-run:
-       java ${SRC} 2
+       ../../../../buildscript ${FLAGS2} ${SRC}
+#      ../../../../buildscript ${FLAGS} ${SRC}
 
 clean:
-       rm *.class
+       rm -rf tmpbuilddirectory/
+       rm *.bin
index 0b22bda2b59c17a6d2b0527c43f2aa428d75b3fe..a9310b36fcf2e734865f95f12463a00b168e35a7 100644 (file)
@@ -8,16 +8,16 @@ FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFSORBench.Random
 FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS}
 
 default:
-#      ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
-#      ../../../../buildscript ${FLAGS} -o ${MAINCLASS}  ${SRC}
-       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC}
-       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}1  ${SRC}
-       cp ${MAINCLASS}1NP.bin ${MAINCLASS}2NP.bin
-       cp ${MAINCLASS}1.bin ${MAINCLASS}2.bin
-       cp ${MAINCLASS}1NP.bin ${MAINCLASS}3NP.bin
-       cp ${MAINCLASS}1.bin ${MAINCLASS}3.bin
-       cp ${MAINCLASS}1NP.bin ${MAINCLASS}4NP.bin
-       cp ${MAINCLASS}1.bin ${MAINCLASS}4.bin
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
+       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}P  ${SRC}
+       cp ${MAINCLASS}NP.bin ${MAINCLASS}1NP.bin
+       cp ${MAINCLASS}P.bin ${MAINCLASS}1.bin
+       cp ${MAINCLASS}NP.bin ${MAINCLASS}2NP.bin
+       cp ${MAINCLASS}P.bin ${MAINCLASS}2.bin
+       cp ${MAINCLASS}NP.bin ${MAINCLASS}3NP.bin
+       cp ${MAINCLASS}P.bin ${MAINCLASS}3.bin
+       cp ${MAINCLASS}NP.bin ${MAINCLASS}4NP.bin
+       cp ${MAINCLASS}P.bin ${MAINCLASS}4.bin
 
 clean:
        rm -rf tmpbuilddirectory
diff --git a/Robust/src/Benchmarks/Prefetch/avg.sh b/Robust/src/Benchmarks/Prefetch/avg.sh
new file mode 100755 (executable)
index 0000000..0ad9d4e
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+for file in `ls runlog/*.txt`
+do
+  echo -n $file 
+  cat $file | awk '{sum += $1} END {print " "sum/NR}' 
+done
index 7a2ab7ac6d0c2771659869022454800d0f648b13..31331325ed0150e70cccf968b53ca1ffe26bb319 100644 (file)
@@ -1,6 +1,5 @@
 JGFSORBenchSizeA:SOR/dsm::2:3:4:sorverA
 JGFLUFactBenchSizeA:LUFact/dsm::2:4:lufactverA
-JGFLUFactBenchSizeB:LUFact/dsm::2:4:lufactverB
 MatrixMultiply:MatrixMultiply:1 200 30:2 200 30:3 200 30:4 200 30:mmver200
 MatrixMultiply:MatrixMultiply:1 600:2 600:3 600:4 600:mmver600
 Em3d:Em3d/dsm:-T 1 -N 4000 -d 130 -p -i 3:-T 2 -N 4000 -d 130 -p -i 3:-T 3 -N 4000 -d 130 -p -i 3:-T 4 -N 4000 -d 130 -p -i 3:em3dver40001303
index c5ad21102239b9b3576fe6c6780a9731e97bdd44..f0bf7635c40e1f16d734a73e11b2d4f6e43a00c4 100755 (executable)
@@ -81,27 +81,27 @@ function callrun {
   cd $BMDIR 
 
   echo "---------- Running local $BMDIR non-prefetch on 1 machine ---------- "
-#localrun 10
+  localrun 10
 
   echo "---------- Running single thread remote $BMDIR non-prefetch on 2 machines ---------- "
-# oneremote 10 1 $NONPREFETCH
+  oneremote 10 1 $NONPREFETCH
   echo "---------- Running single thread remote $BMDIR prefetch on 2 machines ---------- "
-# oneremote 10 1 $PREFETCH
+  oneremote 10 1 $PREFETCH
 
   echo "---------- Running two threads $BMDIR non-prefetch on 2 machines ---------- "
-# run 10 2 $NONPREFETCH2 
+  run 10 2 $NONPREFETCH2 
   echo "---------- Running two threads $BMDIR prefetch on 2 machines ---------- "
-  run 4 2 $PREFETCH2 
+  run 10 2 $PREFETCH2 
 
   echo "---------- Running three threads $BMDIR non-prefetch on 3 machines ---------- "
-# run 10 3 $NONPREFETCH3 
+  run 10 3 $NONPREFETCH3 
   echo "---------- Running three threads $BMDIR prefetch on 3 machines ---------- "
-# run 10 3 $PREFETCH3 
+  run 10 3 $PREFETCH3 
 
   echo "---------- Running four threads $BMDIR non-prefetch on 4 machines ---------- "
-# run 10 4 $NONPREFETCH4 
+  run 10 4 $NONPREFETCH4 
   echo "---------- Running four threads $BMDIR prefetch on 4 machines ---------- "
-# run 10 4 $PREFETCH4 
+  run 10 4 $PREFETCH4 
 
   cd $TOPDIR
 }
@@ -119,8 +119,7 @@ function callmicrorun {
   cd $TOPDIR
 }
 
-benchmarks='array'
-#benchmarks='array chase mmver200 mmver600 em3dver40001303 sorverA'
+benchmarks='array chase mmver200 mmver600 em3dver40001303 sorverA'
 
 echo "---------- Clean old files ---------- "
 rm runlog/*
@@ -143,6 +142,7 @@ do
   fi
 done
 
+#----------Calulates  the averages ----------- 
 for file in `ls runlog/*.txt`
 do
   echo -n $file >> average.txt
diff --git a/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/JGFCryptBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/JGFCryptBenchSizeA.java
deleted file mode 100644 (file)
index 74bd283..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/**************************************************************************
-*                                                                         *
-*         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
-*                                                                         *
-*                            produced by                                  *
-*                                                                         *
-*                  Java Grande Benchmarking Project                       *
-*                                                                         *
-*                                at                                       *
-*                                                                         *
-*                Edinburgh Parallel Computing Centre                      *
-*                                                                         * 
-*                email: epcc-javagrande@epcc.ed.ac.uk                     *
-*                                                                         *
-*                                                                         *
-*      This version copyright (c) The University of Edinburgh, 2001.      *
-*                         All rights reserved.                            *
-*                                                                         *
-**************************************************************************/
-/**************************************************************************
-*                       Ported for DSTM Benchmark                         *
-**************************************************************************/
-
-
-import crypt.*;
-import jgfutil.*; 
-
-public class JGFCryptBenchSizeA{ 
-
-  global JGFIntrumentor instr;
-
-  public static void main(String argv[]){
-  
-    int nthreads;
-
-    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("  ");
-      nthreads = 1;
-    }
-
-      instr = new JGFInstrumentor();
-      instr.printHeader(2,0,nthreads);
-
-      JGFCryptBench cb = new JGFCryptBench(nthreads, instr); 
-      cb.JGFrun(0);
-  }
-}
-
-
diff --git a/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/crypt/IDEATest.java b/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/crypt/IDEATest.java
deleted file mode 100644 (file)
index 940c859..0000000
+++ /dev/null
@@ -1,562 +0,0 @@
-/**************************************************************************
-*                                                                         *
-*         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
-*                                                                         *
-*                            produced by                                  *
-*                                                                         *
-*                  Java Grande Benchmarking Project                       *
-*                                                                         *
-*                                at                                       *
-*                                                                         *
-*                Edinburgh Parallel Computing Centre                      *
-*                                                                         * 
-*                email: epcc-javagrande@epcc.ed.ac.uk                     *
-*                                                                         *
-*                  Original version of this code by                       *
-*                 Gabriel Zachmann (zach@igd.fhg.de)                      *
-*                                                                         *
-*      This version copyright (c) The University of Edinburgh, 2001.      *
-*                         All rights reserved.                            *
-*                                                                         *
-**************************************************************************/
-/**************************************************************************
-*                       Ported for DSTM Benchmark                         *
-**************************************************************************/
-
-
-/**
-* Class IDEATest
-*
-* This test performs IDEA encryption then decryption. IDEA stands
-* for International Data Encryption Algorithm. The test is based
-* on code presented in Applied Cryptography by Bruce Schnier,
-* which was based on code developed by Xuejia Lai and James L.
-* Massey.
-
-**/
-
-package crypt;
-
-import java.util.*;
-import jgfutil.*; 
-
-class IDEATest
-{
-
-// Declare class data. Byte buffer plain1 holds the original
-// data for encryption, crypt1 holds the encrypted data, and
-// plain2 holds the decrypted data, which should match plain1
-// byte for byte.
-
-int array_rows; 
-
-byte [] plain1;       // Buffer for plaintext data.
-byte [] crypt1;       // Buffer for encrypted data.
-byte [] plain2;       // Buffer for decrypted data.
-
-short [] userkey;     // Key for encryption/decryption.
-int [] Z;             // Encryption subkey (userkey derived).
-int [] DK;            // Decryption subkey (userkey derived).
-
-
-
-void Do()
-{
-   
-    IDEARunner th[] = new IDEARunner [JGFCryptBench.nthreads];
-  
-    // Start the stopwatch.       
-  JGFInstrumentor.startTimer("Section2:Crypt:Kernel");                 
-
-  // Encrypt plain1.
-  for(int i=1;i<JGFCryptBench.nthreads;i++) {
-           th[i] = new IDEARunner(i,plain1,crypt1,Z);
-           th[i].start();
-       }       
-
-        th[0] = new IDEARunner(0,plain1,crypt1,Z);
-        th[0].start();
-
-
-       for(int i=1;i<JGFCryptBench.nthreads;i++) {
-         th[i].join();
-       }     
-  
-       // Decrypt.
-       for(int i=1;i<JGFCryptBench.nthreads;i++) {
-           th[i] = new IDEARunner(i,crypt1,plain2,DK);
-           th[i].start();
-       }       
-
-        th[0] = new IDEARunner(0,crypt1,plain2,DK);
-        th[0].start();
-  
-
-       for(int i=1;i<JGFCryptBench.nthreads;i++) {
-         th[i].join();
-       }
-
-
-  // Stop the stopwatch.
-  JGFInstrumentor.stopTimer("Section2:Crypt:Kernel");
-
-}
-
-/*
-* buildTestData
-*
-* Builds the data used for the test -- each time the test is run.
-*/
-
-void buildTestData()
-{
-
-
-    // Create three byte arrays that will be used (and reused) for
-    // encryption/decryption operations.
-
-    plain1 = new byte [array_rows];
-    crypt1 = new byte [array_rows];
-    plain2 = new byte [array_rows];
-
-
-    Random rndnum = new Random(136506717L);  // Create random number generator.
-
-
-    // Allocate three arrays to hold keys: userkey is the 128-bit key.
-    // Z is the set of 16-bit encryption subkeys derived from userkey,
-    // while DK is the set of 16-bit decryption subkeys also derived
-    // from userkey. NOTE: The 16-bit values are stored here in
-    // 32-bit int arrays so that the values may be used in calculations
-    // as if they are unsigned. Each 64-bit block of plaintext goes
-    // through eight processing rounds involving six of the subkeys
-    // then a final output transform with four of the keys; (8 * 6)
-    // + 4 = 52 subkeys.
-
-    userkey = new short [8];  // User key has 8 16-bit shorts.
-    Z = new int [52];         // Encryption subkey (user key derived).
-    DK = new int [52];        // Decryption subkey (user key derived).
-
-    // Generate user key randomly; eight 16-bit values in an array.
-
-    for (int i = 0; i < 8; i++)
-    {
-        // Again, the random number function returns int. Converting
-        // to a short type preserves the bit pattern in the lower 16
-        // bits of the int and discards the rest.
-
-      userkey[i] = (short) rndnum.nextInt();
-    }
-
-    // Compute encryption and decryption subkeys.
-
-    calcEncryptKey();
-    calcDecryptKey();
-
-    // Fill plain1 with "text."
-    for (int i = 0; i < array_rows; i++)
-    {
-      plain1[i] = (byte) i; 
-
-      // Converting to a byte
-      // type preserves the bit pattern in the lower 8 bits of the
-      // int and discards the rest.
-    }
-}
-
-/*
-* calcEncryptKey
-*
-* Builds the 52 16-bit encryption subkeys Z[] from the user key and
-* stores in 32-bit int array. The routing corrects an error in the
-* source code in the Schnier book. Basically, the sense of the 7-
-* and 9-bit shifts are reversed. It still works reversed, but would
-* encrypted code would not decrypt with someone else's IDEA code.
-*/
-
-private void calcEncryptKey()
-{
-    int j;                       // Utility variable.
-
-    for (int i = 0; i < 52; i++) // Zero out the 52-int Z array.
-        Z[i] = 0;
-
-    for (int i = 0; i < 8; i++)  // First 8 subkeys are userkey itself.
-    {
-        Z[i] = userkey[i] & 0xffff;     // Convert "unsigned"
-                                        // short to int.
-    }
-
-    // Each set of 8 subkeys thereafter is derived from left rotating
-    // the whole 128-bit key 25 bits to left (once between each set of
-    // eight keys and then before the last four). Instead of actually
-    // rotating the whole key, this routine just grabs the 16 bits
-    // that are 25 bits to the right of the corresponding subkey
-    // eight positions below the current subkey. That 16-bit extent
-    // straddles two array members, so bits are shifted left in one
-    // member and right (with zero fill) in the other. For the last
-    // two subkeys in any group of eight, those 16 bits start to
-    // wrap around to the first two members of the previous eight.
-
-    for (int i = 8; i < 52; i++)
-    {
-        j = i % 8;
-        if (j < 6)
-        {
-            Z[i] = ((Z[i -7]>>>9) | (Z[i-6]<<7)) // Shift and combine.
-                    & 0xFFFF;                    // Just 16 bits.
-            continue;                            // Next iteration.
-        }
-
-        if (j == 6)    // Wrap to beginning for second chunk.
-        {
-            Z[i] = ((Z[i -7]>>>9) | (Z[i-14]<<7))
-                    & 0xFFFF;
-            continue;
-        }
-
-         // j == 7 so wrap to beginning for both chunks.
-
-        Z[i] = ((Z[i -15]>>>9) | (Z[i-14]<<7))
-                    & 0xFFFF;
-    }
-}
-
-/*
-* calcDecryptKey
-*
-* Builds the 52 16-bit encryption subkeys DK[] from the encryption-
-* subkeys Z[]. DK[] is a 32-bit int array holding 16-bit values as
-* unsigned.
-*/
-
-private void calcDecryptKey()
-{
-    int j, k;                 // Index counters.
-    int t1, t2, t3;           // Temps to hold decrypt subkeys.
-
-    t1 = inv(Z[0]);           // Multiplicative inverse (mod x10001).
-    t2 = - Z[1] & 0xffff;     // Additive inverse, 2nd encrypt subkey.
-    t3 = - Z[2] & 0xffff;     // Additive inverse, 3rd encrypt subkey.
-
-    DK[51] = inv(Z[3]);       // Multiplicative inverse (mod x10001).
-    DK[50] = t3;
-    DK[49] = t2;
-    DK[48] = t1;
-
-    j = 47;                   // Indices into temp and encrypt arrays.
-    k = 4;
-    for (int i = 0; i < 7; i++)
-    {
-        t1 = Z[k++];
-        DK[j--] = Z[k++];
-        DK[j--] = t1;
-        t1 = inv(Z[k++]);
-        t2 = -Z[k++] & 0xffff;
-        t3 = -Z[k++] & 0xffff;
-        DK[j--] = inv(Z[k++]);
-        DK[j--] = t2;
-        DK[j--] = t3;
-        DK[j--] = t1;
-    }
-
-    t1 = Z[k++];
-    DK[j--] = Z[k++];
-    DK[j--] = t1;
-    t1 = inv(Z[k++]);
-    t2 = -Z[k++] & 0xffff;
-    t3 = -Z[k++] & 0xffff;
-    DK[j--] = inv(Z[k++]);
-    DK[j--] = t3;
-    DK[j--] = t2;
-    DK[j--] = t1;
-}
-
-
-
-
-
-/*
-* mul
-*
-* Performs multiplication, modulo (2**16)+1. This code is structured
-* on the assumption that untaken branches are cheaper than taken
-* branches, and that the compiler doesn't schedule branches.
-* Java: Must work with 32-bit int and one 64-bit long to keep
-* 16-bit values and their products "unsigned." The routine assumes
-* that both a and b could fit in 16 bits even though they come in
-* as 32-bit ints. Lots of "& 0xFFFF" masks here to keep things 16-bit.
-* Also, because the routine stores mod (2**16)+1 results in a 2**16
-* space, the result is truncated to zero whenever the result would
-* zero, be 2**16. And if one of the multiplicands is 0, the result
-* is not zero, but (2**16) + 1 minus the other multiplicand (sort
-* of an additive inverse mod 0x10001).
-
-* NOTE: The java conversion of this routine works correctly, but
-* is half the speed of using Java's modulus division function (%)
-* on the multiplication with a 16-bit masking of the result--running
-* in the Symantec Caje IDE. So it's not called for now; the test
-* uses Java % instead.
-*/
-
-private int mul(int a, int b)
-{
-    int ret;
-    long p;             // Large enough to catch 16-bit multiply
-                        // without hitting sign bit.
-    if (a != 0)
-    {
-        if(b != 0)
-        {
-            p = (long) a * b;
-            b = (int) p & 0xFFFF;       // Lower 16 bits.
-            a = (int) p >>> 16;         // Upper 16 bits.
-           if (b < a)
-             return (b - a + 1) & 0xFFFF;
-           else
-             return (b - a) & 0xFFFF;
-        }
-        else
-            return ((1 - a) & 0xFFFF);  // If b = 0, then same as
-                                        // 0x10001 - a.
-    }
-    else                                // If a = 0, then return
-        return((1 - b) & 0xFFFF);       // same as 0x10001 - b.
-}
-
-/*
-* inv
-*
-* Compute multiplicative inverse of x, modulo (2**16)+1 using
-* extended Euclid's GCD (greatest common divisor) algorithm.
-* It is unrolled twice to avoid swapping the meaning of
-* the registers. And some subtracts are changed to adds.
-* Java: Though it uses signed 32-bit ints, the interpretation
-* of the bits within is strictly unsigned 16-bit.
-*/
-
-private int inv(int x)
-{
-    int t0, t1;
-    int q, y;
-
-    if (x <= 1)             // Assumes positive x.
-        return(x);          // 0 and 1 are self-inverse.
-
-    t1 = 0x10001 / x;       // (2**16+1)/x; x is >= 2, so fits 16 bits.
-    y = 0x10001 % x;
-    if (y == 1)
-        return((1 - t1) & 0xFFFF);
-
-    t0 = 1;
-    do {
-        q = x / y;
-        x = x % y;
-        t0 += q * t1;
-        if (x == 1) return(t0);
-        q = y / x;
-        y = y % x;
-        t1 += q * t0;
-    } while (y != 1);
-
-    return((1 - t1) & 0xFFFF);
-}
-
-/*
-* freeTestData
-*
-* Nulls arrays and forces garbage collection to free up memory.
-*/
-
-void freeTestData()
-{
-    plain1 = null;
-    crypt1 = null;
-    plain2 = null;
-    userkey = null;
-    Z = null;
-    DK = null;
-
-    //System.gc();                // Force garbage collection.
-}
-
-
-}
-
-
-
-class IDEARunner extends Thread {
-
-    int id,key[];
-    byte text1[],text2[];
-
-    public IDEARunner(int id, byte [] text1, byte [] text2, int [] key) {
-       this.id = id;
-       this.text1=text1;
-       this.text2=text2;
-       this.key=key;
-    }
-/*
-* run()
-*
-* IDEA encryption/decryption algorithm. It processes plaintext in
-* 64-bit blocks, one at a time, breaking the block into four 16-bit
-* unsigned subblocks. It goes through eight rounds of processing
-* using 6 new subkeys each time, plus four for last step. The source
-* text is in array text1, the destination text goes into array text2
-* The routine represents 16-bit subblocks and subkeys as type int so
-* that they can be treated more easily as unsigned. Multiplication
-* modulo 0x10001 interprets a zero sub-block as 0x10000; it must to
-* fit in 16 bits.
-*/
-    public void run() {
-               int ilow, iupper, slice, tslice, ttslice;  
-
-        tslice = text1.length / 8;
-        ttslice = (tslice + JGFCryptBench.nthreads-1) / JGFCryptBench.nthreads;
-        slice = ttslice*8;
-
-        ilow = id*slice;
-        iupper = (id+1)*slice;
-        if(iupper > text1.length) iupper = text1.length;
-
-int i1 = ilow;                 // Index into first text array.
-int i2 = ilow;                 // Index into second text array.
-int ik;                     // Index into key array.
-int x1, x2, x3, x4, t1, t2; // Four "16-bit" blocks, two temps.
-int r;                      // Eight rounds of processing.
-
- for (int i =ilow ; i <iupper ; i +=8)
-{
-
-    ik = 0;                 // Restart key index.
-    r = 8;                  // Eight rounds of processing.
-
-    // Load eight plain1 bytes as four 16-bit "unsigned" integers.
-    // Masking with 0xff prevents sign extension with cast to int.
-
-    x1 = text1[i1++] & 0xff;          // Build 16-bit x1 from 2 bytes,
-    x1 |= (text1[i1++] & 0xff) << 8;  // assuming low-order byte first.
-    x2 = text1[i1++] & 0xff;
-    x2 |= (text1[i1++] & 0xff) << 8;
-    x3 = text1[i1++] & 0xff;
-    x3 |= (text1[i1++] & 0xff) << 8;
-    x4 = text1[i1++] & 0xff;
-    x4 |= (text1[i1++] & 0xff) << 8;
-
-    do {
-        // 1) Multiply (modulo 0x10001), 1st text sub-block
-        // with 1st key sub-block.
-
-        x1 = (int) ((long) x1 * key[ik++] % 0x10001L & 0xffff);
-
-        // 2) Add (modulo 0x10000), 2nd text sub-block
-        // with 2nd key sub-block.
-
-        x2 = x2 + key[ik++] & 0xffff;
-
-        // 3) Add (modulo 0x10000), 3rd text sub-block
-        // with 3rd key sub-block.
-
-        x3 = x3 + key[ik++] & 0xffff;
-
-        // 4) Multiply (modulo 0x10001), 4th text sub-block
-        // with 4th key sub-block.
-
-        x4 = (int) ((long) x4 * key[ik++] % 0x10001L & 0xffff);
-
-        // 5) XOR results from steps 1 and 3.
-
-        t2 = x1 ^ x3;
-
-        // 6) XOR results from steps 2 and 4.
-        // Included in step 8.
-
-        // 7) Multiply (modulo 0x10001), result of step 5
-        // with 5th key sub-block.
-
-        t2 = (int) ((long) t2 * key[ik++] % 0x10001L & 0xffff);
-
-        // 8) Add (modulo 0x10000), results of steps 6 and 7.
-
-        t1 = t2 + (x2 ^ x4) & 0xffff;
-
-        // 9) Multiply (modulo 0x10001), result of step 8
-        // with 6th key sub-block.
-
-        t1 = (int) ((long) t1 * key[ik++] % 0x10001L & 0xffff);
-
-        // 10) Add (modulo 0x10000), results of steps 7 and 9.
-
-        t2 = t1 + t2 & 0xffff;
-
-        // 11) XOR results from steps 1 and 9.
-
-        x1 ^= t1;
-
-        // 14) XOR results from steps 4 and 10. (Out of order).
-
-        x4 ^= t2;
-
-        // 13) XOR results from steps 2 and 10. (Out of order).
-
-        t2 ^= x2;
-
-        // 12) XOR results from steps 3 and 9. (Out of order).
-
-        x2 = x3 ^ t1;
-
-        x3 = t2;        // Results of x2 and x3 now swapped.
-
-    } while(--r != 0);  // Repeats seven more rounds.
-
-    // Final output transform (4 steps).
-
-    // 1) Multiply (modulo 0x10001), 1st text-block
-    // with 1st key sub-block.
-
-    x1 = (int) ((long) x1 * key[ik++] % 0x10001L & 0xffff);
-
-    // 2) Add (modulo 0x10000), 2nd text sub-block
-    // with 2nd key sub-block. It says x3, but that is to undo swap
-    // of subblocks 2 and 3 in 8th processing round.
-
-    x3 = x3 + key[ik++] & 0xffff;
-
-    // 3) Add (modulo 0x10000), 3rd text sub-block
-    // with 3rd key sub-block. It says x2, but that is to undo swap
-    // of subblocks 2 and 3 in 8th processing round.
-
-    x2 = x2 + key[ik++] & 0xffff;
-
-    // 4) Multiply (modulo 0x10001), 4th text-block
-    // with 4th key sub-block.
-
-    x4 = (int) ((long) x4 * key[ik++] % 0x10001L & 0xffff);
-
-    // Repackage from 16-bit sub-blocks to 8-bit byte array text2.
-
-    text2[i2++] = (byte) x1;
-    text2[i2++] = (byte) (x1 >>> 8);
-    text2[i2++] = (byte) x3;                // x3 and x2 are switched
-    text2[i2++] = (byte) (x3 >>> 8);        // only in name.
-    text2[i2++] = (byte) x2;
-    text2[i2++] = (byte) (x2 >>> 8);
-    text2[i2++] = (byte) x4;
-    text2[i2++] = (byte) (x4 >>> 8);
-
-}   // End for loop.
-
-    }   // End routine.
-
-}  // End of class
-
-
-
-
-
-
-
-
-
diff --git a/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/crypt/JGFCryptBench.java b/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/crypt/JGFCryptBench.java
deleted file mode 100644 (file)
index d80e063..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/**************************************************************************
-*                                                                         *
-*         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
-*                                                                         *
-*                            produced by                                  *
-*                                                                         *
-*                  Java Grande Benchmarking Project                       *
-*                                                                         *
-*                                at                                       *
-*                                                                         *
-*                Edinburgh Parallel Computing Centre                      *
-*                                                                         * 
-*                email: epcc-javagrande@epcc.ed.ac.uk                     *
-*                                                                         *
-*                                                                         *
-*      This version copyright (c) The University of Edinburgh, 2001.      *
-*                         All rights reserved.                            *
-*                                                                         *
-**************************************************************************/
-/**************************************************************************
-*                       Ported for DSTM Benchmark                         *
-**************************************************************************/
-
-
-package crypt;
-import jgfutil.*; 
-
-
-public class JGFCryptBench extends IDEATest { 
-
-  private int size; 
-  private int datasizes[];
-  public int nthreads;
-  global JGFInstrumentor instr;
-
-  public JGFCryptBench(int nthreads, JGFInstrumentor instr)
-  {
-    this.nthreads = nthreads;
-    this.instr = instr;
-    datasizes = new int[3];
-    datasizes[0] = 3000000;
-    datasizes[1] = 20000000;
-    datasizes[2] = 50000000;
-  }
-
-
-  public void JGFsetsize(int size){
-    this.size = size;
-  }
-
-  public void JGFinitialise(){
-    array_rows = datasizes[size];
-    buildTestData();
-  }
-  public void JGFkernel(){
-    Do(); 
-  }
-
-  public void JGFvalidate(){
-    boolean error;
-
-    error = false; 
-    for (int i = 0; i < array_rows; i++){
-      error = (plain1 [i] != plain2 [i]); 
-      if (error){
-       System.printString("Validation failed");
-       System.printString("Original Byte " + i + " = " + plain1[i]); 
-       System.printString("Encrypted Byte " + i + " = " + crypt1[i]); 
-       System.printString("Decrypted Byte " + i + " = " + plain2[i]); 
-       //break;
-      }
-    }
-  }
-
-
-  public void JGFtidyup(){
-    freeTestData(); 
-  }  
-
-
-
-  public void JGFrun(int size){
-
-
-    instr.addTimer("Section2:Crypt:Kernel", "Kbyte",size);
-
-    JGFsetsize(size); 
-    JGFinitialise(); 
-    JGFkernel(); 
-    JGFvalidate(); 
-    JGFtidyup(); 
-
-     
-    instr.addOpsToTimer("Section2:Crypt:Kernel", (2*array_rows)/1000.); 
-    instr.printTimer("Section2:Crypt:Kernel"); 
-  }
-}
diff --git a/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/jgfutil/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/jgfutil/JGFInstrumentor.java
deleted file mode 100644 (file)
index e9c0906..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
-/**************************************************************************
-*                                                                         *
-*         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
-*                                                                         *
-*                            produced by                                  *
-*                                                                         *
-*                  Java Grande Benchmarking Project                       *
-*                                                                         *
-*                                at                                       *
-*                                                                         *
-*                Edinburgh Parallel Computing Centre                      *
-*                                                                         * 
-*                email: epcc-javagrande@epcc.ed.ac.uk                     *
-*                                                                         *
-*                                                                         *
-*      This version copyright (c) The University of Edinburgh, 1999.      *
-*                         All rights reserved.                            *
-*                                                                         *
-**************************************************************************/
-/**************************************************************************
-*                       Ported for DSTM Benchmark                         *
-**************************************************************************/
-
-
-package jgfutil;
-
-import java.util.*;
-
-public class JGFInstrumentor{
-
-  private HashMap timers;
-  private HashMap data; 
-
-       public JGFIntrumentor()
-       {
-    timers = new HashMap();
-    data = new HashMap(); 
-  }
-
-  public void addTimer (String name){
-
-    if (timers.containsKey(name)) {
-      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
-                        " already exists");
-    }
-    else {
-      timers.put(name, new JGFTimer(name));
-    }
-  }
-    
-  public void addTimer (String name, String opname){
-
-    if (timers.containsKey(name)) {
-      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name + 
-                        " already exists");
-    }
-    else {
-      timers.put(name, new JGFTimer(name,opname));
-    }
-    
-  }
-
-  public void addTimer (String name, String opname, int size){
-
-    if (timers.containsKey(name)) {
-      System.printString("JGFInstrumentor.addTimer: warning -  timer " + name +
-                         " already exists");
-    }
-    else {
-      timers.put(name, new JGFTimer(name,opname,size));
-    }
-
-  }
-
-  public void startTimer(String name){
-    if (timers.containsKey(name)) {
-      ((JGFTimer) timers.get(name)).start();
-    }
-    else {
-      System.printString("JGFInstrumentor.startTimer: failed -  timer " + name + 
-                        " does not exist");
-    }
-
-  }
-
-  public void stopTimer(String name){
-    if (timers.containsKey(name)) {
-      ((JGFTimer) timers.get(name)).stop();
-    }
-    else {
-      System.printString("JGFInstrumentor.stopTimer: failed -  timer " + name + 
-                        " does not exist");
-    }
-  }
-
-  public void addOpsToTimer(String name, double count){
-    if (timers.containsKey(name)) {
-      ((JGFTimer) timers.get(name)).addops(count);
-    }
-    else {
-      System.printString("JGFInstrumentor.addOpsToTimer: failed -  timer " + name + 
-                        " does not exist");
-    }
-  }  
-
-  public void addTimeToTimer(String name, double added_time){
-    if (timers.containsKey(name)) {
-      ((JGFTimer) timers.get(name)).addtime(added_time);
-    }
-    else {
-      System.printString("JGFInstrumentor.addTimeToTimer: failed -  timer " + name +
-                         " does not exist");
-    }
-
-
-
-  }
-
-  public double readTimer(String name){
-    double time; 
-    if (timers.containsKey(name)) {
-      time = ((JGFTimer) timers.get(name)).time;
-    }
-    else {
-      System.printString("JGFInstrumentor.readTimer: failed -  timer " + name + 
-                        " does not exist");
-       time = 0.0; 
-    }
-    return time; 
-  }  
-
-  public void resetTimer(String name){
-    if (timers.containsKey(name)) {
-      ((JGFTimer) timers.get(name)).reset();
-    }
-    else {
-      System.printString("JGFInstrumentor.resetTimer: failed -  timer " + name +
-                        " does not exist");
-    }
-  }
-  
-  public void printTimer(String name){
-    if (timers.containsKey(name)) {
-      ((JGFTimer) timers.get(name)).print();
-    }
-    else {
-      System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
-                        " does not exist");
-    }
-  }
-  
-  public void printperfTimer(String name){
-    if (timers.containsKey(name)) {
-      ((JGFTimer) timers.get(name)).printperf();
-    }
-    else {
-      System.printString("JGFInstrumentor.printTimer: failed -  timer " + name +
-                        " does not exist");
-    }
-  }
-  
-  public void storeData(String name, Object obj){
-    data.put(name,obj); 
-  }
-
-  public void retrieveData(String name, Object obj){
-    obj = data.get(name); 
-  }
-
-  public static void printHeader(int section, int size,int nthreads) {
-
-    String header, base; 
-    header = "";
-    base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; 
-  
-    if (section == 1)
-    {
-      header = base + "1";
-    }
-    else if (section == 2)
-    {
-      if (size == 0)
-       header = base + "2 - Size A";
-      else if (size == 1)
-       header = base + "2 - Size B";
-      else if (size == 2)
-       header = base + "2 - Size C";
-    }
-    else if (section == 3)
-    {
-      if (size == 0)
-       header = base + "3 - Size A";
-      else if (size == 1)
-       header = base + "3 - Size B";
-    }
-
-    System.printString(header); 
-
-    if (nthreads == 1) {
-      System.printString("Executing on " + nthreads + " thread");
-    }
-    else {
-      System.printString("Executing on " + nthreads + " threads");
-    }
-
-    System.printString("");
-
-  } 
-
-}
diff --git a/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/jgfutil/JGFTimer.java b/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/jgfutil/JGFTimer.java
deleted file mode 100644 (file)
index 0ea93c8..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/**************************************************************************
-*                                                                         *
-*         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
-*                                                                         *
-*                            produced by                                  *
-*                                                                         *
-*                  Java Grande Benchmarking Project                       *
-*                                                                         *
-*                                at                                       *
-*                                                                         *
-*                Edinburgh Parallel Computing Centre                      *
-*                                                                         * 
-*                email: epcc-javagrande@epcc.ed.ac.uk                     *
-*                                                                         *
-*                                                                         *
-*      This version copyright (c) The University of Edinburgh, 1999.      *
-*                         All rights reserved.                            *
-*                                                                         *
-**************************************************************************/
-/**************************************************************************
-*                       Ported for DSTM Benchmark                         *
-**************************************************************************/
-
-
-package jgfutil;
-
-public class JGFTimer {
-
-  public String name; 
-  public String opname; 
-  public double time; 
-  public double opcount; 
-  public long calls; 
-  public int size = -1;
-  
-  private long start_time;
-  private boolean on; 
-
-  public JGFTimer(String name, String opname){
-    this.name = name;
-    this.opname = opname;
-    reset(); 
-  }
-
-  public JGFTimer(String name, String opname, int size){
-    this.name = name;
-    this.opname = opname;
-    this.size = size;
-    reset();
-  }
-
-  public JGFTimer(String name){
-    this.name = name;
-    this.opname = "";
-    reset(); 
-  }
-
-
-
-  public void start(){
-    if (on) System.printString("Warning timer " + name + " was already turned on");
-    on = true; 
-    start_time = System.currentTimeMillis();
-  }
-
-
-  public void stop(){
-    time += (double) (System.currentTimeMillis()-start_time) / 1000.;
-    if (!on) System.printString("Warning timer " + name + " wasn't turned on");
-    calls++;
-    on = false;  
-  }
-
-  public void addops(double count){
-    opcount += count;
-  } 
-
-  public void addtime(double added_time){
-    time += added_time;
-  }
-
-  public void reset(){
-    time = 0.0; 
-    calls = 0; 
-    opcount = 0; 
-    on = false;
-  }
-
-  public double perf(){
-    return opcount / time; 
-  }
-
-  public void longprint(){
-      System.printString("Timer            Calls         Time(s)       Performance("+opname+"/s)");   
-     System.printString(name + "           " + calls +    "           "  +  time + "        " + this.perf());
-  }
-
-  public void print(){
-    if (opname.equals(""))
-    {
-      System.printString(name + "   " + time + " (s)");
-    }
-    else
-    {
-      if(size == 0)
-       System.printString(name + ":SizeA" + "\t" + time + " (s) \t " + (float)this.perf() + "\t" + " ("+opname+"/s)");
-      else if (size == 1)
-       System.printString(name + ":SizeB" + "\t" + time + " (s) \t " + (float)this.perf() + "\t" + " ("+opname+"/s)");
-      else if (size == 2)
-       System.printString(name + ":SizeC" + "\t" + time + " (s) \t " + (float)this.perf() + "\t" + " ("+opname+"/s)");
-      else
-       System.printString(name + "\t" + time + " (s) \t " + (float)this.perf() + "\t" + " ("+opname+"/s)");
-    }
-  }
-
-
-  public void printperf(){
-
-     String name;
-     name = this.name; 
-
-     // pad name to 40 characters
-     while ( name.length() < 40 ) name = name + " "; 
-     
-     System.printString(name + "\t" + (float)this.perf() + "\t"
-                       + " ("+opname+"/s)");  
-  }
-
-}
diff --git a/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/makefile b/Robust/src/Benchmarks/Prefetch/threadv1.0/section2/makefile
deleted file mode 100644 (file)
index 91d1abc..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-MAINCLASS=JGFCryptBenchSizeA
-SRC=${MAINCLASS}.java \
-jgfutil/JGFInstrumentor.java \
-jgfutil/JGFTimer.java \
-crypt/IDEATest.java \
-crypt/JGFCryptBench.java
-FLAGS=-dsm -prefetch -nooptimize -debug -mainclass ${MAINCLASS} -o ${MAINCLASS}
-
-default:
-       ../../../../buildscript ${FLAGS} ${SRC}
-