Changes:
authorbdemsky <bdemsky>
Fri, 10 Jul 2009 01:37:49 +0000 (01:37 +0000)
committerbdemsky <bdemsky>
Fri, 10 Jul 2009 01:37:49 +0000 (01:37 +0000)
1) Bug fix
2) make char arrays -> byte arrays to match c code
3) add timing code

Robust/src/Benchmarks/SingleTM/SSCA2/Alg_Radix_Smp.java
Robust/src/Benchmarks/SingleTM/SSCA2/ComputeGraph.java
Robust/src/Benchmarks/SingleTM/SSCA2/GenScalData.java
Robust/src/Benchmarks/SingleTM/SSCA2/GetUserParameters.java
Robust/src/Benchmarks/SingleTM/SSCA2/Globals.java
Robust/src/Benchmarks/SingleTM/SSCA2/Graph.java
Robust/src/Benchmarks/SingleTM/SSCA2/GraphSDG.java
Robust/src/Benchmarks/SingleTM/SSCA2/SSCA2.java

index e066a6363b4a91a3da4eab633a0c0f60f58d270f..981cbdc57fb0b166ae915d4a658888ad607ed339 100644 (file)
@@ -57,9 +57,8 @@ public class Alg_Radix_Smp {
     global_lTemp2  = null;
   }
 
