SOR fix, problem was with Random generator that had an initial seed defined
authoradash <adash>
Sun, 13 Dec 2009 05:40:21 +0000 (05:40 +0000)
committeradash <adash>
Sun, 13 Dec 2009 05:40:21 +0000 (05:40 +0000)
but never used

Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java
Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner.java

index 6e13994dc582876aebebbe8701546b806982490d..b1d563d4acc2e6448b7d46a160d06e251b198b7b 100644 (file)
@@ -58,6 +58,7 @@ public class JGFSORBench {
 
     double[][] G;
     int num_iterations;
+    long RANDOM_SEED;
 
     atomic {
       numthreads = sor.nthreads;
@@ -65,6 +66,7 @@ public class JGFSORBench {
       mybarr = global new BarrierServer(numthreads);
       G =  global new double[datasize][];
       num_iterations = sor.JACOBI_NUM_ITER;
+      RANDOM_SEED = sor.RANDOM_SEED;
     }
     mybarr.start(mid[0]);
 
@@ -80,7 +82,7 @@ public class JGFSORBench {
 
     atomic {
        for(int i=0;i<numthreads;i++) {
-           thobjects[i] =  new SORWrap(global new SORRunner(i,omega,G,num_iterations,numthreads));
+           thobjects[i] =  new SORWrap(global new SORRunner(i,omega,G,num_iterations,numthreads, RANDOM_SEED));
        }
     }
 
@@ -107,6 +109,7 @@ public class JGFSORBench {
                sor.Gtotal += G[i][j];
            }
        }               
+    //System.out.println("DEBUG: G.length= " + G.length+" sor.Gtotal= " + sor.Gtotal);
     }
   }
 
index 11eb9e56e31b3e490a6ae38941b7d5123c9e8ab6..6465fede7d3dca3c40f8d25811bab18742a28a68 100644 (file)
@@ -24,13 +24,15 @@ class SORRunner extends Thread {
   int id, num_iterations;
   double G[][],omega;
   int nthreads;
+  long RANDOM_SEED;
 
-  public SORRunner(int id, double omega, double G[][], int num_iterations, int nthreads) {
+  public SORRunner(int id, double omega, double G[][], int num_iterations, int nthreads, long RANDOM_SEED) {
     this.id = id;
     this.omega=omega;
     this.G=G;
     this.num_iterations=num_iterations;
     this.nthreads = nthreads;
+    this.RANDOM_SEED =  RANDOM_SEED;
   }
 
   public void run() {
@@ -66,7 +68,7 @@ class SORRunner extends Thread {
     Barrier.enterBarrier(barr);
     
     atomic {
-      Random rand=new Random();
+      Random rand=new Random(RANDOM_SEED);
       double[] R = G[0];
       for(int j=0;j<M;j++)
         R[j]=rand.nextDouble() * 1e-6;