Skip to content

add MPI_ERR_ERRHANDLER error class #13342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ompi_mpi4py.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,27 +113,27 @@ jobs:
CFLAGS: "-O0"

- name: Test mpi4py (singleton)
run: python test/main.py -v -x test_doc
run: python test/main.py -v -x TestExcErrhandlerNull
if: ${{ true }}
timeout-minutes: 10
- name: Test mpi4py (np=1)
run: mpiexec -n 1 python test/main.py -v -x test_doc
run: mpiexec -n 1 python test/main.py -v -x TestExcErrhandlerNull
if: ${{ true }}
timeout-minutes: 10
- name: Test mpi4py (np=2)
run: mpiexec -n 2 python test/main.py -v -f -x test_doc
run: mpiexec -n 2 python test/main.py -v -f -x TestExcErrhandlerNull
if: ${{ true }}
timeout-minutes: 10
- name: Test mpi4py (np=3)
run: mpiexec -n 3 python test/main.py -v -f -x test_doc
run: mpiexec -n 3 python test/main.py -v -f -x TestExcErrhandlerNull
if: ${{ true }}
timeout-minutes: 10
- name: Test mpi4py (np=4)
run: mpiexec -n 4 python test/main.py -v -f -x test_doc
run: mpiexec -n 4 python test/main.py -v -f -x TestExcErrhandlerNull
if: ${{ true }}
timeout-minutes: 10
- name: Test mpi4py (np=5)
run: mpiexec -n 5 python test/main.py -v -f -x test_doc
run: mpiexec -n 5 python test/main.py -v -f -x TestExcErrhandlerNull
if: ${{ true }}
timeout-minutes: 10

Expand All @@ -151,7 +151,7 @@ jobs:
echo LD_LIBRARY_PATH=/opt/ompi/lib >> $GITHUB_ENV

- name: Test mpi4py (singleton)
run: python test/main.py -v -x test_doc
run: python test/main.py -v -x TestExcErrhandlerNull
if: ${{ true }}
timeout-minutes: 10

1 change: 1 addition & 0 deletions docs/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ OMPI_MAN3 = \
MPI_Errhandler_set.3 \
MPI_Error_class.3 \
MPI_Error_string.3 \
MPI_Errors.3 \
MPI_Exscan.3 \
MPI_Exscan_init.3 \
MPI_Fetch_and_op.3 \
Expand Down
8 changes: 8 additions & 0 deletions docs/man-openmpi/man3/MPI_Errors.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,14 @@ Standard error return classes for Open MPI:
- 78
- Invalid session

* - MPI_ERR_VALUE_TOO_LARGE
- 79
- Value is too large to store.

* - MPI_ERR_ERRHANDLER
- 89
- Invalid error handler handle.

* - MPI_ERR_LASTCODE
- 93
- Last error code.
Expand Down
3 changes: 3 additions & 0 deletions ompi/errhandler/errcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ static ompi_mpi_errcode_t ompi_err_revoked;
#endif
static ompi_mpi_errcode_t ompi_err_session;
static ompi_mpi_errcode_t ompi_err_value_too_large;
static ompi_mpi_errcode_t ompi_err_errhandler;

static void ompi_mpi_errcode_construct(ompi_mpi_errcode_t* errcode);
static void ompi_mpi_errcode_destruct(ompi_mpi_errcode_t* errcode);
Expand Down Expand Up @@ -245,6 +246,7 @@ int ompi_mpi_errcode_init (void)
#endif
CONSTRUCT_ERRCODE( ompi_err_session, MPI_ERR_SESSION, "MPI_ERR_SESSION: Invalid session handle" );
CONSTRUCT_ERRCODE( ompi_err_value_too_large, MPI_ERR_VALUE_TOO_LARGE, "MPI_ERR_VALUE_TOO_LARGE: Value is too large to store" );
CONSTRUCT_ERRCODE( ompi_err_errhandler, MPI_ERR_ERRHANDLER, "MPI_ERR_ERRHANDLER: Invalid error handler handle" );

