start of new file
[IRC.git] / Robust / src / Benchmarks / Prefetch / Array / Array.java
1 public class Array extends Thread {
2     int [][] array;
3
4     public Array() {
5         int xmax=10000;
6         int ymax=10;
7         array=global new int[xmax][ymax];
8         for(int i=0;i<xmax;i++) {
9             for(int j=0;j<ymax;j++) {
10                 array[i][j]=i*j;
11             }
12         }
13     }
14     
15     public static void main(String [] argv) {
16         Array a;
17         atomic {
18             a=global new Array();
19         }
20         a.start((128<<24)|(195<<16)|(175<<8)|71);
21         a.join();
22     }
23     
24     public void run() {
25         atomic {
26             int xlength=array.length;
27             int ylength=array[0].length;
28             long sum;
29             for(int i=0;i<xlength;i++) {
30                 int a[]=array[i];
31                 for(int j=0;j<ylength;j++) {
32                     sum+=a[j];
33                 }
34             }
35         }
36     }
37 }