bug fix in 2DConv and other small changes to makefile
authoradash <adash>
Thu, 13 Nov 2008 00:23:24 +0000 (00:23 +0000)
committeradash <adash>
Thu, 13 Nov 2008 00:23:24 +0000 (00:23 +0000)
Robust/src/Benchmarks/Prefetch/2DConv/dsm/Convolution.java
Robust/src/Benchmarks/Prefetch/2DConv/javasingle/Convolution.java
Robust/src/Benchmarks/Prefetch/2DConv/javasingle/makefile
Robust/src/Benchmarks/Prefetch/2DFFT/dsm/Makefile
Robust/src/Benchmarks/Prefetch/avg.sh

index edcf3e6f2a17ea8641fd6a259fc85f2c57657e91..5e3fb1e846177a6d6d811b2430084eff64fc8cc6 100644 (file)
@@ -20,24 +20,23 @@ public class Convolution extends Thread {
       double tempinput[][] = img.inputImage;
       double tempout[][] = img.outputImage;
 
-      double tinput0[] = tempinput[x0];
-      double tinput1[] = tempinput[x0+1];
-      double tinput2[] = tempinput[x0+2];
-      double tinput3[] = tempinput[x0+3];
-      double tinput4[] = tempinput[x0+4];
-
-      for(int i=x0;i<x1;++i){
-        double tout[] = tempout[x0];
+      double tinput1[] = tempinput[x0];
+      double tinput2[] = tempinput[x0+1];
+      double tinput3[] = tempinput[x0+2];
+      double tinput4[] = tempinput[x0+3];
+      double tinput0[] = tinput1;
+
+      int l=x0+4;
+      for(int i=x0;i<x1;i++,l++){
+        double tout[] = tempout[i];
+        tinput0 = tinput1; tinput1=tinput2; tinput2=tinput3; tinput3=tinput4; tinput4=tempinput[l];
         for(int j=y0;j<y1;++j){
-          tout[y0] = 0;
+          tout[j] = 0;
           for(int b=0;b<kernelHeight;++b){
-            tout[y0] = tout[y0] + (tinput0[j+b] * kernel[0][b] + tinput1[j+b] * kernel[1][b] + tinput2[j+b]*kernel[2][b] +
+            tout[j] = tout[j] + (tinput0[j+b] * kernel[0][b] + tinput1[j+b] * kernel[1][b] + tinput2[j+b]*kernel[2][b] +
                 tinput3[j+b]*kernel[3][b] + tinput4[j+b]*kernel[4][b]);
           }
         }
-        if(i != 4095) {
-          tinput0 = tinput1; tinput1=tinput2; tinput2=tinput3; tinput3=tinput4; tinput4=tempinput[i+5];
-        }
       }
     }
   }
@@ -82,6 +81,13 @@ public class Convolution extends Thread {
       }
     }
 
