Skip to content

Commit debea77

Browse files
authored
Merge pull request #8342 from AboorvaDevarajan/fix_comm_errhandler
ompi/errhandler: fix comm errhandler issue
2 parents 2165e87 + a242fa1 commit debea77

File tree

3 files changed

+11
-38
lines changed

3 files changed

+11
-38
lines changed

ompi/errhandler/errhandler.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,6 @@ static void ompi_errhandler_construct(ompi_errhandler_t *new_errhandler)
367367
new_errhandler->eh_file_fn = NULL;
368368
new_errhandler->eh_fort_fn = NULL;
369369

370-
new_errhandler->eh_cxx_dispatch_fn = NULL;
371-
372370
memset (new_errhandler->eh_name, 0, MPI_MAX_OBJECT_NAME);
373371
}
374372

ompi/errhandler/errhandler.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ typedef void (ompi_errhandler_generic_handler_fn_t)(void *, int *, ...);
7171
*/
7272
enum ompi_errhandler_lang_t {
7373
OMPI_ERRHANDLER_LANG_C,
74-
OMPI_ERRHANDLER_LANG_CXX,
7574
OMPI_ERRHANDLER_LANG_FORTRAN
7675
};
7776
typedef enum ompi_errhandler_lang_t ompi_errhandler_lang_t;
@@ -89,17 +88,6 @@ enum ompi_errhandler_type_t {
8988
typedef enum ompi_errhandler_type_t ompi_errhandler_type_t;
9089

9190

92-
/*
93-
* Need to forward declare this for use in ompi_errhandle_cxx_dispatch_fn_t.
94-
*/
95-
struct ompi_errhandler_t;
96-
97-
/**
98-
* C++ invocation function signature
99-
*/
100-
typedef void (ompi_errhandler_cxx_dispatch_fn_t)(void *handle, int *err_code,
101-
const char *message, ompi_errhandler_generic_handler_fn_t *fn);
102-
10391
/**
10492
* Back-end type for MPI_Errorhandler.
10593
*/
@@ -123,14 +111,6 @@ struct ompi_errhandler_t {
123111
MPI_Win_errhandler_function *eh_win_fn;
124112
ompi_errhandler_fortran_handler_fn_t *eh_fort_fn;
125113

126-
/* Have separate callback for C++ errhandlers. This pointer is
127-
initialized to NULL and will be set explicitly by the C++
128-
bindings for Create_errhandler. This function is invoked
129-
when eh_lang==OMPI_ERRHANDLER_LANG_CXX so that the user's
130-
callback function can be invoked with the right language
131-
semantics. */
132-
ompi_errhandler_cxx_dispatch_fn_t *eh_cxx_dispatch_fn;
133-
134114
/* index in Fortran <-> C translation array */
135115
int eh_f_to_c_index;
136116
};

ompi/errhandler/errhandler_invoke.c

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,17 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
4848
if (state >= OMPI_MPI_STATE_INIT_COMPLETED &&
4949
state < OMPI_MPI_STATE_FINALIZE_PAST_COMM_SELF_DESTRUCT) {
5050
comm = (ompi_mpi_compat_mpi3)? &ompi_mpi_comm_world.comm: &ompi_mpi_comm_self.comm;
51-
comm->error_handler->eh_comm_fn(&comm, &err_code, message, NULL);
51+
switch (comm->error_handler->eh_lang) {
52+
case OMPI_ERRHANDLER_LANG_C:
53+
comm->error_handler->eh_comm_fn(&comm, &err_code, message, NULL);
54+
break;
55+
56+
case OMPI_ERRHANDLER_LANG_FORTRAN:
57+
fortran_handle = OMPI_INT_2_FINT(comm->c_f_to_c_index);
58+
comm->error_handler->eh_fort_fn(&fortran_handle, &fortran_err_code);
59+
err_code = OMPI_FINT_2_INT(fortran_err_code);
60+
break;
61+
}
5262
}
5363
else {
5464
if(NULL == ompi_initial_error_handler) {
@@ -74,11 +84,6 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
7484
errhandler->eh_comm_fn(&comm, &err_code, message, NULL);
7585
break;
7686

77-
case OMPI_ERRHANDLER_LANG_CXX:
78-
errhandler->eh_cxx_dispatch_fn(&comm, &err_code, message,
79-
(ompi_errhandler_generic_handler_fn_t *)errhandler->eh_comm_fn);
80-
break;
81-
8287
case OMPI_ERRHANDLER_LANG_FORTRAN:
8388
fortran_handle = OMPI_INT_2_FINT(comm->c_f_to_c_index);
8489
errhandler->eh_fort_fn(&fortran_handle, &fortran_err_code);
@@ -94,11 +99,6 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
9499
errhandler->eh_win_fn(&win, &err_code, message, NULL);
95100
break;
96101

97-
case OMPI_ERRHANDLER_LANG_CXX:
98-
errhandler->eh_cxx_dispatch_fn(&win, &err_code, message,
99-
(ompi_errhandler_generic_handler_fn_t *)errhandler->eh_win_fn);
100-
break;
101-
102102
case OMPI_ERRHANDLER_LANG_FORTRAN:
103103
fortran_handle = OMPI_INT_2_FINT(win->w_f_to_c_index);
104104
errhandler->eh_fort_fn(&fortran_handle, &fortran_err_code);
@@ -114,11 +114,6 @@ int ompi_errhandler_invoke(ompi_errhandler_t *errhandler, void *mpi_object,
114114
errhandler->eh_file_fn(&file, &err_code, message, NULL);
115115
break;
116116

117-
case OMPI_ERRHANDLER_LANG_CXX:
118-
errhandler->eh_cxx_dispatch_fn(&file, &err_code, message,
119-
(ompi_errhandler_generic_handler_fn_t *)errhandler->eh_file_fn);
120-
break;
121-
122117
case OMPI_ERRHANDLER_LANG_FORTRAN:
123118
fortran_handle = OMPI_INT_2_FINT(file->f_f_to_c_index);
124119
errhandler->eh_fort_fn(&fortran_handle, &fortran_err_code);

0 commit comments

Comments
 (0)