/* Per MPI-3 p353:27-32, MPI_LASTUSEDCODE must be >=
MPI_ERR_LASTCODE. So just start it as == MPI_ERR_LASTCODE. */
Expand Down Expand Up @@ -362,6 +364,7 @@ int ompi_mpi_errcode_finalize (void)
#endif
OBJ_DESTRUCT(&ompi_err_session);
OBJ_DESTRUCT(&ompi_err_value_too_large);
OBJ_DESTRUCT(&ompi_err_errhandler);
OBJ_DESTRUCT(&ompi_mpi_errcodes);
ompi_mpi_errcode_lastpredefined = 0;
opal_mutex_unlock(&errcode_lock);
Expand Down
1 change: 1 addition & 0 deletions ompi/include/mpi.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ enum {
#define MPI_ERR_REVOKED 77
#define MPI_ERR_SESSION 78
#define MPI_ERR_VALUE_TOO_LARGE 79
#define MPI_ERR_ERRHANDLER 80

/* Per MPI-3 p349 47, MPI_ERR_LASTCODE must be >= the last predefined
MPI_ERR_<foo> code. Set the last code to allow some room for adding
Expand Down
1 change: 1 addition & 0 deletions ompi/include/mpif-values.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@
'MPI_T_ERR_INVALID': 72,
'MPI_ERR_SESSION': 78,
'MPI_ERR_VALUE_TOO_LARGE': 79,
'MPI_ERR_ERRHANDLER': 80,
'MPI_ERR_LASTCODE': 92,
'MPI_IDENT': 0,
'MPI_CONGRUENT': 1,
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/comm_create_from_group.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PROTOTYPE ERROR_CLASS comm_create_from_group (GROUP group, STRING tag, INFO info
( OMPI_ERRHANDLER_TYPE_COMM != errhandler->eh_mpi_object_type &&
OMPI_ERRHANDLER_TYPE_PREDEFINED != errhandler->eh_mpi_object_type) ) {
return ompi_errhandler_invoke (NULL, MPI_COMM_NULL, OMPI_ERRHANDLER_TYPE_COMM,
MPI_ERR_ARG,FUNC_NAME);
MPI_ERR_ERRHANDLER,FUNC_NAME);
}

if (NULL == tag) {
Expand Down
4 changes: 2 additions & 2 deletions ompi/mpi/c/comm_set_errhandler.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2016-2017 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2024 Triad National Security, LLC. All rights
* Copyright (c) 2024-2025 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
Expand Down Expand Up @@ -51,7 +51,7 @@ PROTOTYPE ERROR_CLASS comm_set_errhandler(COMM comm, ERRHANDLER errhandler)
MPI_ERRHANDLER_NULL == errhandler ||
( OMPI_ERRHANDLER_TYPE_COMM != errhandler->eh_mpi_object_type &&
OMPI_ERRHANDLER_TYPE_PREDEFINED != errhandler->eh_mpi_object_type) ) {
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ARG,
return OMPI_ERRHANDLER_INVOKE(comm, MPI_ERR_ERRHANDLER,
FUNC_NAME);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/errhandler_c2f.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ PROTOTYPE FINT errhandler_c2f(ERRHANDLER errhandler)
if (MPI_PARAM_CHECK) {
/* mapping an invalid handle to a null handle */
if (NULL == errhandler) {
return OMPI_INT_2_FINT(-1);
return OMPI_INT_2_FINT(MPI_ERR_ERRHANDLER);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/errhandler_free.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PROTOTYPE ERROR_CLASS errhandler_free(ERRHANDLER_OUT errhandler)
if (NULL == errhandler ||
(ompi_errhandler_is_intrinsic(*errhandler) &&
1 == (*errhandler)->super.obj_reference_count)) {
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_ARG,
return OMPI_ERRHANDLER_NOHANDLE_INVOKE(MPI_ERR_ERRHANDLER,
"MPI_Errhandler_free");
}
}
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/file_set_errhandler.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ PROTOTYPE ERROR_CLASS file_set_errhandler(FILE file, ERRHANDLER errhandler)
MPI_ERRHANDLER_NULL == errhandler ||
(OMPI_ERRHANDLER_TYPE_FILE != errhandler->eh_mpi_object_type &&
OMPI_ERRHANDLER_TYPE_PREDEFINED != errhandler->eh_mpi_object_type) ) {
return OMPI_ERRHANDLER_INVOKE(file, MPI_ERR_ARG, FUNC_NAME);
return OMPI_ERRHANDLER_INVOKE(file, MPI_ERR_ERRHANDLER, FUNC_NAME);
}
}

Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/intercomm_create_from_groups.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ PROTOTYPE ERROR_CLASS intercomm_create_from_groups (GROUP local_group, INT local
( OMPI_ERRHANDLER_TYPE_COMM != errhandler->eh_mpi_object_type &&
OMPI_ERRHANDLER_TYPE_PREDEFINED != errhandler->eh_mpi_object_type) ) {
return ompi_errhandler_invoke (NULL, MPI_COMM_NULL, OMPI_ERRHANDLER_TYPE_COMM,
MPI_ERR_ARG,FUNC_NAME);
MPI_ERR_ERRHANDLER,FUNC_NAME);

}