+    /*
+    atomic{
+      System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+      System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
+    }
+    */
+
     for(int i = 0; i <NUM_THREADS; i++) {
       atomic {
         tmp = conv[i];
@@ -96,6 +102,13 @@ public class Convolution extends Thread {
       tmp.join();
     }
     System.printString("Done!");
+
+    /*
+    atomic{
+      System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+      System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
+    }
+    */
   }
 
   //define 5X5 Gaussian kernel
index dcb3c8719d09a2b1af1c90979caa314708745a3f..77c52d1895b62918e66bf811623ca3d3d234e598 100644 (file)
@@ -14,29 +14,27 @@ public class Convolution {
     int kernelHeight = 5;
     int kernelWidth = 5;
     double[][] kernel = new double[kernelHeight][kernelWidth];
-
     initKernel(kernel);
     double tempinput[][] = img.inputImage;
     double tempout[][] = img.outputImage;
 
-    double tinput0[] = tempinput[x0];
-    double tinput1[] = tempinput[x0+1];
-    double tinput2[] = tempinput[x0+2];
-    double tinput3[] = tempinput[x0+3];
-    double tinput4[] = tempinput[x0+4];
+    double tinput1[] = tempinput[x0];
+    double tinput2[] = tempinput[x0+1];
+    double tinput3[] = tempinput[x0+2];
+    double tinput4[] = tempinput[x0+3];
+    double tinput0[] = tinput1;
 
-    for(int i=x0;i<x1;++i){
-      double tout[] = tempout[x0];
+    int l=x0+4;
+    for(int i=x0;i<x1;i++,l++){
+      double tout[] = tempout[i];
+      tinput0 = tinput1; tinput1=tinput2; tinput2=tinput3; tinput3=tinput4; tinput4=tempinput[l];
       for(int j=y0;j<y1;++j){
-        tout[y0] = 0;
+        tout[j] = 0;
         for(int b=0;b<kernelHeight;++b){
-          tout[y0] = tout[y0] + (tinput0[j+b] * kernel[0][b] + tinput1[j+b] * kernel[1][b] + tinput2[j+b]*kernel[2][b] +
+          tout[j] = tout[j] + (tinput0[j+b] * kernel[0][b] + tinput1[j+b] * kernel[1][b] + tinput2[j+b]*kernel[2][b] +
               tinput3[j+b]*kernel[3][b] + tinput4[j+b]*kernel[4][b]);
         }
       }
-      if(i != 8191) {
-        tinput0 = tinput1; tinput1=tinput2; tinput2=tinput3; tinput3=tinput4; tinput4=tempinput[i+5];
-      }
     }
   }
 
@@ -68,11 +66,15 @@ public class Convolution {
       base+=increment;
     }
 
+    //System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+    //System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
     for(int i = 0; i <NUM_THREADS; i++) {
       tmp = conv[i];
       tmp.run();
     }
 
+    //System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+    //System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
     System.printString("Done!");
   }
 
index 15c039791a15d2e830d24f7adbb444da854d738c..df60825069cf50ccb5ad0afd4db866aef86f8769 100644 (file)
@@ -1,7 +1,7 @@
 MAINCLASS=Convolution
 SRC=${MAINCLASS}.java 
 default:
-       ../../../../buildscript -nooptimize -debug -mainclass ${MAINCLASS} ${SRC} -o ${MAINCLASS}
+       ../../../../buildscript -optimize -mainclass ${MAINCLASS} ${SRC} -o ${MAINCLASS}
 
 clean:
        rm -rf tmpbuilddirectory
index 2305c2cbf103d0f778d213d0d6a357a2edc712a2..78ec58bbdf9391ae9661e37a65bcf8aaf5ac02be 100644 (file)
@@ -2,7 +2,7 @@ MAINCLASS=fft2d
 SRC=${MAINCLASS}.java \
        fft1d.java \
        Matrix.java
-FLAGS =-dsm -dsmcaching -prefetch -optimize -excprefetch fft2d.main -excprefetch fft2d.twiddle -excprefetch fft1d.factorize -excprefetch fft1d.printFactors -excprefetch Matrix.setValues -excprefetch Matrix.setZeros -trueprob 0.90 -mainclass ${MAINCLASS}
+FLAGS =-dsm -dsmcaching -prefetch -optimize -excprefetch fft2d.main -excprefetch fft2d.twiddle -excprefetch fft1d.factorize -excprefetch fft1d.printFactors -excprefetch Matrix.setValues -excprefetch Matrix.setZeros -excprefetch fft2d.transpose -trueprob 0.90 -mainclass ${MAINCLASS}
 FLAGS1=-dsm -optimize -mainclass ${MAINCLASS}
 
 default:
index 0ad9d4e145ed21da597ab6460a15d69c743f6730..29c8517db26a1848d8da76e66c9374f85d1eae51 100755 (executable)
@@ -3,5 +3,5 @@
 for file in `ls runlog/*.txt`
 do
   echo -n $file 
-  cat $file | awk '{sum += $1} END {print " "sum/NR}' 
+  cat $file | grep -v "^Command" | awk '{sum += $1} END {print " "sum/NR}' 
 done