Fix direct calls to SDAG entry methods
[namd.git] / src / CudaPmeSolver.ci
1 module CudaPmeSolver {
2         extern module PmeSolver;
3
4 #ifdef NAMD_CUDA
5         message CudaPmeXYZInitMsg;
6         message CudaPmeXYInitMsg;
7         message CudaPmeXInitMsg;
8
9         message InitDeviceMsg;
10         message InitDeviceMsg2;
11
12         message DeviceDataMsg;
13
14         array[1D] CudaPmePencilXYZ : PmePencilXYZ {
15                 entry CudaPmePencilXYZ();
16                 entry void initialize(CudaPmeXYZInitMsg *msg);
17                 entry void initializeDevice(InitDeviceMsg *msg);
18         };
19
20         class CProxy_CudaPmePencilZ;
21         array[3D] CudaPmePencilXY : PmePencilXY {
22                 entry CudaPmePencilXY();
23                 entry void initialize(CudaPmeXYInitMsg *msg);
24                 entry void initializeDevice(InitDeviceMsg *msg);
25                 entry void getDeviceBufferZ(int x, bool sameDevice, CProxy_CudaPmePencilZ proxy);
26                 entry void getDeviceBuffer(int x, bool sameDevice, CProxy_CudaPmePencilZ proxy) {
27                         serial {
28                                 numGetDeviceBuffer++;
29                                 getDeviceBufferZ(x, sameDevice, proxy);
30                         }
31                 };
32                 entry void recvDeviceBuffer(DeviceDataMsg *msg);
33                 entry void recvDeviceBuffers(const CkCallback &cb) {
34                         overlap {
35                         for (imsg=0;imsg < numDeviceBuffers;++imsg) {
36                                         when recvDeviceBuffer(DeviceDataMsg *msg) serial {
37                                                 deviceBuffers[msg->i].data = msg->data;
38                                                 deviceBuffers[msg->i].event = msg->event;
39                                                 delete msg;
40                                         }
41                                 }
42                                 for (imsgZ=0;imsgZ < numGetDeviceBuffer;imsgZ++) {
43                                         when getDeviceBufferZ(int x, bool sameDevice, CProxy_CudaPmePencilZ proxy) serial {
44                                                 proxy(x,0,0).recvDeviceBuffer(new DeviceDataMsg(thisIndex.z, event, getData(x, sameDevice)));
45                                         }
46                                 }
47                         }
48                         serial { setDeviceBuffers(); }
49                         serial { cb.send(); }
50                 };
51         };
52
53         class CProxy_CudaPmePencilY;
54         array[3D] CudaPmePencilX : PmePencilX {
55                 entry CudaPmePencilX();
56                 entry void initialize(CudaPmeXInitMsg *msg);
57                 entry void initializeDevice(InitDeviceMsg *msg);
58                 entry void getDeviceBuffer2(int x, bool sameDevice, CProxy_CudaPmePencilY proxy);
59                 entry void getDeviceBuffer(int x, bool sameDevice, CProxy_CudaPmePencilY proxy) {
60                         serial {
61                                 numGetDeviceBuffer++;
62                                 getDeviceBuffer2(x, sameDevice, proxy);
63                         }
64                 };
65                 entry void recvDeviceBuffer(DeviceDataMsg *msg);
66                 entry void recvDeviceBuffers(const CkCallback &cb) {
67                         overlap {
68                         for (imsgY=0;imsgY < numDeviceBuffers;++imsgY) {
69                                         when recvDeviceBuffer(DeviceDataMsg *msg) serial {
70                                                 deviceBuffers[msg->i].data = msg->data;
71                                                 deviceBuffers[msg->i].event = msg->event;
72                                                 delete msg;
73                                         }
74                                 }
75                                 for (imsg=0;imsg < numGetDeviceBuffer;imsg++) {
76                                         when getDeviceBuffer2(int x, bool sameDevice, CProxy_CudaPmePencilY proxy) serial {
77                                                 proxy(x,0,thisIndex.z).recvDeviceBufferX(new DeviceDataMsg(thisIndex.y, event, getData(x, sameDevice)));
78                                         }
79                                 }
80                         }
81                         serial { setDeviceBuffers(); }
82                         serial { cb.send(); }
83                 };
84         };
85
86         array[3D] CudaPmePencilY : PmePencilY {
87                 entry CudaPmePencilY();
88                 entry void initialize(CudaPmeXInitMsg *msg);
89                 entry void initializeDevice(InitDeviceMsg2 *msg);
90                 entry void getDeviceBuffer2(int y, bool sameDevice, CProxy_CudaPmePencilX proxy);
91                 entry void getDeviceBuffer(int y, bool sameDevice, CProxy_CudaPmePencilX proxy) {
92                         serial {
93                                 numGetDeviceBufferX++;
94                                 getDeviceBuffer2(y, sameDevice, proxy);
95                         }
96                 };
97                 entry void getDeviceBuffer22(int y, bool sameDevice, CProxy_CudaPmePencilZ proxy);
98                 entry void getDeviceBuffer(int y, bool sameDevice, CProxy_CudaPmePencilZ proxy) {
99                         serial {
100                                 numGetDeviceBufferZ++;
101                                 getDeviceBuffer22(y, sameDevice, proxy);
102                         }
103                 };
104                 entry void recvDeviceBufferZ(DeviceDataMsg *msg);
105                 entry void recvDeviceBufferX(DeviceDataMsg *msg);
106                 entry void recvDeviceBuffers(const CkCallback &cb) {
107                         overlap {
108                         for (imsgZ=0;imsgZ < numDeviceBuffersZ;++imsgZ) {
109                                         when recvDeviceBufferZ(DeviceDataMsg *msg) serial {
110                                                 deviceBuffersZ[msg->i].data = msg->data;
111                                                 deviceBuffersZ[msg->i].event = msg->event;
112                                                 delete msg;
113                                         }
114                                 }
115                         for (imsgX=0;imsgX < numDeviceBuffersX;++imsgX) {
116                                         when recvDeviceBufferX(DeviceDataMsg *msg) serial {
117                                                 deviceBuffersX[msg->i].data = msg->data;
118                                                 deviceBuffersX[msg->i].event = msg->event;
119                                                 delete msg;
120                                         }
121                                 }
122                                 for (imsgXX=0;imsgXX < numGetDeviceBufferX;imsgXX++) {
123                                         when getDeviceBuffer2(int y, bool sameDevice, CProxy_CudaPmePencilX proxy) serial {
124                                                 proxy(0,y,thisIndex.z).recvDeviceBuffer(new DeviceDataMsg(thisIndex.x, event, getDataForX(y, sameDevice)));
125                                         }
126                                 }
127                                 for (imsgZZ=0;imsgZZ < numGetDeviceBufferZ;imsgZZ++) {
128                                         when getDeviceBuffer22(int y, bool sameDevice, CProxy_CudaPmePencilZ proxy) serial {
129                                                 proxy(thisIndex.x,y,0).recvDeviceBuffer(new DeviceDataMsg(thisIndex.z, event, getDataForZ(y, sameDevice)));
130                                         }
131                                 }
132                         }
133                         serial { setDeviceBuffers(); }
134                         serial { cb.send(); }
135                 };
136         };
137
138         array[3D] CudaPmePencilZ : PmePencilZ {
139                 entry CudaPmePencilZ();
140                 entry void initialize(CudaPmeXInitMsg *msg);
141                 entry void initialize(CudaPmeXYInitMsg *msg);
142                 entry void initializeDevice(InitDeviceMsg2 *msg);
143
144                 entry void getDeviceBufferXY(int z, bool sameDevice, CProxy_CudaPmePencilXY proxy);
145                 entry void getDeviceBuffer(int z, bool sameDevice, CProxy_CudaPmePencilXY proxy) {
146                         serial {
147                                 numGetDeviceBufferXY++;
148                                 getDeviceBufferXY(z, sameDevice, proxy);
149                         }                       
150                 };
151
152                 entry void getDeviceBufferY(int z, bool sameDevice, CProxy_CudaPmePencilY proxy);
153                 entry void getDeviceBuffer(int z, bool sameDevice, CProxy_CudaPmePencilY proxy) {
154                         serial {
155                                 numGetDeviceBufferY++;
156                                 getDeviceBufferY(z, sameDevice, proxy);
157                         }                       
158                 };
159                 entry void recvDeviceBuffer(DeviceDataMsg *msg);
160                 entry void recvDeviceBuffers(const CkCallback &cb) {
161                         overlap {
162                         for (imsgY=0;imsgY < numDeviceBuffers;++imsgY) {
163                                         when recvDeviceBuffer(DeviceDataMsg *msg) serial {
164                                                 deviceBuffers[msg->i].data = msg->data;
165                                                 deviceBuffers[msg->i].event = msg->event;
166                                                 delete msg;
167                                         }
168                                 }
169                                 for (imsg=0;imsg < numGetDeviceBufferY;imsg++) {
170                                         when getDeviceBufferY(int z, bool sameDevice, CProxy_CudaPmePencilY proxy) serial {
171                                                 proxy(thisIndex.x,0,z).recvDeviceBufferZ(new DeviceDataMsg(thisIndex.y, event, getData(z, sameDevice)));
172                                         }
173                                 }
174                                 for (imsg=0;imsg < numGetDeviceBufferXY;imsg++) {
175                                         when getDeviceBufferXY(int z, bool sameDevice, CProxy_CudaPmePencilXY proxy) serial {
176                                                 proxy(0,0,z).recvDeviceBuffer(new DeviceDataMsg(thisIndex.x, event, getData(z, sameDevice)));
177                                         }
178                                 }
179                         }
180                         serial { setDeviceBuffers(); }
181                         serial { cb.send(); }
182                 };
183
184
185         };
186 #endif // NAMD_CUDA
187
188 };