# | Line 4 | Line 4 | |
---|---|---|
4 | #include <string.h> | |
5 | #define __mpiBASSEVENT | |
6 | #include "mpiBASS.h" | |
7 | + | #include "simError.h" |
8 | ||
9 | ||
10 | void mpiCatchEvent(void); | |
# | Line 46 | Line 47 | void throwMPIEvent(event* the_event) | |
47 | mBEvent mpiEventContainer; | |
48 | int mpiStatus; | |
49 | int mpiError; | |
49 | – | int mynode; |
50 | ||
51 | + | |
52 | if (the_event == NULL) mpiStatus = MPI_INTERFACE_DONE; | |
53 | else mpiStatus = MPI_INTERFACE_CONTINUE; | |
54 | ||
55 | < | mpiError = MPI_Bcast(&mpiStatus,1,MPI_INT,0,MPI_COMM_WORLD); |
56 | < | if (mpiError != MPI_SUCCESS){ |
56 | < | mpiError = MPI_Finalize(); |
57 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
58 | < | exit (0); |
59 | < | } |
60 | < | |
55 | > | MPI_Bcast(&mpiStatus,1,MPI_INT,0,MPI_COMM_WORLD); |
56 | > | |
57 | if (!mpiStatus){ | |
58 | switch (the_event->event_type){ | |
59 | case MOLECULE: | |
# | Line 121 | Line 117 | void throwMPIEvent(event* the_event) | |
117 | ||
118 | strcpy(mpiEventContainer.lhs,the_event->evt.asmt.lhs); | |
119 | ||
120 | < | #ifdef D_VERBOSE |
121 | < | mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
120 | > | #ifdef MPIBASS_VERBOSE |
121 | > | |
122 | fprintf(stderr, | |
123 | "mpiDiag at node %d: evt Assignment: \"%s\" = ?\n" | |
124 | " mpi Assignment: \"%s\" = ?\n", | |
125 | < | mynode, |
125 | > | worldRank, |
126 | the_event->evt.asmt.lhs, | |
127 | mpiEventContainer.lhs); | |
128 | #endif | |
# | Line 155 | Line 151 | void throwMPIEvent(event* the_event) | |
151 | } | |
152 | ||
153 | ||
154 | < | mpiError = MPI_Bcast(&mpiEventContainer,1,mpiBASSEventType,0,MPI_COMM_WORLD); |
154 | > | MPI_Bcast(&mpiEventContainer,1,mpiBASSEventType,0,MPI_COMM_WORLD); |
155 | ||
156 | < | if (mpiError != MPI_SUCCESS){ |
157 | < | mpiError = MPI_Finalize(); |
158 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
163 | < | exit (0); |
164 | < | } |
156 | > | sprintf( checkPointMsg, |
157 | > | "BASS Event broadcast successful" ); |
158 | > | MPIcheckPoint(); |
159 | } | |
160 | } | |
161 | ||
# | Line 171 | Line 165 | void mpiEventLoop(void) | |
165 | { | |
166 | int mpiError; | |
167 | int mpiContinue; | |
174 | – | int mynode; |
168 | ||
169 | < | #ifdef D_VERBOSE |
177 | < | mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
169 | > | #ifdef MPIBASS_VERBOSE |
170 | fprintf(stderr, | |
171 | "event key List at node %d:\n" | |
172 | " MOLECULE %d\n" | |
# | Line 191 | Line 183 | void mpiEventLoop(void) | |
183 | " START_INDEX %d\n" | |
184 | " BLOCK_END %d\n" | |
185 | "\n", | |
186 | < | mynode, |
186 | > | worldRank, |
187 | MOLECULE, ATOM, BOND, BEND, TORSION, COMPONENT, | |
188 | POSITION, ASSIGNMENT, MEMBER, CONSTRAINT, ORIENTATION, | |
189 | START_INDEX, BLOCK_END ); | |
190 | #endif | |
191 | ||
192 | < | mpiError = MPI_Bcast(&mpiContinue,1,MPI_INT,0,MPI_COMM_WORLD); |
201 | < | if (mpiError != MPI_SUCCESS){ |
202 | < | mpiError = MPI_Finalize(); |
203 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
204 | < | exit (0); |
205 | < | } |
192 | > | MPI_Bcast(&mpiContinue,1,MPI_INT,0,MPI_COMM_WORLD); |
193 | ||
207 | – | |
194 | while(!mpiContinue){ | |
195 | ||
196 | mpiCatchEvent(); | |
197 | ||
198 | < | mpiError = MPI_Bcast(&mpiContinue,1,MPI_INT,0,MPI_COMM_WORLD); |
213 | < | if (mpiError != MPI_SUCCESS){ |
214 | < | mpiError = MPI_Finalize(); |
215 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
216 | < | exit (0); |
217 | < | } |
198 | > | MPI_Bcast(&mpiContinue,1,MPI_INT,0,MPI_COMM_WORLD); |
199 | } | |
200 | ||
201 | if (mpiContinue == MPI_INTERFACE_ABORT){ | |
202 | < | mpiError = MPI_Finalize(); |
222 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
202 | > | MPI_Finalize(); |
203 | exit (0); | |
204 | } | |
205 | } | |
# | Line 229 | Line 209 | void mpiCatchEvent(void) | |
209 | event the_event; | |
210 | mBEvent mpiEventContainer; | |
211 | int mpiError; | |
232 | – | int mynode; |
212 | ||
234 | – | |
235 | – | mpiError = MPI_Bcast(&mpiEventContainer,1,mpiBASSEventType,0,MPI_COMM_WORLD); |
213 | ||
214 | < | if (mpiError != MPI_SUCCESS){ |
215 | < | mpiError = MPI_Finalize(); |
239 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
240 | < | exit (0); |
241 | < | } |
214 | > | |
215 | > | MPI_Bcast(&mpiEventContainer,1,mpiBASSEventType,0,MPI_COMM_WORLD); |
216 | ||
243 | – | |
217 | switch (mpiEventContainer.type){ | |
218 | case mpiMOLECULE: | |
219 | the_event.event_type = MOLECULE; | |
# | Line 306 | Line 279 | void mpiCatchEvent(void) | |
279 | strcpy(the_event.evt.asmt.lhs,mpiEventContainer.lhs); | |
280 | strcpy(the_event.evt.asmt.rhs.sval,mpiEventContainer.cArray); | |
281 | ||
282 | < | #ifdef D_VERBOSE |
283 | < | mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
284 | < | fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %s\n", mynode, |
282 | > | #ifdef MPIBASS_VERBOSE |
283 | > | |
284 | > | fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %s\n", worldRank, |
285 | the_event.evt.asmt.lhs, | |
286 | the_event.evt.asmt.rhs.sval ); | |
287 | #endif | |
# | Line 321 | Line 294 | void mpiCatchEvent(void) | |
294 | strcpy(the_event.evt.asmt.lhs,mpiEventContainer.lhs); | |
295 | the_event.evt.asmt.rhs.ival = mpiEventContainer.i1; | |
296 | ||
297 | < | #ifdef D_VERBOSE |
298 | < | mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
299 | < | fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %d\n", mynode, |
297 | > | #ifdef MPIBASS_VERBOSE |
298 | > | |
299 | > | fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %d\n", worldRank, |
300 | the_event.evt.asmt.lhs, | |
301 | the_event.evt.asmt.rhs.ival ); | |
302 | #endif | |
# | Line 336 | Line 309 | void mpiCatchEvent(void) | |
309 | strcpy(the_event.evt.asmt.lhs,mpiEventContainer.lhs); | |
310 | the_event.evt.asmt.rhs.dval = mpiEventContainer.d1; | |
311 | ||
312 | < | #ifdef D_VERBOSE |
313 | < | mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
314 | < | fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %lf\n", mynode, |
312 | > | #ifdef MPIBASS_VERBOSE |
313 | > | |
314 | > | fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %lf\n", worldRank, |
315 | the_event.evt.asmt.lhs, | |
316 | the_event.evt.asmt.rhs.dval ); | |
317 | #endif | |
# | Line 350 | Line 323 | void mpiCatchEvent(void) | |
323 | break; | |
324 | } | |
325 | ||
326 | < | #ifdef D_VERBOSE |
327 | < | mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
328 | < | fprintf(stderr, "mpiDiag at node %d: event type is %d\n", mynode, |
326 | > | #ifdef MPIBASS_VERBOSE |
327 | > | |
328 | > | fprintf(stderr, "mpiDiag at node %d: event type is %d\n", worldRank, |
329 | the_event.event_type); | |
330 | #endif | |
331 | ||
332 | if (!event_handler(&the_event)){ | |
333 | < | mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
334 | < | fprintf(stderr,"MPI event handling error at node %d => %s\n",mynode,the_event.err_msg); |
335 | < | // mpiError = MPI_Finalize(); |
336 | < | // if (mpiError != MPI_SUCCESS) |
337 | < | mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
338 | < | exit (0); |
333 | > | |
334 | > | sprintf(painCave.errMsg, |
335 | > | "MPI event handling error at node %d => %s\n", |
336 | > | worldRank, |
337 | > | the_event.err_msg); |
338 | > | painCave.isFatal = 1; |
339 | > | simError(); |
340 | } | |
341 | + | MPIcheckPoint(); |
342 | } | |
343 | ||
344 | ||
# | Line 371 | Line 346 | void mpiInterfaceExit(void){ | |
346 | int mpiError; | |
347 | int mpiStatus = MPI_INTERFACE_ABORT; | |
348 | ||
349 | < | mpiError = MPI_Bcast(&mpiStatus,1,MPI_INT,0,MPI_COMM_WORLD); |
350 | < | if (mpiError != MPI_SUCCESS){ |
376 | < | mpiError = MPI_Finalize(); |
377 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
378 | < | exit (0); |
379 | < | } |
380 | < | |
381 | < | mpiError = MPI_Finalize(); |
382 | < | if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
349 | > | MPI_Bcast(&mpiStatus,1,MPI_INT,0,MPI_COMM_WORLD); |
350 | > | MPI_Finalize(); |
351 | exit (0); | |
352 | ||
353 | } |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |