changes
authoradash <adash>
Sun, 4 May 2008 01:18:28 +0000 (01:18 +0000)
committeradash <adash>
Sun, 4 May 2008 01:18:28 +0000 (01:18 +0000)
Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java
Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner.java
Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile

index b0f1a1b7f8df70c30891851ca960439281536aa6..21773b9e88623442aa32fafe2a73190e66fbc2cb 100644 (file)
@@ -39,7 +39,7 @@ public class JGFSORBench {
     RANDOM_SEED = 10101010;
     R = global new Random(RANDOM_SEED);
     Gtotal = 0.0;
-    cachelinesize = 128;
+    cachelinesize = 1;
   }
 
   public void JGFsetsize(int size){
@@ -92,10 +92,10 @@ public class JGFSORBench {
 
     SORRunner tmp;
     int[] mid = new int[4];
-    mid[0] = (128<<24)|(195<<16)|(175<<8)|69;
-    mid[1] = (128<<24)|(195<<16)|(175<<8)|78;
+    mid[0] = (128<<24)|(195<<16)|(175<<8)|79;
+    mid[1] = (128<<24)|(195<<16)|(175<<8)|80;
     mid[2] = (128<<24)|(195<<16)|(175<<8)|73;
-    mid[3] = (128<<24)|(195<<16)|(175<<8)|79;
+    mid[3] = (128<<24)|(195<<16)|(175<<8)|78;
     for(int i=1;i<numthreads;i++) {
       atomic {
         thobjects[i] =  global new SORRunner(i,omega,G,num_iterations,sor.sync,numthreads);
index bc9097303db7275de682c9ce82a7789662a34ba0..73d2b1500d76ce9cf56a9eb4c8fe9c52e8178552 100644 (file)
@@ -21,7 +21,6 @@
 
 class SORRunner extends Thread {
 
-  int donecount, prevvalue;
   int id,num_iterations;
   double G[][],omega;
   long sync[][];
@@ -34,8 +33,6 @@ class SORRunner extends Thread {
     this.num_iterations=num_iterations;
     this.sync=sync;
     this.nthreads = nthreads;
-    this.prevvalue = 0;
-    this.donecount = 0;
   }
 
   public void run() {
@@ -68,76 +65,68 @@ class SORRunner extends Thread {
     if (iupper > Mm1) iupper =  Mm1+1;
     if (tmpid == (numthreads-1)) iupper = Mm1+1;
 
-    atomic {
       for (int p=0; p<2*numiterations; p++) {
-        for (int i=ilow+(p%2); i<iupper; i=i+2) {
+        atomic {
+          for (int i=ilow+(p%2); i<iupper; i=i+2) {
 
-          double [] Gi = G[i];
-          double [] Gim1 = G[i-1];
+            double [] Gi = G[i];
+            double [] Gim1 = G[i-1];
 
-          if(i == 1) { 
-            double [] Gip1 = G[i+1];
+            if(i == 1) { 
+              double [] Gip1 = G[i+1];
 
-            for (int j=1; j<Nm1; j=j+2){
-              Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
-                  + Gi[j+1]) + one_minus_omega * Gi[j];
+              for (int j=1; j<Nm1; j=j+2){
+                Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
+                    + Gi[j+1]) + one_minus_omega * Gi[j];
 
-            }
-          } else if (i == Mm1) {
+              }
+            } else if (i == Mm1) {
 
-            double [] Gim2 = G[i-2];
+              double [] Gim2 = G[i-2];
 
-            for (int j=1; j<Nm1; j=j+2){
-              if((j+1) != Nm1) {
-                Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
-                    + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
+              for (int j=1; j<Nm1; j=j+2){
+                if((j+1) != Nm1) {
+                  Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
+                      + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
+                }
               }
-            }
 
-          } else {
+            } else {
 
-            double [] Gip1 = G[i+1];
-            double [] Gim2 = G[i-2];
+              double [] Gip1 = G[i+1];
+              double [] Gim2 = G[i-2];
 
-            for (int j=1; j<Nm1; j=j+2){
-              Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
-                  + Gi[j+1]) + one_minus_omega * Gi[j];
+              for (int j=1; j<Nm1; j=j+2){
+                Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
+                    + Gi[j+1]) + one_minus_omega * Gi[j];
 
-              if((j+1) != Nm1) {
-                Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
-                    + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
+                if((j+1) != Nm1) {
+                  Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
+                      + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
+                }
               }
             }
           }
-
-        }
+        } //close atomic
         // Signal this thread has done iteration
-        sync[id][0]++;
 
-        /* My modifications */
-        while (donecount < nthreads-1) {
-          if (sync[id][0] > prevvalue) {
-            donecount++;
-          }
-        }
-        if (id == 0) {
-          donecount = 0;
-          prevvalue++;
-        }
-        /*
         // Wait for neighbours;
-        if (id > 0) {
-          System.printString("id: " + id + " sync: id-1 0 " + sync[id-1][0] + " id 0" + sync[id][0] + "\n");
-          while (sync[id-1][0] < sync[id][0]) ;
-          System.printString("id: " + id + " sync: id-1 0 " + sync[id-1][0] + " id 0" + sync[id][0] + "\n");
+        long ourcount;
+        boolean done=true;
+
+        atomic {
+          sync[tmpid][0]++;
+          ourcount=sync[tmpid][0];
         }
-        if (id < nthreads -1) {
-          System.printString("id: " + id + " sync: id 0 " + sync[id][0] + " id+1 0" + sync[id+1][0] + "\n");
-          while (sync[id+1][0] < sync[id][0]) ;
-          System.printString("id: " + id + " sync: id 0 " + sync[id][0] + " id+1 0" + sync[id+1][0] + "\n");
+
+       while(done) {
+           atomic {
+               if ((tmpid==0 || ourcount <= sync[tmpid-1][0])
+                   &&((tmpid==(numthreads-1))||ourcount<=sync[tmpid+1][0]))
+                   done=false;
+           }
         }
-        */
-      }
-    } //end of atomic
+
+      }//end of for
   } //end of run()
 }
index 375d70990859ab2eafcec1c093a1ef98c4adc4f0..4615bc045336105ac42ae71fea173363daf9ec4c 100644 (file)
@@ -1,15 +1,21 @@
 MAINCLASS=JGFSORBenchSizeA
 SRC=${MAINCLASS}.java \
-JGFSORBench.java \
-JGFInstrumentor.java \
-JGFTimer.java \
-SORRunner.java
-FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFSORBench.RandomMatrix -excprefetch JGFSORBench.init_sync -excprefetch JGFSORBench.JGFkernel -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8
-FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP
+       JGFSORBench.java \
+       JGFInstrumentor.java \
+       JGFTimer.java \
+       SORRunner.java
+FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFSORBench.RandomMatrix -excprefetch JGFSORBench.init_sync -excprefetch JGFSORBench.JGFkernel -mainclass ${MAINCLASS} -trueprob 0.8
+FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS}
 
 default:
-       ../../../../buildscript ${FLAGS2} ${SRC}
-       ../../../../buildscript ${FLAGS} ${SRC}
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
+       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}  ${SRC}
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC}
+       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}1  ${SRC}
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}2NP ${SRC}
+       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}2  ${SRC}
+       ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}4NP ${SRC}
+       ../../../../buildscript ${FLAGS} -o ${MAINCLASS}4  ${SRC}
 
 clean:
        rm -rf tmpbuilddirectory