Skip to content

Commit 67d1a2a

Browse files
authored
Merge pull request #10556 from hppritcha/fix_for_issue_10388_v5.0.x
sessions: add missing errhandler funcs
2 parents 70b2e04 + eecad9b commit 67d1a2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1142
-136
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.. _mpi_session_call_errhandler:
2+
3+
MPI_Session_call_errhandler
4+
===========================
5+
6+
.. include_body
7+
8+
:ref:`MPI_Session_call_errhandler` - Passes the supplied error code to the error
9+
handler assigned to a session
10+
11+
Syntax
12+
------
13+
14+
C Syntax
15+
^^^^^^^^
16+
17+
.. code:: c
18+
19+
#include <mpi.h>
20+
21+
int MPI_Session_call_errhandler(MPI_Session session, int errorcode)
22+
23+
Fortran Syntax
24+
^^^^^^^^^^^^^^
25+
26+
.. code:: Fortran
27+
28+
USE MPI
29+
! or the older form: INCLUDE 'mpif.h'
30+
31+
MPI_SESSION_CALL_ERRHANDLER(SESSION, ERRORCODE, IERROR)
32+
INTEGER SESSION, ERRORCODE, IERROR
33+
34+
Fortran 2008 Syntax
35+
^^^^^^^^^^^^^^^^^^^
36+
37+
.. code:: Fortran
38+
39+
USE mpi_f08
40+
41+
MPI_Session_call_errhandler(session, errorcode, ierror)
42+
TYPE(MPI_Session), INTENT(IN) :: session
43+
INTEGER, INTENT(IN) :: errorcode
44+
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
45+
46+
Input Parameter
47+
---------------
48+
49+
- session : session with error handler (handle).
50+
- errorcode : error code (integer).
51+
52+
Output Parameters
53+
-----------------
54+
55+
- IERROR : Fortran only: Error status (integer).
56+
57+
Description
58+
-----------
59+
60+
This function invokes the error handler assigned to the session
61+
session with the supplied error code errorcode. If the error handler was
62+
successfully called, the process is not aborted, and the error handler
63+
returns, this function returns MPI_SUCCESS.
64+
65+
Notes
66+
-----
67+
68+
Users should note that the default error handler is
69+
MPI_ERRORS_ARE_FATAL. Thus, calling this function will abort the
70+
processes in session if the default error handler has not been changed.
71+
72+
Errors
73+
------
74+
75+
Almost all MPI routines return an error value; C routines as the value
76+
of the function and Fortran routines in the last argument. See the MPI
77+
man page for a full list of MPI error codes.
78+
79+
80+
.. seealso:: :ref:`MPI_Session_create_errhandler`
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.. _mpi_session_get_errhandler:
2+
3+
4+
MPI_Session_get_errhandler
5+
==========================
6+
7+
.. include_body
8+
9+
:ref:`MPI_Session_get_errhandler` - Retrieves error handler associated with a
10+
session.
11+
12+
13+
SYNTAX
14+
------
15+
16+
17+
C Syntax
18+
^^^^^^^^
19+
20+
.. code-block:: c
21+
22+
#include <mpi.h>
23+
24+
int MPI_Session_get_errhandler(MPI_Session session,
25+
MPI_Errhandler *errhandler)
26+
27+
28+
Fortran Syntax
29+
^^^^^^^^^^^^^^
30+
31+
.. code-block:: fortran
32+
33+
USE MPI
34+
! or the older form: INCLUDE 'mpif.h'
35+
MPI_SESSION_GET_ERRHANDLER(SESSION, ERRHANDLER, IERROR)
36+
INTEGER SESSION, ERRHANDLER, IERROR
37+
38+
39+
Fortran 2008 Syntax
40+
^^^^^^^^^^^^^^^^^^^
41+
42+
.. code-block:: fortran
43+
44+
USE mpi_f08
45+
MPI_Session_get_errhandler(session, errhandler, ierror)
46+
TYPE(MPI_Session), INTENT(IN) :: session
47+
TYPE(MPI_Errhandler), INTENT(OUT) :: errhandler
48+
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
49+
50+
51+
INPUT PARAMETER
52+
---------------
53+
* ``session``: Session (handle).
54+
55+
OUTPUT PARAMETERS
56+
-----------------
57+
* ``errhandler``: New error handler for session (handle).
58+
* ``IERROR``: Fortran only: Error status (integer).
59+
60+
DESCRIPTION
61+
-----------
62+
63+
:ref:`MPI_Session_get_errhandler` retrieves the error handler currently associated
64+
with a session.
65+
66+
67+
ERRORS
68+
------
69+
70+
Almost all MPI routines return an error value; C routines as the value
71+
of the function and Fortran routines in the last argument.
72+
73+
Before the error value is returned, the current MPI error handler is
74+
called. By default, this error handler aborts the MPI job, except for
75+
I/O function errors. The error handler may be changed with
76+
:ref:`MPI_Session_set_errhandler`; the predefined error handler MPI_ERRORS_RETURN
77+
may be used to cause error values to be returned. Note that MPI does not
78+
guarantee that an MPI program can continue past an error.
79+
80+
See the MPI man page for a full list of MPI error codes.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
.. _mpi_session_set_errhandler:
2+
3+
4+
MPI_Session_set_errhandler
5+
==========================
6+
7+
.. include_body
8+
9+
:ref:`MPI_Session_set_errhandler` - Attaches a new error handler to a
10+
session.
11+
12+
13+
SYNTAX
14+
------
15+
16+
17+
C Syntax
18+
^^^^^^^^
19+
20+
.. code-block:: c
21+
22+
#include <mpi.h>
23+
24+
int MPI_Session_set_errhandler(MPI_Session session,
25+
MPI_Errhandler errhandler)
26+
27+
28+
Fortran Syntax
29+
^^^^^^^^^^^^^^
30+
31+
.. code-block:: fortran
32+
33+
USE MPI
34+
! or the older form: INCLUDE 'mpif.h'
35+
MPI_SESSION_SET_ERRHANDLER(SESSION, ERRHANDLER, IERROR)
36+
INTEGER SESSION, ERRHANDLER, IERROR
37+
38+
39+
Fortran 2008 Syntax
40+
^^^^^^^^^^^^^^^^^^^
41+
42+
.. code-block:: fortran
43+
44+
USE mpi_f08
45+
MPI_Session_set_errhandler(session, errhandler, ierror)
46+
TYPE(MPI_Session), INTENT(IN) :: session
47+
TYPE(MPI_Errhandler), INTENT(IN) :: errhandler
48+
INTEGER, OPTIONAL, INTENT(OUT) :: ierror
49+
50+
51+
INPUT/OUTPUT PARAMETER
52+
----------------------
53+
* ``session``: Session (handle).
54+
55+
OUTPUT PARAMETERS
56+
-----------------
57+
* ``errhandler``: New error handler for session (handle).
58+
* ``IERROR``: Fortran only: Error status (integer).
59+
60+
DESCRIPTION
61+
-----------
62+
63+
:ref:`MPI_Session_set_errhandler` attaches a new error handler to a session.
64+
The error handler must be either a predefined error handler or an error
65+
handler created by a call to :ref:`MPI_Session_create_errhandler`.
66+
67+
68+
ERRORS
69+
------
70+
71+
Almost all MPI routines return an error value; C routines as the value
72+
of the function and Fortran routines in the last argument.
73+
74+
Before the error value is returned, the current MPI error handler is
75+
called. By default, this error handler aborts the MPI job, except for
76+
I/O function errors. The error handler may be changed with
77+
:ref:`MPI_Session_set_errhandler`; the predefined error handler MPI_ERRORS_RETURN
78+
may be used to cause error values to be returned. Note that MPI does not
79+
guarantee that an MPI program can continue past an error.

