35 |
|
* |
36 |
|
* [1] Meineke, et al., J. Comp. Chem. 26, 252-271 (2005). |
37 |
|
* [2] Fennell & Gezelter, J. Chem. Phys. 124, 234104 (2006). |
38 |
< |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 24107 (2008). |
39 |
< |
* [4] Vardeman & Gezelter, in progress (2009). |
38 |
> |
* [3] Sun, Lin & Gezelter, J. Chem. Phys. 128, 234107 (2008). |
39 |
> |
* [4] Kuang & Gezelter, J. Chem. Phys. 133, 164101 (2010). |
40 |
> |
* [5] Vardeman, Stocker & Gezelter, J. Chem. Theory Comput. 7, 834 (2011). |
41 |
|
*/ |
42 |
+ |
#ifdef IS_MPI |
43 |
+ |
#include <mpi.h> |
44 |
+ |
#endif |
45 |
|
|
46 |
|
#include <stdlib.h> |
47 |
|
#include <stdio.h> |
48 |
|
#include <string.h> |
49 |
|
#include "config.h" |
46 |
– |
#ifdef IS_MPI |
47 |
– |
#include <mpi.h> |
48 |
– |
#endif |
50 |
|
|
51 |
|
int nChecks; |
52 |
|
|
64 |
|
painCave.isEventLoop = 0; |
65 |
|
nChecks = 0; |
66 |
|
#ifdef IS_MPI |
67 |
< |
MPI_Comm_rank( MPI_COMM_WORLD, &worldRank ); |
67 |
> |
MPI_Comm_rank( MPI_COMM_WORLD, &worldRank); |
68 |
|
#else |
69 |
|
worldRank = 0; |
70 |
|
#endif |
72 |
|
|
73 |
|
int simError( void ) { |
74 |
|
|
75 |
+ |
char errorMsg[MAX_SIM_ERROR_MSG_LENGTH]; |
76 |
+ |
|
77 |
+ |
#ifdef IS_MPI |
78 |
|
int myError = 1; |
79 |
|
int isError; |
76 |
– |
char errorMsg[MAX_SIM_ERROR_MSG_LENGTH]; |
80 |
|
char nodeMsg[MAX_SIM_ERROR_MSG_LENGTH]; |
81 |
+ |
#endif |
82 |
|
|
83 |
|
strcpy(errorMsg, "OpenMD "); |
84 |
|
switch( painCave.severity ) { |
118 |
|
|
119 |
|
if (painCave.isFatal) { |
120 |
|
#ifdef IS_MPI |
121 |
< |
MPI_Allreduce( &myError, &isError, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
121 |
> |
MPI_Allreduce(&myError, &isError, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
122 |
|
MPI_Finalize(); |
123 |
|
#endif |
124 |
|
exit(0); |
125 |
< |
} |
122 |
< |
|
125 |
> |
} |
126 |
|
return 1; |
127 |
|
} |
125 |
– |
|
128 |
|
|
129 |
+ |
|
130 |
|
void errorCheckPoint( void ){ |
131 |
< |
|
131 |
> |
|
132 |
|
int myError = 0; |
133 |
|
int isError = 0; |
134 |
< |
|
134 |
> |
|
135 |
|
#ifdef IS_MPI |
136 |
< |
MPI_Allreduce( &myError, &isError, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD ); |
136 |
> |
MPI_Allreduce(&myError, &isError, 1, MPI_INT, MPI_LOR, MPI_COMM_WORLD); |
137 |
|
#else |
138 |
|
isError = myError; |
139 |
|
#endif |
140 |
< |
|
141 |
< |
if( isError ){ |
139 |
< |
|
140 |
> |
|
141 |
> |
if( isError ){ |
142 |
|
#ifdef IS_MPI |
143 |
|
MPI_Finalize(); |
144 |
< |
#endif |
143 |
< |
|
144 |
> |
#endif |
145 |
|
exit(0); |
146 |
|
} |
147 |
< |
|
147 |
> |
|
148 |
|
#ifdef CHECKPOINT_VERBOSE |
149 |
|
nChecks++; |
150 |
|
|