Skip to content

Commit 1022d0e

Browse files
committed
communicator: add errhandler_type back
Previous commit 2d68804 removed "errhandler_type" from communicator, and replaced it with "errhandler->eh_mpi_object_type". However, for an errhandler to be invoked on a communicator, errhandler_type must always be OMPI_ERRHANDLER_TYPE_COMM. But, errhandler->eh_mpi_object_type can be OMPI_ERRHANDLER_TYPE_PREDEFINED for predefined error handlers such as MPI_ERRORS_ARE_FATAL. This patch added "errhandler_type" back to communicator to address the issue. Signed-off-by: Wei Zhang <wzam@amazon.com>
1 parent 7b87ae4 commit 1022d0e

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

Diff for: ompi/communicator/comm_init.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ static void ompi_comm_construct(ompi_communicator_t* comm)
441441
/* A keyhash will be created if/when an attribute is cached on
442442
this communicator */
443443
comm->c_keyhash = NULL;
444-
444+
comm->errhandler_type = OMPI_ERRHANDLER_TYPE_COMM;
445445
comm->error_handler = &ompi_mpi_errors_are_fatal.eh;
446446
#ifdef OMPI_WANT_PERUSE
447447
comm->c_peruse_handles = NULL;

Diff for: ompi/communicator/communicator.h

