change
authorbdemsky <bdemsky>
Mon, 21 Sep 2009 22:23:31 +0000 (22:23 +0000)
committerbdemsky <bdemsky>
Mon, 21 Sep 2009 22:23:31 +0000 (22:23 +0000)
Robust/src/Benchmarks/Prefetch/Array/ArrayEx.java [new file with mode: 0644]

diff --git a/Robust/src/Benchmarks/Prefetch/Array/ArrayEx.java b/Robust/src/Benchmarks/Prefetch/Array/ArrayEx.java
new file mode 100644 (file)
index 0000000..fc3811f
--- /dev/null
@@ -0,0 +1,48 @@
+public class Array2D extends Thread {
+    int [][][] array;
+
+    public Array2D() {
+    }
+    
+    public static void main(String [] argv) {
+       Array2D a;
+       atomic {
+           a=global new Array2D();
+       }
+       a.start((128<<24)|(195<<16)|(136<<8)|162);
+       a.join();
+       atomic {
+       a.exec();
+       }
+    }
+
+    public void exec() {
+           int xlength=array[0].length;
+           int ylength=array[0][0].length;
+           long sum;
+       for(int ii=0;ii<10;ii++) {
+           int zz[][]=array[ii];
+           for(int i=0;i<xlength;i++) {
+               int a[]=zz[i];
+               for(int j=0;j<ylength;j++) {
+                   sum+=a[j];
+               }
+           }
+       }
+    }
+    
+    public void run() {
+        atomic {
+       int xmax=32000;
+       int ymax=4;
+       array=global new int[10][xmax][ymax];
+       for(int ii=0;ii<10;ii++) {
+       for(int i=0;i<xmax;i++) {
+           for(int j=0;j<ymax;j++) {
+               array[ii][i][j]=i*j;
+           }
+       }
+       }
+       }
+    }
+}