docs/man-openmpi/man3/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,14 +320,17 @@ MPI API manual pages (section 3)
320320
MPI_Send_init.3.rst
321321
MPI_Sendrecv.3.rst
322322
MPI_Sendrecv_replace.3.rst
323+
MPI_Session_call_errhandler.3.rst
323324
MPI_Session_create_errhandler.3.rst
324325
MPI_Session_f2c.3.rst
325326
MPI_Session_finalize.3.rst
327+
MPI_Session_get_errhandler.3.rst
326328
MPI_Session_get_info.3.rst
327329
MPI_Session_get_nth_pset.3.rst
328330
MPI_Session_get_num_psets.3.rst
329331
MPI_Session_get_pset_info.3.rst
330332
MPI_Session_init.3.rst
333+
MPI_Session_set_errhandler.3.rst
331334
MPI_Sizeof.3.rst
332335
MPI_Ssend.3.rst
333336
MPI_Ssend_init.3.rst

ompi/include/mpi.h.in

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* reserved.
2727
* Copyright (c) 2021 Bull S.A.S. All rights reserved.
2828
* Copyright (c) 2018 Triad National Security, LLC. All rights
29-
* Copyright (c) 2018-2021 Triad National Security, LLC. All rights
29+
* Copyright (c) 2018-2022 Triad National Security, LLC. All rights
3030
* reserved.
3131
* $COPYRIGHT$
3232
*
@@ -1958,16 +1958,19 @@ OMPI_DECLSPEC int MPI_Sendrecv_replace(void * buf, int count, MPI_Datatype data
19581958
int dest, int sendtag, int source, int recvtag,
19591959
MPI_Comm comm, MPI_Status *status);
19601960
OMPI_DECLSPEC MPI_Fint MPI_Session_c2f (const MPI_Session session);
1961+
OMPI_DECLSPEC int MPI_Session_call_errhandler(MPI_Session session, int errorcode);
19611962
OMPI_DECLSPEC int MPI_Session_create_errhandler (MPI_Session_errhandler_function *session_errhandler_fn,
19621963
MPI_Errhandler *errhandler);
19631964
OMPI_DECLSPEC int MPI_Session_finalize (MPI_Session *session);
1965+
OMPI_DECLSPEC int MPI_Session_get_errhandler(MPI_Session session, MPI_Errhandler *erhandler);
19641966
OMPI_DECLSPEC int MPI_Session_get_info (MPI_Session session, MPI_Info *info_used);
19651967
OMPI_DECLSPEC int MPI_Session_get_num_psets (MPI_Session session, MPI_Info info, int *npset_names);
19661968
OMPI_DECLSPEC int MPI_Session_get_nth_pset (MPI_Session session, MPI_Info info, int n, int *len, char *pset_name);
19671969
OMPI_DECLSPEC int MPI_Session_get_pset_info (MPI_Session session, const char *pset_name, MPI_Info *info_used);
19681970
OMPI_DECLSPEC int MPI_Session_init (MPI_Info info, MPI_Errhandler errhandler,
19691971
MPI_Session *session);
19701972
OMPI_DECLSPEC MPI_Session MPI_Session_f2c (MPI_Fint session);
1973+
OMPI_DECLSPEC int MPI_Session_set_errhandler(MPI_Session session, MPI_Errhandler errhandler);
19711974
OMPI_DECLSPEC int MPI_Session_set_info (MPI_Session session, MPI_Info info);
19721975
OMPI_DECLSPEC int MPI_Ssend_init(const void *buf, int count, MPI_Datatype datatype,
19731976
int dest, int tag, MPI_Comm comm,
@@ -2719,16 +2722,19 @@ OMPI_DECLSPEC int PMPI_Sendrecv_replace(void * buf, int count, MPI_Datatype dat
27192722
int dest, int sendtag, int source, int recvtag,
27202723
MPI_Comm comm, MPI_Status *status);
27212724
OMPI_DECLSPEC MPI_Fint PMPI_Session_c2f (const MPI_Session session);
2725+
OMPI_DECLSPEC int PMPI_Session_call_errhandler(MPI_Session session, int errorcode);
27222726
OMPI_DECLSPEC int PMPI_Session_create_errhandler (MPI_Session_errhandler_function *session_errhandler_fn,
27232727
MPI_Errhandler *errhandler);
27242728
OMPI_DECLSPEC int PMPI_Session_finalize (MPI_Session *session);
2729+
OMPI_DECLSPEC int PMPI_Session_get_errhandler(MPI_Session session, MPI_Errhandler *erhandler);
27252730
OMPI_DECLSPEC int PMPI_Session_get_info (MPI_Session session, MPI_Info *info_used);
27262731
OMPI_DECLSPEC int PMPI_Session_get_num_psets (MPI_Session session, MPI_Info info, int *npset_names);
27272732
OMPI_DECLSPEC int PMPI_Session_get_nth_pset (MPI_Session session, MPI_Info info, int n, int *len, char *pset_name);
27282733
OMPI_DECLSPEC int PMPI_Session_get_pset_info (MPI_Session session, const char *pset_name, MPI_Info *info_used);
27292734
OMPI_DECLSPEC int PMPI_Session_init (MPI_Info info, MPI_Errhandler errhandler,
27302735
MPI_Session *session);
27312736
OMPI_DECLSPEC MPI_Session PMPI_Session_f2c (MPI_Fint session);
2737+
OMPI_DECLSPEC int PMPI_Session_set_errhandler(MPI_Session session, MPI_Errhandler erhandler);
27322738
OMPI_DECLSPEC int PMPI_Session_set_info (MPI_Session session, MPI_Info info);
27332739
OMPI_DECLSPEC int PMPI_Ssend_init(const void *buf, int count, MPI_Datatype datatype,
27342740
int dest, int tag, MPI_Comm comm,

ompi/instance/instance.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,16 @@ static void ompi_instance_construct (ompi_instance_t *instance)
8585
instance->i_name[0] = '\0';
8686
instance->i_flags = 0;
8787
instance->i_keyhash = NULL;
88+
OBJ_CONSTRUCT(&instance->s_lock, opal_mutex_t);
8889
instance->errhandler_type = OMPI_ERRHANDLER_TYPE_INSTANCE;
8990
}
9091

91-
OBJ_CLASS_INSTANCE(ompi_instance_t, opal_infosubscriber_t, ompi_instance_construct, NULL);
92+
static void ompi_instance_destruct(ompi_instance_t *instance)
93+
{
94+
OBJ_DESTRUCT(&instance->s_lock);
95+
}
96+
97+
OBJ_CLASS_INSTANCE(ompi_instance_t, opal_infosubscriber_t, ompi_instance_construct, ompi_instance_destruct);
9298

9399
/* NTH: frameworks needed by MPI */
94100
static mca_base_framework_t *ompi_framework_dependencies[] = {

ompi/instance/instance.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ struct ompi_group_t;
2727

2828
struct ompi_instance_t {
2929
opal_infosubscriber_t super;
30+
opal_mutex_t s_lock;
3031
int i_thread_level;
3132
char i_name[MPI_MAX_OBJECT_NAME];
3233
uint32_t i_flags;

ompi/mpi/c/Makefile.am

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,14 +369,17 @@ interface_profile_sources = \
369369
sendrecv.c \
370370
sendrecv_replace.c \
371371
session_c2f.c \
372+
session_call_errhandler.c \
372373
session_create_errhandler.c \
374+
session_get_errhandler.c \
373375
session_get_info.c \
374376
session_get_num_psets.c \
375377
session_get_nth_pset.c \
376378
session_get_pset_info.c \
377379
session_init.c \
378380
session_f2c.c \
379381
session_finalize.c \
382+
session_set_errhandler.c \
380383
session_set_info.c \
381384
ssend_init.c \
382385
ssend.c \

0 commit comments

Comments
 (0)