+1
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ struct ompi_communicator_t {
313313
that the OMPI_ERRHDL_* macros can find it, regardless of whether
314314
it's a comm, window, or file. */
315315
ompi_errhandler_t *error_handler;
316+
ompi_errhandler_type_t errhandler_type;
316317

317318
/* Hooks for PML to hang things */
318319
struct mca_pml_comm_t *c_pml_comm;

Diff for: ompi/debuggers/predefined_gap_test.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ int main(int argc, char **argv) {
7171
#else
7272
GAP_CHECK("error_handler", test_comm, error_handler, c_f_to_c_index, 1);
7373
#endif
74+
GAP_CHECK("errhandler_type", test_comm, errhandler_type, error_handler, 1);
75+
GAP_CHECK("c_pml_comm", test_comm, c_pml_comm, errhandler_type, 1);
7476
GAP_CHECK("c_coll", test_comm, c_coll, c_pml_comm, 1);
7577

7678
/* Test Predefined group sizes */
@@ -125,7 +127,8 @@ int main(int argc, char **argv) {
125127
GAP_CHECK("w_keyhash", test_win, w_keyhash, w_flags, 1);
126128
GAP_CHECK("w_f_to_c_index", test_win, w_f_to_c_index, w_keyhash, 1);
127129
GAP_CHECK("error_handler", test_win, error_handler, w_f_to_c_index, 1);
128-
130+
GAP_CHECK("errhandler_type", test_win, errhandler_type, error_handler, 1);
131+
GAP_CHECK("w_osc_module", test_win, w_osc_module, errhandler_type, 1);
129132
/* Test Predefined info sizes */
130133
printf("=============================================\n");
131134
printf("ompi_predefined_info_t = %lu bytes\n", sizeof(ompi_predefined_info_t));
@@ -145,6 +148,8 @@ int main(int argc, char **argv) {
145148
GAP_CHECK("f_flags", test_file, f_flags, f_amode, 1);
146149
GAP_CHECK("f_f_to_c_index", test_file, f_f_to_c_index, f_flags, 1);
147150
GAP_CHECK("error_handler", test_file, error_handler, f_f_to_c_index, 1);
151+
GAP_CHECK("errhandler_type", test_file, errhandler_type, error_handler, 1);
152+
GAP_CHECK("f_io_version", test_file, f_io_version, errhandler_type, 1);
148153
GAP_CHECK("f_io_selected_component", test_file, f_io_selected_component, f_io_version, 1);
149154
GAP_CHECK("f_io_selected_module", test_file, f_io_selected_module, f_io_selected_component, 1);
150155
GAP_CHECK("f_io_selected_data", test_file, f_io_selected_data, f_io_selected_module, 1);

Diff for: ompi/errhandler/errhandler.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -388,10 +388,10 @@ int ompi_errhandler_proc_failed_internal(ompi_proc_t* ompi_proc, int status, boo
388388
OMPI_NAME_PRINT(&ompi_proc->super.proc_name),
389389
ompi_comm_print_cid(comm),
390390
proc_rank,
391-
(OMPI_ERRHANDLER_TYPE_PREDEFINED == comm->error_handler->eh_mpi_object_type ? "P" :
392-
(OMPI_ERRHANDLER_TYPE_COMM == comm->error_handler->eh_mpi_object_type ? "C" :
393-
(OMPI_ERRHANDLER_TYPE_WIN == comm->error_handler->eh_mpi_object_type ? "W" :
394-
(OMPI_ERRHANDLER_TYPE_FILE == comm->error_handler->eh_mpi_object_type ? "F" : "U") ) ) )
391+
(OMPI_ERRHANDLER_TYPE_PREDEFINED == comm->errhandler_type ? "P" :
392+
(OMPI_ERRHANDLER_TYPE_COMM == comm->errhandler_type ? "C" :
393+
(OMPI_ERRHANDLER_TYPE_WIN == comm->errhandler_type ? "W" :
394+
(OMPI_ERRHANDLER_TYPE_FILE == comm->errhandler_type ? "F" : "U") ) ) )
395395
));
396396
}
397397

Diff for: ompi/errhandler/errhandler.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ extern opal_atomic_int32_t ompi_instance_count;
238238
#define OMPI_ERRHANDLER_INVOKE(mpi_object, err_code, message) \
239239
ompi_errhandler_invoke((mpi_object)->error_handler, \
240240
(mpi_object), \
241-
(int)(mpi_object)->error_handler->eh_mpi_object_type, \
241+
(int)(mpi_object)->errhandler_type, \
242242
ompi_errcode_get_mpi_code(err_code), \
243243
(message));
244244

@@ -269,7 +269,7 @@ extern opal_atomic_int32_t ompi_instance_count;
269269
int __mpi_err_code = ompi_errcode_get_mpi_code(err_code); \
270270
ompi_errhandler_invoke((mpi_object)->error_handler, \
271271
(mpi_object), \
272-
(int) (mpi_object)->error_handler->eh_mpi_object_type, \
272+
(int) (mpi_object)->errhandler_type, \
273273
(__mpi_err_code), \
274274
(message)); \
275275
return (__mpi_err_code); \
@@ -307,7 +307,7 @@ extern opal_atomic_int32_t ompi_instance_count;
307307
int __mpi_err_code = ompi_errcode_get_mpi_code(err_code); \
308308
ompi_errhandler_invoke((mpi_object)->error_handler, \
309309
(mpi_object), \
310-
(int)(mpi_object)->error_handler->eh_mpi_object_type, \
310+
(int)(mpi_object)->errhandler_type, \
311311
(__mpi_err_code), \
312312
(message)); \
313313
return (__mpi_err_code); \

Diff for: ompi/errhandler/errhandler_invoke.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,19 @@ int ompi_errhandler_request_invoke(int count,
202202
case OMPI_REQUEST_COLL:
203203
return ompi_errhandler_invoke(mpi_object.comm->error_handler,
204204
mpi_object.comm,
205-
mpi_object.comm->error_handler->eh_mpi_object_type,
205+
mpi_object.comm->errhandler_type,
206206
ec, message);
207207
break;
208208
case OMPI_REQUEST_IO:
209209
return ompi_errhandler_invoke(mpi_object.file->error_handler,
210210
mpi_object.file,
211-
mpi_object.file->error_handler->eh_mpi_object_type,
211+
mpi_object.file->errhandler_type,
212212
ec, message);
213213
break;
214214
case OMPI_REQUEST_WIN:
215215
return ompi_errhandler_invoke(mpi_object.win->error_handler,
216216
mpi_object.win,
217-
mpi_object.win->error_handler->eh_mpi_object_type,
217+
mpi_object.win->errhandler_type,
218218
ec, message);
219219
break;
220220
default:

0 commit comments

Comments
 (0)