Skip to content

Commit 5f1f7fe

Browse files
committed
route errors to self/initial error handler depending upon the state of
MPI initialization Signed-off-by: Aurelien Bouteiller <bouteill@icl.utk.edu>
1 parent bed909c commit 5f1f7fe

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

ompi/errhandler/errhandler_invoke.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,25 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
4141
ompi_win_t *win;
4242
ompi_file_t *file;
4343

44-
/* If we got no errorhandler, then just invoke errors_are_fatal */
44+
/* If we got no errorhandler, then route the error to the appropriate
45+
* predefined error handler */
4546
if (NULL == errhandler) {
46-
ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, message);
47+
int32_t state = ompi_mpi_state;
48+
if (state >= OMPI_MPI_STATE_INIT_COMPLETED &&
49+
state < OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT) {
50+
comm = &ompi_mpi_comm_self.comm;
51+
comm->error_handler->eh_comm_fn(&comm, &err_code, message, NULL);
52+
}
53+
else {
54+
if(NULL == ompi_initial_error_handler) {
55+
int rc = ompi_initial_errhandler_init();
56+
if(OMPI_SUCCESS != rc) {
57+
/* don't know what else to do... */
58+
ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, message);
59+
}
60+
}
61+
ompi_initial_error_handler(NULL, NULL, message);
62+
}
4763
return err_code;
4864
}
4965

0 commit comments

Comments
 (0)