13 |
|
|
14 |
|
void mpiEventInit(void) |
15 |
|
{ |
16 |
< |
int blockCounts[4] = {1,3,4,120}; |
17 |
< |
MPI_Aint dspls[4]; |
18 |
< |
MPI_Datatype types[4]; |
16 |
> |
int blockCounts[5] = {1,3,4,120,80}; |
17 |
> |
MPI_Aint dspls[5]; |
18 |
> |
MPI_Datatype types[5]; |
19 |
|
mBEvent protoEvent; |
20 |
|
|
21 |
|
int i; |
24 |
|
MPI_Address(&protoEvent.d1, &dspls[1]); |
25 |
|
MPI_Address(&protoEvent.i1, &dspls[2]); |
26 |
|
MPI_Address(&protoEvent.cArray, &dspls[3]); |
27 |
+ |
MPI_Address(&protoEvent.lhs , &dspls[4]); |
28 |
|
|
29 |
|
|
30 |
|
types[0] = MPI_INT; |
31 |
|
types[1] = MPI_DOUBLE; |
32 |
|
types[2] = MPI_INT; |
33 |
|
types[3] = MPI_CHAR; |
34 |
+ |
types[4] = MPI_CHAR; |
35 |
|
|
36 |
|
|
37 |
< |
for (i =3; i >= 0; i--) dspls[i] -= dspls[0]; |
37 |
> |
for (i =4; i >= 0; i--) dspls[i] -= dspls[0]; |
38 |
|
|
39 |
< |
MPI_Type_struct(4,blockCounts,dspls,types,&mpiBASSEventType); |
39 |
> |
MPI_Type_struct(5,blockCounts,dspls,types,&mpiBASSEventType); |
40 |
|
MPI_Type_commit(&mpiBASSEventType); |
41 |
|
} |
42 |
|
|
46 |
|
mBEvent mpiEventContainer; |
47 |
|
int mpiStatus; |
48 |
|
int mpiError; |
49 |
+ |
int mynode; |
50 |
|
|
51 |
|
if (the_event == NULL) mpiStatus = MPI_INTERFACE_DONE; |
52 |
|
else mpiStatus = MPI_INTERFACE_CONTINUE; |
118 |
|
break; |
119 |
|
|
120 |
|
case ASSIGNMENT: |
121 |
+ |
|
122 |
+ |
strcpy(mpiEventContainer.lhs,the_event->evt.asmt.lhs); |
123 |
+ |
|
124 |
+ |
#ifdef D_VERBOSE |
125 |
+ |
mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
126 |
+ |
fprintf(stderr, |
127 |
+ |
"mpiDiag at node %d: evt Assignment: \"%s\" = ?\n" |
128 |
+ |
" mpi Assignment: \"%s\" = ?\n", |
129 |
+ |
mynode, |
130 |
+ |
the_event->evt.asmt.lhs, |
131 |
+ |
mpiEventContainer.lhs); |
132 |
+ |
#endif |
133 |
+ |
|
134 |
|
switch (the_event->evt.asmt.asmt_type){ |
135 |
|
case STRING: |
136 |
|
mpiEventContainer.type = mpiASSIGNMENT_s; |
171 |
|
{ |
172 |
|
int mpiError; |
173 |
|
int mpiContinue; |
174 |
+ |
int mynode; |
175 |
+ |
|
176 |
+ |
#ifdef D_VERBOSE |
177 |
+ |
mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
178 |
+ |
fprintf(stderr, |
179 |
+ |
"event key List at node %d:\n" |
180 |
+ |
" MOLECULE %d\n" |
181 |
+ |
" ATOM %d\n" |
182 |
+ |
" BOND %d\n" |
183 |
+ |
" BEND %d\n" |
184 |
+ |
" TORSION %d\n" |
185 |
+ |
" COMPONENT %d\n" |
186 |
+ |
" POSITION %d\n" |
187 |
+ |
" ASSIGNMENT %d\n" |
188 |
+ |
" MEMBER %d\n" |
189 |
+ |
" CONSTRAINT %d\n" |
190 |
+ |
" ORIENTATION %d\n" |
191 |
+ |
" START_INDEX %d\n" |
192 |
+ |
" BLOCK_END %d\n" |
193 |
+ |
"\n", |
194 |
+ |
mynode, |
195 |
+ |
MOLECULE, ATOM, BOND, BEND, TORSION, COMPONENT, |
196 |
+ |
POSITION, ASSIGNMENT, MEMBER, CONSTRAINT, ORIENTATION, |
197 |
+ |
START_INDEX, BLOCK_END ); |
198 |
+ |
#endif |
199 |
|
|
200 |
|
mpiError = MPI_Bcast(&mpiContinue,1,MPI_INT,0,MPI_COMM_WORLD); |
201 |
|
if (mpiError != MPI_SUCCESS){ |
229 |
|
event the_event; |
230 |
|
mBEvent mpiEventContainer; |
231 |
|
int mpiError; |
232 |
+ |
int mynode; |
233 |
|
|
234 |
|
|
235 |
|
mpiError = MPI_Bcast(&mpiEventContainer,1,mpiBASSEventType,0,MPI_COMM_WORLD); |
303 |
|
case mpiASSIGNMENT_s: |
304 |
|
the_event.event_type = ASSIGNMENT; |
305 |
|
the_event.evt.asmt.asmt_type = STRING; |
306 |
+ |
strcpy(the_event.evt.asmt.lhs,mpiEventContainer.lhs); |
307 |
|
strcpy(the_event.evt.asmt.rhs.sval,mpiEventContainer.cArray); |
308 |
+ |
|
309 |
+ |
#ifdef D_VERBOSE |
310 |
+ |
mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
311 |
+ |
fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %s\n", mynode, |
312 |
+ |
the_event.evt.asmt.lhs, |
313 |
+ |
the_event.evt.asmt.rhs.sval ); |
314 |
+ |
#endif |
315 |
+ |
|
316 |
|
break; |
317 |
|
|
318 |
|
case mpiASSIGNMENT_i: |
319 |
|
the_event.event_type = ASSIGNMENT; |
320 |
|
the_event.evt.asmt.asmt_type = INT; |
321 |
+ |
strcpy(the_event.evt.asmt.lhs,mpiEventContainer.lhs); |
322 |
|
the_event.evt.asmt.rhs.ival = mpiEventContainer.i1; |
323 |
+ |
|
324 |
+ |
#ifdef D_VERBOSE |
325 |
+ |
mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
326 |
+ |
fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %d\n", mynode, |
327 |
+ |
the_event.evt.asmt.lhs, |
328 |
+ |
the_event.evt.asmt.rhs.ival ); |
329 |
+ |
#endif |
330 |
+ |
|
331 |
|
break; |
332 |
|
|
333 |
|
case mpiASSIGNMENT_d: |
334 |
|
the_event.event_type = ASSIGNMENT; |
335 |
|
the_event.evt.asmt.asmt_type = DOUBLE; |
336 |
+ |
strcpy(the_event.evt.asmt.lhs,mpiEventContainer.lhs); |
337 |
|
the_event.evt.asmt.rhs.dval = mpiEventContainer.d1; |
338 |
+ |
|
339 |
+ |
#ifdef D_VERBOSE |
340 |
+ |
mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
341 |
+ |
fprintf(stderr, "mpiDiag at node %d: Assignment: %s = %lf\n", mynode, |
342 |
+ |
the_event.evt.asmt.lhs, |
343 |
+ |
the_event.evt.asmt.rhs.dval ); |
344 |
+ |
#endif |
345 |
+ |
|
346 |
|
break; |
347 |
|
|
348 |
|
case mpiBLOCK_END: |
350 |
|
break; |
351 |
|
} |
352 |
|
|
353 |
< |
|
354 |
< |
if (!event_handler(&the_event)){ |
355 |
< |
fprintf(stderr,"MPI event handling error => %s\n",the_event.err_msg); |
356 |
< |
mpiError = MPI_Finalize(); |
357 |
< |
if (mpiError != MPI_SUCCESS) mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
353 |
> |
#ifdef D_VERBOSE |
354 |
> |
mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
355 |
> |
fprintf(stderr, "mpiDiag at node %d: event type is %d\n", mynode, |
356 |
> |
the_event.event_type); |
357 |
> |
#endif |
358 |
> |
|
359 |
> |
if (!event_handler(&the_event)){ |
360 |
> |
mpiError = MPI_Comm_rank(MPI_COMM_WORLD,&mynode); |
361 |
> |
fprintf(stderr,"MPI event handling error at node %d => %s\n",mynode,the_event.err_msg); |
362 |
> |
// mpiError = MPI_Finalize(); |
363 |
> |
// if (mpiError != MPI_SUCCESS) |
364 |
> |
mpiError = MPI_Abort(MPI_COMM_WORLD,0); |
365 |
|
exit (0); |
366 |
|
} |
367 |
|
} |
370 |
|
void mpiInterfaceExit(void){ |
371 |
|
int mpiError; |
372 |
|
int mpiStatus = MPI_INTERFACE_ABORT; |
373 |
< |
|
373 |
> |
|
374 |
|
mpiError = MPI_Bcast(&mpiStatus,1,MPI_INT,0,MPI_COMM_WORLD); |
375 |
|
if (mpiError != MPI_SUCCESS){ |
376 |
|
mpiError = MPI_Finalize(); |