-  public int BITS(int x, int k, int j) {
-    int retval = ((x>>k) & ~(~0<<j));
-    return retval;
+  public static int BITS(int x, int k, int j) {
+    return  ((x>>k) & ~(~0<<j));
   }
 
   /* =============================================================================
@@ -192,7 +191,7 @@ public class Alg_Radix_Smp {
       for (int k = 0; k <  q; k++) {
         int j = BITS(lKey[k], bitOff, m);
         lSorted[myHisto[j]] = lKey[k];
-        auxSorted[myHisto[j]] = lKey[k];
+        auxSorted[myHisto[j]] = auxKey[k];
         myHisto[j]++;
 
         //
@@ -201,9 +200,6 @@ public class Alg_Radix_Smp {
         //mhp[j]++;
         
       }
-
-      psHisto = null;
-      myHisto = null;
     }
 
 
@@ -381,18 +377,12 @@ public class Alg_Radix_Smp {
         int[] auxKey,
         int[] auxSorted)
     {
-      int[] lTemp  = null;
-      int[] lTemp2 = null;
-
-      lTemp = new int[ q];
-      lTemp2 = new int[ q];
+      int[] lTemp  = new int[q];
+      int[] lTemp2 = new int[q];
 
       all_countsort_node_aux_seq(q, lKeys, lSorted, auxKey, auxSorted, (1<<11),  0, 11);
       all_countsort_node_aux_seq(q, lSorted, lTemp, auxSorted, lTemp2, (1<<11), 11, 11);
       all_countsort_node_aux_seq(q, lTemp, lSorted, lTemp2, auxSorted, (1<<10), 22, 10);
-
-      lTemp = null;
-      lTemp2 = null;
     }
 
 
@@ -433,10 +423,6 @@ public class Alg_Radix_Smp {
 
       Barrier.enterBarrier();
 
-      if(myId == 0) {
-        lTemp = null;
-        lTemp2 = null;
-      }
     }
 }
 
index 346d0a311d7344299744f0c90a126633d9e52ccf..167f0c107cb669818666cd363ce7cb218c9ea0e9 100644 (file)
@@ -118,10 +118,6 @@ public class ComputeGraph {
       }
 
       Barrier.enterBarrier();
-
-      if (myId == 0) {
-        p = null;
-      }
     }
 
   /* =============================================================================
@@ -142,7 +138,6 @@ public class ComputeGraph {
        */
       LocalStartStop lss = new LocalStartStop();
       CreatePartition.createPartition(0, numEdgesPlaced, myId, numThread, lss);
-
       for (int i = lss.i_start; i < lss.i_stop; i++) {
         if (computeGraphArgs.SDGdataPtr.startVertex[i] > maxNumVertices) {
           maxNumVertices = computeGraphArgs.SDGdataPtr.startVertex[i];
@@ -481,10 +476,6 @@ public class ComputeGraph {
 
       Barrier.enterBarrier();
 
-      if (myId == 0) {
-        impliedEdgeList = null;
-      }
-
       for (int i = lss.i_start; i < lss.i_stop; i++) {
         if (computeGraphArgs.GPtr.inDegree[i] > glb.MAX_CLUSTER_SIZE) {
           auxArr[i] = null;
@@ -493,10 +484,6 @@ public class ComputeGraph {
 
       Barrier.enterBarrier();
 
-      if (myId == 0) {
-        auxArr = null;
-      }
-
     }
 }
 
index 69014d54fba4d843f4cbffb3083129fca5db3cbb..1191cb17c252b83ecff10e650e79f40611f80e64 100644 (file)
@@ -531,13 +531,13 @@ public class GenScalData {
         }
       }
 
-      SDGdataPtr.strWeight = new char[numStrWtEdges * glb.MAX_STRLEN];
+      SDGdataPtr.strWeight = new byte[numStrWtEdges * glb.MAX_STRLEN];
 
       for (int i = 0; i < numEdgesPlaced; i++) {
         if (SDGdataPtr.intWeight[i] <= 0) {
           for (int j = 0; j < glb.MAX_STRLEN; j++) {
             SDGdataPtr.strWeight[(-SDGdataPtr.intWeight[i])*glb.MAX_STRLEN+j] =
-              (char) (1 + randomPtr.posrandom_generate() % 127);
+              (byte) (1 + randomPtr.posrandom_generate() % 127);
           }
         }
       }
@@ -547,7 +547,7 @@ public class GenScalData {
        */
 
       if (glb.SOUGHT_STRING.length != glb.MAX_STRLEN) {
-        glb.SOUGHT_STRING = new char[glb.MAX_STRLEN];
+        glb.SOUGHT_STRING = new byte[glb.MAX_STRLEN];
       }
 
       {
@@ -1280,7 +1280,7 @@ Barrier.enterBarrier();
       numStrWtEdges = gsd.global_numStrWtEdges;
 
       if (myId == 0) {
-        SDGdataPtr.strWeight = new char[numStrWtEdges * glb.MAX_STRLEN];
+        SDGdataPtr.strWeight = new byte[numStrWtEdges * glb.MAX_STRLEN];
       }
 
       Barrier.enterBarrier();
@@ -1292,7 +1292,7 @@ Barrier.enterBarrier();
           for (int j = 0; j < glb.MAX_STRLEN; j++) {
             SDGdataPtr.strWeight[(-SDGdataPtr.intWeight[i])*glb.MAX_STRLEN+j] =
               //FIXME if needed
-              (char) (1 + (randomPtr.posrandom_generate() % 127));
+              (byte) (1 + (randomPtr.posrandom_generate() % 127));
           }
         }
       }
@@ -1304,7 +1304,7 @@ Barrier.enterBarrier();
       if (myId == 0) {
 
         if (glb.SOUGHT_STRING.length != glb.MAX_STRLEN) {
-          glb.SOUGHT_STRING = new char[glb.MAX_STRLEN];
+          glb.SOUGHT_STRING = new byte[glb.MAX_STRLEN];
         }
 
         int t = (int) (randomPtr.posrandom_generate() % numStrWtEdges);
index e6039e01134d6c710b109b2c88db1d95cbb3d1ac..fa355607b2feffde52bc0ca5740874b326615a24 100644 (file)
@@ -197,7 +197,7 @@ public class GetUserParameters {
       glb.MAX_INT_WEIGHT      = (1<<glb.SCALE);      /* Max int value in edge weight */
       glb.MAX_STRLEN          = glb.SCALE;
 
-      glb.SOUGHT_STRING       = new char[1];              /* Kernel 2: Character string sought:  */
+      glb.SOUGHT_STRING       = new byte[1];              /* Kernel 2: Character string sought:  */
       /* specify here, else it is picked     */
       /* picked from randomly selected entry */
       /* in genScalData.c                    */
index 0daafa8847a2d363e54a2205248ec30166d92eb4..33dd638e72be17ae5b30e15f109b6a0c85963da3 100644 (file)
@@ -53,7 +53,7 @@ public class Globals {
   public int MAX_CLIQUE_SIZE;
   public int MAX_PARAL_EDGES;
   public int MAX_INT_WEIGHT;
-  public char[] SOUGHT_STRING;
+  public byte[] SOUGHT_STRING;
   public int MAX_STRLEN;
   public float PERC_INT_WEIGHTS;
   public float PROB_UNIDIRECTIONAL;
index a649ff4652c093ec5f355884c5a7972cad19b2c3..6651374f4964f73f2bccefc44959b89a7c386dac 100644 (file)
@@ -19,7 +19,7 @@ public class Graph {
   public int[] inVertexList;
 
   public int[]  intWeight;
-  public char[] strWeight;
+  public byte[] strWeight;
 
   public Graph() {
 
index b2b55dc44a28a3699baf85d8fa34405548fcc0ef..4962ddf7c3e7a6f144ea28a04d2f7f2a0becd05a 100644 (file)
@@ -7,7 +7,7 @@ public class GraphSDG {
    * in the int Weight array. A negative value because we need to sort on
    * the intWeights in Kernel 2. Hence the int int
    */
-  public char[] strWeight;
+  public byte[] strWeight;
   public int numEdgesPlaced;
 
   public GraphSDG() {
index 3d9117ff7764b8d223ab067809ab126b5706d9f5..9ad9801f9e56ae30b5964074de6c7bdcc1a8d966 100644 (file)
@@ -142,6 +142,8 @@ public class SSCA2 extends Thread {
      * The Global arguments
      */
     ComputeGraph computeGraphArgs = new ComputeGraph();
+    long starttime;
+    long stoptime;
 
     computeGraphArgs.GPtr       = G;
     computeGraphArgs.SDGdataPtr = SDGdata;
@@ -192,8 +194,9 @@ public class SSCA2 extends Thread {
     for(int i = 1; i<nthreads; i++) {
       ssca[i].start();
     }
-
     System.out.println("\nScalable Data Generator - genScalData() beginning execution...\n");
+    starttime=System.currentTimeMillis();
+
 #ifdef USE_PARALLEL_DATA_GENERATION
 
     /*
@@ -206,7 +209,10 @@ public class SSCA2 extends Thread {
     GenScalData.genScalData_seq(glb, SDGdata, gsd, radixsort);
 
 #endif
+
+    stoptime=System.currentTimeMillis();
     System.out.println("\n\tgenScalData() completed execution.");
+    System.out.println("Time="+(stoptime-starttime));
 
 #ifdef ENABLE_KERNEL1
 
@@ -217,9 +223,11 @@ public class SSCA2 extends Thread {
      * -------------------------------------------------------------------------
      */
     System.out.println("\nKernel 1 - computeGraph() beginning execution...");
+    starttime=System.currentTimeMillis();
     parallel_work_computeGraph(nthreads, glb, computeGraphArgs);
+    stoptime=System.currentTimeMillis();
     System.out.println("\n\tcomputeGraph() completed execution.\n");
-
+    System.out.println("Time="+(stoptime-starttime));
 #endif
 
 #ifdef ENABLE_KERNEL2