Expand Down
14 changes: 11 additions & 3 deletions ompi/mpi/c/session_init.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,19 @@ PROTOTYPE ERROR_CLASS session_init (INFO info, ERRHANDLER errhandler, SESSION_OU
const char ts_level_multi[] = "MPI_THREAD_MULTIPLE";

if ( MPI_PARAM_CHECK ) {
if (NULL == errhandler || NULL == session) {
return MPI_ERR_ARG;
if (NULL == errhandler) {
rc = MPI_ERR_ERRHANDLER;
goto fn_exit;
}

if (NULL == session) {
rc = MPI_ERR_ARG;
goto fn_exit;
}

if (NULL == info || ompi_info_is_freed (info)) {
return MPI_ERR_INFO;
rc = MPI_ERR_INFO;
goto fn_exit;
}
}

Expand All @@ -46,5 +53,6 @@ PROTOTYPE ERROR_CLASS session_init (INFO info, ERRHANDLER errhandler, SESSION_OU

rc = ompi_mpi_instance_init (ts_level, &info->super, errhandler, session, 0, NULL);
/* if an error occurred raise it on the null session */
fn_exit:
OMPI_ERRHANDLER_RETURN (rc, MPI_SESSION_NULL, rc, FUNC_NAME);
}
2 changes: 1 addition & 1 deletion ompi/mpi/c/session_set_errhandler.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ PROTOTYPE ERROR_CLASS session_set_errhandler(SESSION session, ERRHANDLER errhand
MPI_ERRHANDLER_NULL == errhandler ||
( OMPI_ERRHANDLER_TYPE_INSTANCE != errhandler->eh_mpi_object_type &&
OMPI_ERRHANDLER_TYPE_PREDEFINED != errhandler->eh_mpi_object_type) ) {
return OMPI_ERRHANDLER_INVOKE(session, MPI_ERR_ARG,
return OMPI_ERRHANDLER_INVOKE(session, MPI_ERR_ERRHANDLER,
FUNC_NAME);
}
}
Expand Down
2 changes: 1 addition & 1 deletion ompi/mpi/c/win_set_errhandler.c.in
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ PROTOTYPE ERROR_CLASS win_set_errhandler(WIN win, ERRHANDLER errhandler)
MPI_ERRHANDLER_NULL == errhandler ||
(OMPI_ERRHANDLER_TYPE_WIN != errhandler->eh_mpi_object_type &&
OMPI_ERRHANDLER_TYPE_PREDEFINED != errhandler->eh_mpi_object_type) ) {
return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_ARG, FUNC_NAME);
return OMPI_ERRHANDLER_INVOKE(win, MPI_ERR_ERRHANDLER, FUNC_NAME);
}
}

Expand Down
Loading