Skip to content

Commit 83d0f92

Browse files
committed
Set the initial error handler onto predefined communicators
Signed-off-by: Aurélien Bouteiller <bouteill@icl.utk.edu> update to the predefined initial error handler selection Signed-off-by: Aurelien Bouteiller <bouteill@icl.utk.edu>
1 parent 3cd85a9 commit 83d0f92

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

ompi/communicator/comm_init.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
44
* University Research and Technology
55
* Corporation. All rights reserved.
6-
* Copyright (c) 2004-2017 The University of Tennessee and The University
6+
* Copyright (c) 2004-2020 The University of Tennessee and The University
77
* of Tennessee Research Foundation. All rights
88
* reserved.
99
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
@@ -135,8 +135,8 @@ int ompi_comm_init(void)
135135
ompi_mpi_comm_world.comm.c_remote_group = group;
136136
OBJ_RETAIN(ompi_mpi_comm_world.comm.c_remote_group);
137137
ompi_mpi_comm_world.comm.c_cube_dim = opal_cube_dim((int)size);
138-
ompi_mpi_comm_world.comm.error_handler = &ompi_mpi_errors_are_fatal.eh;
139-
OBJ_RETAIN( &ompi_mpi_errors_are_fatal.eh );
138+
ompi_mpi_comm_world.comm.error_handler = ompi_initial_error_handler_eh;
139+
OBJ_RETAIN( ompi_mpi_comm_world.comm.error_handler );
140140
OMPI_COMM_SET_PML_ADDED(&ompi_mpi_comm_world.comm);
141141
opal_pointer_array_set_item (&ompi_mpi_communicators, 0, &ompi_mpi_comm_world);
142142

@@ -188,8 +188,8 @@ int ompi_comm_init(void)
188188
ompi_mpi_comm_self.comm.c_local_group = group;
189189
ompi_mpi_comm_self.comm.c_remote_group = group;
190190
OBJ_RETAIN(ompi_mpi_comm_self.comm.c_remote_group);
191-
ompi_mpi_comm_self.comm.error_handler = &ompi_mpi_errors_are_fatal.eh;
192-
OBJ_RETAIN( &ompi_mpi_errors_are_fatal.eh );
191+
ompi_mpi_comm_self.comm.error_handler = ompi_initial_error_handler_eh;
192+
OBJ_RETAIN( ompi_mpi_comm_self.comm.error_handler );
193193
OMPI_COMM_SET_PML_ADDED(&ompi_mpi_comm_self.comm);
194194
opal_pointer_array_set_item (&ompi_mpi_communicators, 1, &ompi_mpi_comm_self);
195195

@@ -214,8 +214,10 @@ int ompi_comm_init(void)
214214
ompi_mpi_comm_null.comm.c_contextid = 2;
215215
ompi_mpi_comm_null.comm.c_my_rank = MPI_PROC_NULL;
216216

217+
/* unlike world, self, and parent, comm_null does not inherit the initial error
218+
* handler */
217219
ompi_mpi_comm_null.comm.error_handler = &ompi_mpi_errors_are_fatal.eh;
218-
OBJ_RETAIN( &ompi_mpi_errors_are_fatal.eh );
220+
OBJ_RETAIN( ompi_mpi_comm_null.comm.error_handler );
219221
opal_pointer_array_set_item (&ompi_mpi_communicators, 2, &ompi_mpi_comm_null);
220222

221223
opal_string_copy(ompi_mpi_comm_null.comm.c_name, "MPI_COMM_NULL",
@@ -228,6 +230,8 @@ int ompi_comm_init(void)
228230
OBJ_RETAIN(&ompi_mpi_comm_null);
229231
OBJ_RETAIN(&ompi_mpi_group_null.group);
230232
OBJ_RETAIN(&ompi_mpi_errors_are_fatal.eh);
233+
/* During dyn_init, the comm_parent error handler will be set to the same
234+
* as comm_world (thus, the initial error handler). */
231235

232236
/* initialize communicator requests (for ompi_comm_idup) */
233237
ompi_comm_request_init ();

ompi/errhandler/errhandler.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ struct ompi_request_t;
233233
int32_t state = ompi_mpi_state; \
234234
if (OPAL_UNLIKELY(state < OMPI_MPI_STATE_INIT_COMPLETED || \
235235
state > OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT)) { \
236-
ompi_mpi_errors_are_fatal_comm_handler(NULL, NULL, name); \
236+
ompi_errhandler_invoke(NULL, NULL, -1, \
237+
ompi_errcode_get_mpi_code(MPI_ERR_ARG), \
238+
name); \
237239
} \
238240
}
239241

0 commit comments

Comments
 (0)