Removing memory leak in kNeighbor benchmark
[charm.git] / examples / charm++ / gaussSeidel3D / gaussSeidel3d.ci
1 mainmodule gaussSeidel3d {
2
3   readonly CProxy_Main mainProxy;
4   readonly int arrayDimX;
5   readonly int arrayDimY;
6   readonly int arrayDimZ;
7   readonly int blockDimX;
8   readonly int blockDimY;
9   readonly int blockDimZ;
10
11   readonly int num_chare_x;
12   readonly int num_chare_y;
13   readonly int num_chare_z;
14
15   readonly int globalBarrier;
16
17   message ghostMsg {
18     double gh[];
19   };
20
21   mainchare Main {
22     entry Main(CkArgMsg *m);
23     entry void report();
24   };
25
26   array [3D] GaussSeidel {
27     entry GaussSeidel(void);
28     entry void begin_iteration(void);
29     entry void receiveGhostsCurrentX(ghostMsg *gmsg);
30     entry void receiveGhostsCurrentY(ghostMsg *gmsg);
31     entry void receiveGhostsCurrentZ(ghostMsg *gmsg);
32     entry void receiveGhostsPrevX(ghostMsg *gmsg);
33     entry void receiveGhostsPrevY(ghostMsg *gmsg);
34     entry void receiveGhostsPrevZ(ghostMsg *gmsg);
35
36     entry void processGhosts(ghostMsg *gmsg);
37
38     entry void doStep() {
39       atomic "begin_iteration" {
40         begin_iteration();
41       }
42
43       if(thisIndex.x < num_chare_x-1){
44         when receiveGhostsPrevX[iterations] (ghostMsg *gmsg) {
45           atomic "process ghosts X prev" { processGhosts(gmsg); }
46         }    
47       }
48
49       if(thisIndex.y < num_chare_y-1){
50         when receiveGhostsPrevY[iterations] (ghostMsg *gmsg) {
51
52           atomic "process ghosts Y prev" { processGhosts(gmsg); }
53         }    
54       }
55
56       if(thisIndex.z < num_chare_z-1){
57         when receiveGhostsPrevZ[iterations] (ghostMsg *gmsg) {
58           atomic "process ghosts Z prev" { processGhosts(gmsg); }
59         }    
60       }
61
62       if(thisIndex.x > 0){
63         when receiveGhostsCurrentX[iterations] (ghostMsg *gmsg) {
64           atomic "process ghosts X current" { processGhosts(gmsg); }
65         }     
66       }
67
68       if(thisIndex.y > 0){
69         when receiveGhostsCurrentY[iterations] (ghostMsg *gmsg) {
70           atomic "process ghosts Y current" { processGhosts(gmsg); }
71         }     
72       }
73
74       if(thisIndex.z > 0){
75         when receiveGhostsCurrentZ[iterations] (ghostMsg *gmsg) {
76           atomic "process ghosts Z current" { processGhosts(gmsg); }
77         }     
78       }
79
80
81
82       atomic "doWork" {
83         compute();
84       }
85     };
86   };
87
88
89 };