From 562288912a658f7a6e61f0467d4ee55ed947cfb5 Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 6 Feb 2025 16:23:36 -0700 Subject: [PATCH 1/2] MPI_T: provide a stub implementation of events Signed-off-by: Howard Pritchard --- configure.ac | 7 ++ docs/Makefile.am | 18 +++ .../man3/MPI_T_event_callback_get_info.3.rst | 55 ++++++++ .../man3/MPI_T_event_callback_set_info.3.rst | 49 ++++++++ docs/man-openmpi/man3/MPI_T_event_copy.3.rst | 52 ++++++++ .../man3/MPI_T_event_get_index.3.rst | 52 ++++++++ .../man3/MPI_T_event_get_info.3.rst | 67 ++++++++++ .../man3/MPI_T_event_get_num.3.rst | 51 ++++++++ .../man3/MPI_T_event_get_source.3.rst | 50 ++++++++ .../man3/MPI_T_event_get_timestamp.3.rst | 50 ++++++++ .../man3/MPI_T_event_handle_alloc.3.rst | 53 ++++++++ .../man3/MPI_T_event_handle_free.3.rst | 9 ++ .../man3/MPI_T_event_handle_get_info.3.rst | 49 ++++++++ .../man3/MPI_T_event_handle_set_info.3.rst | 48 +++++++ docs/man-openmpi/man3/MPI_T_event_read.3.rst | 51 ++++++++ .../man3/MPI_T_event_register_callback.3.rst | 55 ++++++++ .../MPI_T_event_set_dropped_handler.3.rst | 49 ++++++++ .../man3/MPI_T_source_get_info.3.rst | 60 +++++++++ .../man3/MPI_T_source_get_num.3.rst | 57 +++++++++ .../man3/MPI_T_source_get_timestamp.3.rst | 47 +++++++ docs/man-openmpi/man3/index.rst | 18 +++ ompi/include/mpi.h.in | 117 +++++++++++++++++- ompi/mpi/tool/Makefile.am | 24 +++- ompi/mpi/tool/event_callback_get_info.c | 38 ++++++ ompi/mpi/tool/event_callback_set_info.c | 36 ++++++ ompi/mpi/tool/event_copy.c | 35 ++++++ ompi/mpi/tool/event_get_index.c | 37 ++++++ ompi/mpi/tool/event_get_info.c | 38 ++++++ ompi/mpi/tool/event_get_num.c | 38 ++++++ ompi/mpi/tool/event_get_source.c | 34 +++++ ompi/mpi/tool/event_get_timestamp.c | 34 +++++ ompi/mpi/tool/event_handle_alloc.c | 35 ++++++ ompi/mpi/tool/event_handle_free.c | 36 ++++++ ompi/mpi/tool/event_handle_get_info.c | 36 ++++++ ompi/mpi/tool/event_handle_set_info.c | 36 ++++++ ompi/mpi/tool/event_read.c | 34 +++++ ompi/mpi/tool/event_register_callback.c | 36 ++++++ ompi/mpi/tool/event_set_dropped_handler.c | 35 ++++++ ompi/mpi/tool/source_get_info.c | 34 +++++ ompi/mpi/tool/source_get_num.c | 38 ++++++ ompi/mpi/tool/source_get_timestamp.c | 37 ++++++ 41 files changed, 1732 insertions(+), 3 deletions(-) create mode 100644 docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_copy.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_get_index.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_get_info.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_get_num.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_get_source.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_handle_get_info.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_handle_set_info.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_read.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_source_get_info.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_source_get_num.3.rst create mode 100644 docs/man-openmpi/man3/MPI_T_source_get_timestamp.3.rst create mode 100644 ompi/mpi/tool/event_callback_get_info.c create mode 100644 ompi/mpi/tool/event_callback_set_info.c create mode 100644 ompi/mpi/tool/event_copy.c create mode 100644 ompi/mpi/tool/event_get_index.c create mode 100644 ompi/mpi/tool/event_get_info.c create mode 100644 ompi/mpi/tool/event_get_num.c create mode 100644 ompi/mpi/tool/event_get_source.c create mode 100644 ompi/mpi/tool/event_get_timestamp.c create mode 100644 ompi/mpi/tool/event_handle_alloc.c create mode 100644 ompi/mpi/tool/event_handle_free.c create mode 100644 ompi/mpi/tool/event_handle_get_info.c create mode 100644 ompi/mpi/tool/event_handle_set_info.c create mode 100644 ompi/mpi/tool/event_read.c create mode 100644 ompi/mpi/tool/event_register_callback.c create mode 100644 ompi/mpi/tool/event_set_dropped_handler.c create mode 100644 ompi/mpi/tool/source_get_info.c create mode 100644 ompi/mpi/tool/source_get_num.c create mode 100644 ompi/mpi/tool/source_get_timestamp.c diff --git a/configure.ac b/configure.ac index b7cad3c66c1..a6fe780c069 100644 --- a/configure.ac +++ b/configure.ac @@ -190,6 +190,12 @@ AC_MSG_CHECKING([for bootstrap Libtool version]) ltversion=`grep VERSION= $srcdir/config/ltmain.sh | head -n 1 | cut -d= -f2` AC_MSG_RESULT([$ltversion]) +# Ensure mpi.h.in and mca_base_event.h have consistent callback safety values +AC_DEFINE_UNQUOTED([OPAL_MCA_BASE_CB_REQUIRE_NONE], [0], [Keeping OPAL and OMPI values in sync]) +AC_DEFINE_UNQUOTED([OPAL_MCA_BASE_CB_REQUIRE_MPI_RESTRICTED], [1], [Keeping OPAL and OMPI values in sync]) +AC_DEFINE_UNQUOTED([OPAL_MCA_BASE_CB_REQUIRE_THREAD_SAFE], [2], [Keeping OPAL and OMPI values in sync]) +AC_DEFINE_UNQUOTED([OPAL_MCA_BASE_CB_REQUIRE_ASYNC_SIGNAL_SAFE], [3], [Keeping OPAL and OMPI values in sync]) + # List header files to generate AC_CONFIG_HEADERS([opal/include/opal_config.h]) @@ -1399,6 +1405,7 @@ if test $ac_cv_header_sys_synch_h = yes ; then [Do not use outside of mpi.h. Define to 1 if you have the header file.]) fi + # If there is a local hook for each project, call it. This allows 3rd # parties to add configuration steps to OPAL and/or OMPI simply # by placing a file in [opal|ompi]/config/whatever.m4 that diff --git a/docs/Makefile.am b/docs/Makefile.am index 3abae38bc95..64180798662 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -437,6 +437,21 @@ OMPI_MAN3 = \ MPI_T_cvar_write.3 \ MPI_T_enum_get_info.3 \ MPI_T_enum_get_item.3 \ + MPI_T_event_callback_get_info.3 \ + MPI_T_event_callback_set_info.3 \ + MPI_T_event_copy.3 \ + MPI_T_event_get_index.3 \ + MPI_T_event_get_info.3 \ + MPI_T_event_get_num.3 \ + MPI_T_event_get_source.3 \ + MPI_T_event_get_timestamp.3 \ + MPI_T_event_handle_alloc.3 \ + MPI_T_event_handle_free.3 \ + MPI_T_event_handle_get_info.3 \ + MPI_T_event_handle_set_info.3 \ + MPI_T_event_read.3 \ + MPI_T_event_register_callback.3 \ + MPI_T_event_set_dropped_handler.3 \ MPI_Test.3 \ MPI_Testall.3 \ MPI_Testany.3 \ @@ -457,6 +472,9 @@ OMPI_MAN3 = \ MPI_T_pvar_start.3 \ MPI_T_pvar_stop.3 \ MPI_T_pvar_write.3 \ + MPI_T_source_get_info.3 \ + MPI_T_source_get_num.3 \ + MPI_T_source_get_timestamp.3 \ MPI_Type_c2f.3 \ MPI_Type_commit.3 \ MPI_Type_contiguous.3 \ diff --git a/docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst new file mode 100644 index 00000000000..24b922ca879 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst @@ -0,0 +1,55 @@ +.. _mpi_t_event_callback_get_info: + + +MPI_T_event_callback_get_info +============================= + +.. include_body + +:ref:`MPI_T_event_callback_get_info` |mdash| Returns a new info object containing the hints of the callback function registered for the callback safety level specified by cb_safety of the event-registration handle associated with event_registration. + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_callback_get_info(MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info *info_used) + + +INPUT PARAMETERS +---------------- +* ``event_registration``: Event registration +* ``cb_safety``: maximum callback safety level + +OUTPUT PARAMETERS +----------------- + +* ``info_used``: Info argument + +DESCRIPTION +----------- + +:ref:`MPI_T_event_callback_get_info` returns a new info object containing the +hints of the callback function registered for the callback safety level specified by `cb_safety` of +the event-registration handle associated with `event_registration`. + + +ERRORS +------ + +:ref:`MPI_T_event_callback_get_info` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid + +* ``MPI_T_ERR_INVALID_HANDLE``: Invalid use of the interface or bad parameter values(s). + +* ``MPI_T_ERR_OTHER``: Other error diff --git a/docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst new file mode 100644 index 00000000000..4f62d7aabc8 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst @@ -0,0 +1,49 @@ +.. _mpi_t_event_callback_set_info: + + +MPI_T_event_callback_set_info +============================= + +.. include_body + +:ref:`MPI_T_event_callback_set_info` |mdash| Updates the hints of the callback function registered for the callback safety level specified by cb_safety of the event-registration handle associated with event_registration. + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_callback_set_info(MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info) + + +INPUT PARAMETERS +---------------- +* ``event_registration``: Event registration +* ``cb_safety``: maximum callback safety level +* ``info``: Info argument + +DESCRIPTION +----------- + +:ref:`MPI_T_event_callback_set_info` Updates the hints of the callback function registered for the callback safety level specified by `cb_safety` of the event-registration handle associated with event_registration. + + +ERRORS +------ + +:ref:`MPI_T_event_callback_set_info` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid + +* ``MPI_T_ERR_INVALID_HANDLE``: Invalid use of the interface or bad parameter values(s). + +* ``MPI_T_ERR_OTHER``: Other error diff --git a/docs/man-openmpi/man3/MPI_T_event_copy.3.rst b/docs/man-openmpi/man3/MPI_T_event_copy.3.rst new file mode 100644 index 00000000000..7e83a652509 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_copy.3.rst @@ -0,0 +1,52 @@ +.. _mpi_t_event_copy: + + +MPI_T_event_copy +================ + +.. include_body + +:ref:`MPI_T_event_copy` |mdash| Copy event data as a whole into a user-specified buffer. + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_copy(MPI_T_event_instance event_instance, void *buffer) + + +INPUT PARAMETERS +---------------- +* ``event_instance``: event-instance handle provided to the callback function. +* ``buf``: pointer to a memory location to store the event data. + +DESCRIPTION +----------- + +:ref:`MPI_T_event_copy` copies the event data as a whole into the user-provided buffer. +The user must assure that the buffer is of at least the size of the extent of the event +type, which can be computed from the type and displacement information returned by the +corresponding call to :ref:`MPI_T_event_get_info`. + +ERRORS +------ + +:ref:`MPI_T_event_copy` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid + +* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s). + + +.. seealso:: + * :ref:`MPI_T_event_read` diff --git a/docs/man-openmpi/man3/MPI_T_event_get_index.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_index.3.rst new file mode 100644 index 00000000000..e4dcef6b82f --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_get_index.3.rst @@ -0,0 +1,52 @@ +.. _mpi_t_event_get_index: + + +MPI_T_event_get_index +===================== + +.. include_body + +:ref:`MPI_T_event_get_index` |mdash| Query the index of an event type identified by a known event type name + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_get_index(const char *name, int *event_index) + + +INPUT PARAMETERS +----------------- + +* ``name``: name of the event type + +OUTPUT PARAMETERS +----------------- + +* ``event_index``: index of the event type + + +DESCRIPTION +----------- + +:ref:`MPI_T_event_get_index` can be used to query for the index of an event type identified by a known +event type name. + +ERRORS +------ + +:ref:`MPI_T_event_get_index` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface is not + initialized + +* ``MPI_T_ERR_INVALID_NAME``: The event name is invalid + initialized diff --git a/docs/man-openmpi/man3/MPI_T_event_get_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_info.3.rst new file mode 100644 index 00000000000..d48ce779c08 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_get_info.3.rst @@ -0,0 +1,67 @@ +.. _mpi_t_event_get_info: + + +MPI_T_event_get_info +==================== + +.. include_body + +:ref:`MPI_T_event_get_info` |mdash| Returns additional information about a specific event type + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_get_info(int event_index, char *name, int *name_len, + int *verbosity, MPI_Datatype array_of_datatypes[], + MPI_Aint array_of_displacements[], int *num_elements, + MPI_T_enum *enumtype, MPI_Info *info, char *desc, + int *desc_len, int *bind) + +INPUT PARAMETERS +---------------- +* ``event_index``: Index of the event to be queried. + +INPUT/OUTPUT PARAMETERS +----------------------- +* ``name_len``: Length of the string and/or buffer for name. +* ``desc_len``: Length of the string and/or buffer for desc. +* ``num_elements``: length of array of datatypes and displacements. + +OUTPUT PARAMETERS +----------------- +* ``name``: Buffer to return the string containing the name of the event type. +* ``verbosity``: Verbosity level of this event type +* ``array_of_datatypes``: Array of mpi basic datatypes used to encode the event data +* ``array_of_displacements``: Array of byte displacements of the elements in the event buffer +* ``enumtype``: Optional descriptor for enumeration information +* ``info``: Optional info argument. +* ``desc``: Buffer to return the string containing the description of the event type. +* ``bind``: Type of mpi object to which an event of this type must be bound + +DESCRIPTION +----------- + +:ref:`MPI_T_event_get_info` can be used to query information from for a specific event type. + + +ERRORS +------ + +:ref:`MPI_T_event_get_info` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The source index is invalid + +* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s). + +* ``MPI_ERR_OTHER``: Other error diff --git a/docs/man-openmpi/man3/MPI_T_event_get_num.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_num.3.rst new file mode 100644 index 00000000000..c5a894fa204 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_get_num.3.rst @@ -0,0 +1,51 @@ +.. _mpi_t_event_get_num: + + +MPI_T_event_get_num +=================== + +.. include_body + +:ref:`MPI_T_event_get_num` |mdash| Query the number of MPI_T event types + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_get_num(int *num_events) + + +OUTPUT PARAMETERS +----------------- + +* ``num_events``: Returns number of event types + + +DESCRIPTION +----------- + +:ref:`MPI_T_event_get_num` can be used to query the current number of MPI_T event types. + +The number of available event types can be queried with a call to +:ref:`MPI_T_event_get_num`. An MPI implementation is allowed to increase the number of event types during the +execution of an MPI process. However, MPI implementations are not allowed to change the +index of an event type or to delete an event type once it has been made visible to the user. + +.. note:: Open MPI will currently return that there are 0 event types. + + +ERRORS +------ + +:ref:`MPI_T_event_get_num` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface is not + initialized diff --git a/docs/man-openmpi/man3/MPI_T_event_get_source.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_source.3.rst new file mode 100644 index 00000000000..e3f00158dcb --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_get_source.3.rst @@ -0,0 +1,50 @@ +.. _mpi_t_event_get_source: + + +MPI_T_event_get_source +======================= + +.. include_body + +:ref:`MPI_T_event_get_source` |mdash| Returns the index of the source of the event instance + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_get_source(MPI_T_event_instance event_instance, int *source_index) + + +INPUT PARAMETERS +---------------- +* ``event_instance``: Event instance provided to the callback function + +OUTPUT PARAMETERS +----------------- +* ``source_index``: Index identifying the source + +DESCRIPTION +----------- + +:ref:`MPI_T_event_get_source` returns the index of the source of `event_instance`. + +ERRORS +------ + +:ref:`MPI_T_event_get_source` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The handle is invalid + +* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s) + +* ``MPI_ERR_OTHER``: Other error diff --git a/docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst new file mode 100644 index 00000000000..6f0fd157c15 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst @@ -0,0 +1,50 @@ +.. _mpi_t_event_get_timestamp: + + +MPI_T_event_get_timestamp +========================= + +.. include_body + +:ref:`MPI_T_event_get_timestamp` |mdash| Returns the timestamp of when the event was initially observed by the implementation + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_get_timestamp(MPI_T_event_instance event_instance, MPI_Count *event_timestamp) + + +INPUT PARAMETERS +---------------- +* ``event_instance``: Event instance provided to the callback function + +OUTPUT PARAMETERS +----------------- +* ``timestamp``: The timestamp when the event was observed + +DESCRIPTION +----------- + +:ref:`MPI_T_event_get_timestamp` returns the timestamp of when the event was initially +observed by the implementation. The ``event_instance`` argument identifies the event +instance to query. + +ERRORS +------ + +:ref:`MPI_T_event_get_timestamp` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The handle is invalid + +* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s) diff --git a/docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst b/docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst new file mode 100644 index 00000000000..b5ca3239414 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst @@ -0,0 +1,53 @@ +.. _mpi_t_event_handle_alloc: + + +MPI_T_event_handle_alloc +======================== + +.. include_body + +:ref:`MPI_T_event_handle_alloc`, :ref:`MPI_T_event_handle_free` - Allocate/free +event handles + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_handle_alloc(int event_index, void *obj_handle, + MPI_T_event_registration *event_registration) + + int MPI_T_event_handle_free(MPI_T_event_registration event_registration, + void *user_data, MPI_T_event_free_cb_function free_cb_function) + +DESCRIPTION +----------- + +:ref:`MPI_T_event_handle_alloc` binds the control variable specified in +*event_index* to the MPI object specified in *obj_handle*. If +:ref:`MPI_T_event_get_info` returns MPI_T_BIND_NO_OBJECT as the binding of the +variable the *obj_handle* argument is ignored. + +:ref:`MPI_T_event_handle_free` frees a handle allocated by +:ref:`MPI_T_event_handle_alloc`. + +ERRORS +------ + +:ref:`MPI_T_event_handle_alloc` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The supplied event index is invalid + +* ``MPI_T_ERR_INVALID``: The supplied input parameter is invalid + +.. seealso:: + * :ref:`MPI_T_event_get_info` diff --git a/docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst b/docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst new file mode 100644 index 00000000000..65b6253280d --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst @@ -0,0 +1,9 @@ +.. _mpi_t_event_handle_free: + +MPI_T_event_handle_free +======================= + .. include_body + +.. include:: ../man3/MPI_T_event_handle_alloc.3.rst + :start-after: .. include_body + diff --git a/docs/man-openmpi/man3/MPI_T_event_handle_get_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_handle_get_info.3.rst new file mode 100644 index 00000000000..322b98883d2 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_handle_get_info.3.rst @@ -0,0 +1,49 @@ +.. _mpi_t_event_handle_get_info: + + +MPI_T_event_handle_get_info +=========================== + +.. include_body + +:ref:`MPI_T_event_handle_get_info` |mdash| Returns a new info object containing the hints of the event-registration handle associated with event_registration + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_handle_get_info(MPI_T_event_registration event_registration, + MPI_Info *info) + + +INPUT PARAMETERS +---------------- +* ``event_registration``: Event registration to be queried. + +OUTPUT PARAMETERS +----------------- +* ``info``: Info argument. + +DESCRIPTION +----------- + +:ref:`MPI_T_event_handle_get_info` can be used to query information from a +source. + + +ERRORS +------ + +:ref:`MPI_T_source_get_info` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The event registration is invalid diff --git a/docs/man-openmpi/man3/MPI_T_event_handle_set_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_handle_set_info.3.rst new file mode 100644 index 00000000000..7c48d6440ef --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_handle_set_info.3.rst @@ -0,0 +1,48 @@ +.. _mpi_t_event_handle_set_info: + + +MPI_T_event_handle_set_info +=========================== + +.. include_body + +:ref:`MPI_T_event_handle_set_info` |mdash| Updates the hints of the event-registration handle associated with event_registration. + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_handle_set_info(MPI_T_event_registration event_registration, + MPI_Info info) + + +INPUT PARAMETERS +---------------- +* ``event_registration``: Event registration to be queried. +* ``info``: Info argument. + +DESCRIPTION +----------- + +:ref:`MPI_T_event_handle_set_info` updates the hints of the event-registration handle +associated with event_registration using the hints provided in info. + + +ERRORS +------ + +:ref:`MPI_T_source_get_info` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The event registration is invalid + +* ``MPI_T_ERR_INFO``: Invalid info diff --git a/docs/man-openmpi/man3/MPI_T_event_read.3.rst b/docs/man-openmpi/man3/MPI_T_event_read.3.rst new file mode 100644 index 00000000000..fe49ef91000 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_read.3.rst @@ -0,0 +1,51 @@ +.. _mpi_t_event_read: + + +MPI_T_event_read +================ + +.. include_body + +:ref:`MPI_T_event_read` |mdash| Read the value of a event instance. + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_read(MPI_T_event_instance event_instance, int elem_index, void *buffer) + + +INPUT PARAMETERS +---------------- +* ``event_instance``: event-instance handle provided to the callback function. +* ``elem_index``: index into the array of datatypes of the item to be queried. +* ``buf``: pointer to a memory location to store the item data + +DESCRIPTION +----------- + +:ref:`MPI_T_event_read` allows users to copy one element of the event data to a userspecified +buffer at a time. + +ERRORS +------ + +:ref:`MPI_T_event_read` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid + +* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s). + + +.. seealso:: + * :ref:`MPI_T_event_copy` diff --git a/docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst b/docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst new file mode 100644 index 00000000000..9fa006a1941 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst @@ -0,0 +1,55 @@ +.. _mpi_t_event_register_callback: + + +MPI_T_event_register_callback +============================= + +.. include_body + +:ref:`MPI_T_event_register_callback` |mdash| Associates a user-defined function with an allocated event-registration handle + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_register_callback(MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info, + void *user_data, MPI_T_event_cb_funciton event_cb_function) + + +INPUT PARAMETERS +---------------- +* ``event_registration``: Event registration +* ``cb_safety``: maximum callback safety level +* ``info``: Info argument +* ``user_data``: pointer to a user-controlled buffer +* ``event_cb_function``: pointer to user-defined callback function + +DESCRIPTION +----------- + +:ref:`MPI_T_event_register_callback` associates a user-defined function pointed to +by `event_cb_function` with an allocated event-registration handle. The maximum callback +safety level supported by the callback function is passed in the argument `cb_safety`. + + +ERRORS +------ + +:ref:`MPI_T_event_register_callback` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid + +* ``MPI_T_ERR_INFO``: Invalid info + +* ``MPI_T_ERR_OTHER``: Other error diff --git a/docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst b/docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst new file mode 100644 index 00000000000..fed7787676c --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst @@ -0,0 +1,49 @@ +.. _mpi_t_event_set_dropped_handler: + + +MPI_T_event_set_dropped_handler +=============================== + +.. include_body + +:ref:`MPI_T_event_set_dropped_handler` |mdash| Registers a function to be called when event information is dropped for the registration handle specified in event_registration + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_set_dropped_handler(MPI_T_event_registration event_registration, + MPI_T_event_dropped_cb_function dropped_cb_function) + + +INPUT PARAMETERS +---------------- +* ``event_registration``: Event registration +* ``dropped_cb_function``: pointer to user-defined callback function + +DESCRIPTION +----------- + +:ref:`MPI_T_event_set_dropped_handler` registers the function +`dropped_cb_function` to be called by the MPI implementation when event information is +dropped for the registration handle specified in `event_registration`. + + +ERRORS +------ + +:ref:`MPI_T_event_set_dropped_handler` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid + +* ``MPI_T_ERR_OTHER``: Other error diff --git a/docs/man-openmpi/man3/MPI_T_source_get_info.3.rst b/docs/man-openmpi/man3/MPI_T_source_get_info.3.rst new file mode 100644 index 00000000000..fc29032ad91 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_source_get_info.3.rst @@ -0,0 +1,60 @@ +.. _mpi_t_source_get_info: + + +MPI_T_source_get_info +===================== + +.. include_body + +:ref:`MPI_T_source_get_info` |mdash| Query information from a source + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_source_get_info(int source_index, char *name, int *name_len, + char *desc, int *desc_len, MPI_T_source_order *ordering, + MPI_Count *ticks_per_second, MPI_Count *max_ticks, MPI_Info *info) + + +INPUT PARAMETERS +---------------- +* ``source_index``: Index of the source to be queried. + +INPUT/OUTPUT PARAMETERS +----------------------- +* ``name_len``: Length of the string and/or buffer for name. +* ``desc_len``: Length of the string and/or buffer for desc. + +OUTPUT PARAMETERS +----------------- +* ``name``: Buffer to return the string containing the name of the source. +* ``desc``: Buffer to return the string containing the description of the source. +* ``ordering``: Flag indicating chronological ordering guarantees given by the source. +* ``ticks_per_second``: The number of ticks per second for the timer of this source. +* ``max_ticks``: The maximum count of ticks reported by this source before overflow occurs. +* ``info``: Info argument. + +DESCRIPTION +----------- + +:ref:`MPI_T_source_get_info` can be used to query information from a +source. + + +ERRORS +------ + +:ref:`MPI_T_source_get_info` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The source index is invalid diff --git a/docs/man-openmpi/man3/MPI_T_source_get_num.3.rst b/docs/man-openmpi/man3/MPI_T_source_get_num.3.rst new file mode 100644 index 00000000000..b6aa1e8121b --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_source_get_num.3.rst @@ -0,0 +1,57 @@ +.. _mpi_t_source_get_num: + + +MPI_T_source_get_num +==================== + +.. include_body + +:ref:`MPI_T_source_get_num` |mdash| Query the number of MPI_T event sources + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_source_get_num(int *num_sources) + + +OUTPUT PARAMETERS +----------------- + +* ``num_sources``: Current number of sources + + +DESCRIPTION +----------- + +:ref:`MPI_T_source_get_num` can be used to query the current number of +MPI_T event sources. + +The number of available event sources can be queried with a call to +:ref:`MPI_T_Source_get_num`. An MPI implementation is allowed to +increase the number of sources during the execution of an MPI +process. However, MPI implementations are not allowed to change the +index of an event source or to delete an event source once it has been +made visible to the user (e.g., if new event sources become available +via dynamic loading of additional components in the MPI +implementation). + +.. note:: Open MPI will currently return that there are 0 sources of + MPI_T events. + + +ERRORS +------ + +:ref:`MPI_T_source_get_num` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface is not + initialized diff --git a/docs/man-openmpi/man3/MPI_T_source_get_timestamp.3.rst b/docs/man-openmpi/man3/MPI_T_source_get_timestamp.3.rst new file mode 100644 index 00000000000..c80ee1d20c5 --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_source_get_timestamp.3.rst @@ -0,0 +1,47 @@ +.. _mpi_t_source_get_timestamp: + + +MPI_T_source_get_timestamp +========================== + +.. include_body + +:ref:`MPI_T_source_get_timestamp` |mdash| Returns a current timestamp from the source identified by the source_index argument + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_source_get_timestamp(int source_index, MPI_Count *timestamp) + + +INPUT PARAMETERS +---------------- +* ``source_index``: Index of the source to be queried. + +OUTPUT PARAMETERS +----------------- +* ``timestamp``: The current timestamp from specified source. + +DESCRIPTION +----------- + +:ref:`MPI_T_source_get_timestamp` returns the current timestamp from the specificed source. + + +ERRORS +------ + +:ref:`MPI_T_source_get_timestamp` will fail if: + +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized + +* ``MPI_T_ERR_INVALID_INDEX``: The source index is invalid diff --git a/docs/man-openmpi/man3/index.rst b/docs/man-openmpi/man3/index.rst index 7df08ccb542..a0cbf2d192c 100644 --- a/docs/man-openmpi/man3/index.rst +++ b/docs/man-openmpi/man3/index.rst @@ -362,6 +362,21 @@ MPI API manual pages (section 3) MPI_T_cvar_write.3.rst MPI_T_enum_get_info.3.rst MPI_T_enum_get_item.3.rst + MPI_T_event_callback_get_info.3.rst + MPI_T_event_callback_set_info.3.rst + MPI_T_event_copy.3.rst + MPI_T_event_get_index.3.rst + MPI_T_event_get_info.3.rst + MPI_T_event_get_num.3.rst + MPI_T_event_get_source.3.rst + MPI_T_event_get_timestamp.3.rst + MPI_T_event_handle_alloc.3.rst + MPI_T_event_handle_free.3.rst + MPI_T_event_handle_get_info.3.rst + MPI_T_event_handle_set_info.3.rst + MPI_T_event_read.3.rst + MPI_T_event_register_callback.3.rst + MPI_T_event_set_dropped_handler.3.rst MPI_T_finalize.3.rst MPI_T_init_thread.3.rst MPI_T_pvar_get_info.3.rst @@ -376,6 +391,9 @@ MPI API manual pages (section 3) MPI_T_pvar_start.3.rst MPI_T_pvar_stop.3.rst MPI_T_pvar_write.3.rst + MPI_T_source_get_info.3.rst + MPI_T_source_get_num.3.rst + MPI_T_source_get_timestamp.3.rst MPI_Test.3.rst MPI_Test_cancelled.3.rst MPI_Testall.3.rst diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 0c26fa08d8f..cff404300be 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -25,7 +25,6 @@ * Copyright (c) 2021-2022 Amazon.com, Inc. or its affiliates. All Rights * reserved. * Copyright (c) 2021 Bull S.A.S. All rights reserved. - * Copyright (c) 2018 Triad National Security, LLC. All rights * Copyright (c) 2018-2022 Triad National Security, LLC. All rights * reserved. * $COPYRIGHT$ @@ -461,6 +460,8 @@ typedef struct ompi_mpit_cvar_handle_t *MPI_T_cvar_handle; typedef struct mca_base_pvar_handle_t *MPI_T_pvar_handle; typedef struct mca_base_pvar_session_t *MPI_T_pvar_session; typedef struct ompi_instance_t *MPI_Session; +typedef unsigned long *MPI_T_event_instance; +typedef unsigned long *MPI_T_event_registration; /* * MPI_Status @@ -920,6 +921,48 @@ enum { MPI_T_PVAR_CLASS_GENERIC }; +/* + * MPIT callback safety levels + * + * Values are set in configure.ac for consistency with mca_base_event.h + */ +#undef OPAL_MCA_BASE_CB_REQUIRE_NONE +#undef OPAL_MCA_BASE_CB_REQUIRE_MPI_RESTRICTED +#undef OPAL_MCA_BASE_CB_REQUIRE_THREAD_SAFE +#undef OPAL_MCA_BASE_CB_REQUIRE_ASYNC_SIGNAL_SAFE +typedef enum { + MPI_T_CB_REQUIRE_NONE = OPAL_MCA_BASE_CB_REQUIRE_NONE, + MPI_T_CB_REQUIRE_MPI_RESTRICTED = OPAL_MCA_BASE_CB_REQUIRE_MPI_RESTRICTED, + MPI_T_CB_REQUIRE_THREAD_SAFE = OPAL_MCA_BASE_CB_REQUIRE_THREAD_SAFE, + MPI_T_CB_REQUIRE_ASYNC_SIGNAL_SAFE = OPAL_MCA_BASE_CB_REQUIRE_ASYNC_SIGNAL_SAFE +} MPI_T_cb_safety; + +/* + * MPIT source ordering + */ +enum ompi_mpi_t_source_order_t { + MPI_T_ORDERED, + MPI_T_UNORDERED, +}; + +typedef enum ompi_mpi_t_source_order_t MPI_T_source_order; + +/* + * MPI Tool event functions + */ +typedef void (*MPI_T_event_free_cb_function) (MPI_T_event_registration handle, + MPI_T_cb_safety cb_safety, + void *user_data); +typedef void (*MPI_T_event_dropped_cb_function) (MPI_Count count, + MPI_T_event_registration handle, + int source_index, + MPI_T_cb_safety cb_safety, + void *user_data); +typedef void (*MPI_T_event_cb_function) (MPI_T_event_instance event, + MPI_T_event_registration handle, + MPI_T_cb_safety cb_safety, + void *user_data); + /* * NULL handles */ @@ -955,6 +998,7 @@ enum { #define MPI_T_PVAR_HANDLE_NULL ((MPI_T_pvar_handle) 0) #define MPI_T_PVAR_SESSION_NULL ((MPI_T_pvar_session) 0) #define MPI_T_CVAR_HANDLE_NULL ((MPI_T_cvar_handle) 0) +#define MPI_T_EVENT_REGISTRATION_NULL ((MPI_T_event_registration) 0) /* MPI-2 specifies that the name "MPI_TYPE_NULL_DELETE_FN" (and all related friends) must be accessible in C, C++, and Fortran. This is @@ -2953,6 +2997,41 @@ OMPI_DECLSPEC int PMPI_T_enum_get_info(MPI_T_enum enumtype, int *num, char *nam OMPI_DECLSPEC int PMPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name, int *name_len); +OMPI_DECLSPEC int PMPI_T_event_get_num (int *num_events); +OMPI_DECLSPEC int PMPI_T_event_get_info (int event_index, char *name, int *name_len, + int *verbosity, MPI_Datatype *array_of_datatypes, + MPI_Aint *array_of_displacements, int *num_elements, + MPI_T_enum *enumtype, MPI_Info *info, + char *desc, int *desc_len, int *bind); +OMPI_DECLSPEC int PMPI_T_event_get_index (const char *name, int *event_index); +OMPI_DECLSPEC int PMPI_T_event_handle_alloc (int event_index, void *obj_handle, + MPI_Info info, MPI_T_event_registration *event_registration); +OMPI_DECLSPEC int PMPI_T_event_handle_set_info (MPI_T_event_registration event_registration, MPI_Info info); +OMPI_DECLSPEC int PMPI_T_event_handle_get_info (MPI_T_event_registration event_registration, + MPI_Info *info_used); +OMPI_DECLSPEC int PMPI_T_event_register_callback (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info, void *user_data, + MPI_T_event_cb_function event_cb_function); +OMPI_DECLSPEC int PMPI_T_event_callback_set_info (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info); +OMPI_DECLSPEC int PMPI_T_event_callback_get_info (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info *info_used); +OMPI_DECLSPEC int PMPI_T_event_handle_free (MPI_T_event_registration event_registration, + void *user_data, + MPI_T_event_free_cb_function free_cb_function); +OMPI_DECLSPEC int PMPI_T_event_set_dropped_handler (MPI_T_event_registration handle, + MPI_T_event_dropped_cb_function dropped_cb_function); +OMPI_DECLSPEC int PMPI_T_event_read (MPI_T_event_instance event, int element_index, void *buffer); +OMPI_DECLSPEC int PMPI_T_event_copy (MPI_T_event_instance event, void *buffer); +OMPI_DECLSPEC int PMPI_T_event_get_timestamp (MPI_T_event_instance event, MPI_Count *event_time); +OMPI_DECLSPEC int PMPI_T_event_get_source (MPI_T_event_instance event, int *source_index); +OMPI_DECLSPEC int PMPI_T_source_get_num (int *num_source); +OMPI_DECLSPEC int PMPI_T_source_get_info (int source_id, char *name, int *name_len, + char *desc, int *desc_len, MPI_T_source_order *ordering, + MPI_Count *ticks_per_second, MPI_Count *max_timestamp, + MPI_Info *info); +OMPI_DECLSPEC int PMPI_T_source_get_timestamp (int source_id, MPI_Count *timestamp); + /* * Tool MPI API */ @@ -3032,6 +3111,42 @@ OMPI_DECLSPEC int PMPI_Info_get_valuelen(MPI_Info info, const char *key, int *v int *flag) __mpi_interface_deprecated_in_mpi40__("PMPI_Info_get_valuelen was deprecated in MPI-4.0; use PMPI_Info_get_string instead"); +OMPI_DECLSPEC int MPI_T_event_get_num (int *num_events); +OMPI_DECLSPEC int MPI_T_event_get_info (int event_index, char *name, int *name_len, + int *verbosity, MPI_Datatype *array_of_datatypes, + MPI_Aint *array_of_displacements, int *num_elements, + MPI_T_enum *enumtype, MPI_Info *info, + char *desc, int *desc_len, int *bind); +OMPI_DECLSPEC int MPI_T_event_get_index (const char *name, int *event_index); +OMPI_DECLSPEC int MPI_T_event_handle_alloc (int event_index, void *obj_handle, + MPI_Info info, MPI_T_event_registration *event_registration); +OMPI_DECLSPEC int MPI_T_event_handle_set_info (MPI_T_event_registration event_registration, MPI_Info info); +OMPI_DECLSPEC int MPI_T_event_handle_get_info (MPI_T_event_registration event_registration, + MPI_Info *info_used); +OMPI_DECLSPEC int MPI_T_event_handle_free (MPI_T_event_registration event_registration, + void *user_data, + MPI_T_event_free_cb_function free_cb_function); +OMPI_DECLSPEC int MPI_T_event_register_callback (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info, void *user_data, + MPI_T_event_cb_function event_cb_function); +OMPI_DECLSPEC int MPI_T_event_callback_set_info (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info); +OMPI_DECLSPEC int MPI_T_event_callback_get_info (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info *info_used); +OMPI_DECLSPEC int MPI_T_event_set_dropped_handler (MPI_T_event_registration handle, + MPI_T_event_dropped_cb_function dropped_cb_function); +OMPI_DECLSPEC int MPI_T_event_read (MPI_T_event_instance event, int element_index, void *buffer); +OMPI_DECLSPEC int MPI_T_event_copy (MPI_T_event_instance event, void *buffer); +OMPI_DECLSPEC int MPI_T_event_get_timestamp (MPI_T_event_instance event, MPI_Count *event_time); +OMPI_DECLSPEC int MPI_T_event_get_source (MPI_T_event_instance event, int *source_index); + +OMPI_DECLSPEC int MPI_T_source_get_num (int *num_source); +OMPI_DECLSPEC int MPI_T_source_get_info (int source_id, char *name, int *name_len, + char *desc, int *desc_len, MPI_T_source_order *ordering, + MPI_Count *ticks_per_second, MPI_Count *max_timestamp, + MPI_Info *info); +OMPI_DECLSPEC int MPI_T_source_get_timestamp (int source_id, MPI_Count *timestamp); + /* * Even though MPI_Copy_function and MPI_Delete_function are * deprecated, we do not use the attributes marking them as such, diff --git a/ompi/mpi/tool/Makefile.am b/ompi/mpi/tool/Makefile.am index 814ae91eebd..8d9c957c21e 100644 --- a/ompi/mpi/tool/Makefile.am +++ b/ompi/mpi/tool/Makefile.am @@ -4,7 +4,9 @@ # reserved. # Copyright (c) 2004-2006 High Performance Computing Center Stuttgart, # University of Stuttgart. All rights reserved. -# Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights +# Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights +# reserved. +# Copyright (c) 2018-2025 Triad National Security, LLC. All rightsa # reserved. # Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights # reserved. @@ -65,6 +67,21 @@ interface_profile_sources = \ cvar_write.c \ enum_get_info.c \ enum_get_item.c \ + event_get_index.c \ + event_copy.c \ + event_callback_get_info.c \ + event_callback_set_info.c \ + event_handle_get_info.c \ + event_handle_set_info.c \ + event_get_info.c \ + event_get_num.c \ + event_get_source.c \ + event_get_timestamp.c \ + event_handle_alloc.c \ + event_handle_free.c \ + event_read.c \ + event_register_callback.c \ + event_set_dropped_handler.c \ finalize.c \ init_thread.c \ pvar_get_info.c \ @@ -79,7 +96,10 @@ interface_profile_sources = \ pvar_session_free.c \ pvar_start.c \ pvar_stop.c \ - pvar_write.c + pvar_write.c \ + source_get_num.c \ + source_get_info.c \ + source_get_timestamp.c libmpi_mpit_profile_la_SOURCES = $(interface_profile_sources) libmpi_mpit_profile_la_CPPFLAGS = -DOMPI_BUILD_MPI_PROFILING=1 diff --git a/ompi/mpi/tool/event_callback_get_info.c b/ompi/mpi/tool/event_callback_get_info.c new file mode 100644 index 00000000000..92519a13aac --- /dev/null +++ b/ompi/mpi/tool/event_callback_get_info.c @@ -0,0 +1,38 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. + * Copyright (c) 2019-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + + +#include "ompi_config.h" +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_callback_get_info = PMPI_T_event_callback_get_info +#endif +#define MPI_T_event_callback_get_info PMPI_T_event_callback_get_info +#endif + + +int MPI_T_event_callback_get_info (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info *info_used) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} + diff --git a/ompi/mpi/tool/event_callback_set_info.c b/ompi/mpi/tool/event_callback_set_info.c new file mode 100644 index 00000000000..5f78d2c92de --- /dev/null +++ b/ompi/mpi/tool/event_callback_set_info.c @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. + * Copyright (c) 2019-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_callback_set_info = PMPI_T_event_callback_set_info +#endif +#define MPI_T_event_callback_set_info PMPI_T_event_callback_set_info +#endif + +int MPI_T_event_callback_set_info (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_copy.c b/ompi/mpi/tool/event_copy.c new file mode 100644 index 00000000000..f0c64bad822 --- /dev/null +++ b/ompi/mpi/tool/event_copy.c @@ -0,0 +1,35 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_copy = PMPI_T_event_copy +#endif +#define MPI_T_event_copy PMPI_T_event_copy +#endif + + +int MPI_T_event_copy (MPI_T_event_instance event, void *buffer) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_get_index.c b/ompi/mpi/tool/event_get_index.c new file mode 100644 index 00000000000..0c0ec50cf39 --- /dev/null +++ b/ompi/mpi/tool/event_get_index.c @@ -0,0 +1,37 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_get_index = PMPI_T_event_get_index +#endif +#define MPI_T_event_get_index PMPI_T_event_get_index +#endif + +int MPI_T_event_get_index (const char *name, int *event_index) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + if (MPI_PARAM_CHECK && (NULL == event_index || NULL == name)) { + return MPI_ERR_ARG; + } + + return MPI_T_ERR_INVALID_NAME; +} diff --git a/ompi/mpi/tool/event_get_info.c b/ompi/mpi/tool/event_get_info.c new file mode 100644 index 00000000000..f7fd9134379 --- /dev/null +++ b/ompi/mpi/tool/event_get_info.c @@ -0,0 +1,38 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_get_info = PMPI_T_event_get_info +#endif +#define MPI_T_event_get_info PMPI_T_event_get_info +#endif + +int MPI_T_event_get_info (int event_index, char *name, int *name_len, + int *verbosity, MPI_Datatype *array_of_datatypes, + MPI_Aint *array_of_displacements, int *num_elements, + MPI_T_enum *enumtype, MPI_Info *info, + char *desc, int *desc_len, int *bind) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_INDEX; +} diff --git a/ompi/mpi/tool/event_get_num.c b/ompi/mpi/tool/event_get_num.c new file mode 100644 index 00000000000..0b27caa60fc --- /dev/null +++ b/ompi/mpi/tool/event_get_num.c @@ -0,0 +1,38 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_get_num = PMPI_T_event_get_num +#endif +#define MPI_T_event_get_num PMPI_T_event_get_num +#endif + +int MPI_T_event_get_num (int *num_event) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + if (MPI_PARAM_CHECK && NULL == num_event) { + return MPI_ERR_ARG; + } + + *num_event = 0; + return MPI_SUCCESS; +} diff --git a/ompi/mpi/tool/event_get_source.c b/ompi/mpi/tool/event_get_source.c new file mode 100644 index 00000000000..7ec12af587e --- /dev/null +++ b/ompi/mpi/tool/event_get_source.c @@ -0,0 +1,34 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_get_source = PMPI_T_event_get_source +#endif +#define MPI_T_event_get_source PMPI_T_event_get_source +#endif + +int MPI_T_event_get_source (MPI_T_event_instance event, int *source_index) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_get_timestamp.c b/ompi/mpi/tool/event_get_timestamp.c new file mode 100644 index 00000000000..34fd49d5075 --- /dev/null +++ b/ompi/mpi/tool/event_get_timestamp.c @@ -0,0 +1,34 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_get_timestamp = PMPI_T_event_get_timestamp +#endif +#define MPI_T_event_get_timestamp PMPI_T_event_get_timestamp +#endif + +int MPI_T_event_get_timestamp (MPI_T_event_instance event, MPI_Count *event_time) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_handle_alloc.c b/ompi/mpi/tool/event_handle_alloc.c new file mode 100644 index 00000000000..0768cf2f879 --- /dev/null +++ b/ompi/mpi/tool/event_handle_alloc.c @@ -0,0 +1,35 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_handle_alloc = PMPI_T_event_handle_alloc +#endif +#define MPI_T_event_handle_alloc PMPI_T_event_handle_alloc +#endif + +int MPI_T_event_handle_alloc (int event_index, void *obj_handle, MPI_Info info, + MPI_T_event_registration *event_registration) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_INDEX; +} diff --git a/ompi/mpi/tool/event_handle_free.c b/ompi/mpi/tool/event_handle_free.c new file mode 100644 index 00000000000..7fb756b3938 --- /dev/null +++ b/ompi/mpi/tool/event_handle_free.c @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_handle_free = PMPI_T_event_handle_free +#endif +#define MPI_T_event_handle_free PMPI_T_event_handle_free +#endif + +int MPI_T_event_handle_free (MPI_T_event_registration event_registration, + void *user_data, + MPI_T_event_free_cb_function free_cb_function) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_handle_get_info.c b/ompi/mpi/tool/event_handle_get_info.c new file mode 100644 index 00000000000..2009d67b1ef --- /dev/null +++ b/ompi/mpi/tool/event_handle_get_info.c @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. + * Copyright (c) 2019-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_handle_get_info = PMPI_T_event_handle_get_info +#endif +#define MPI_T_event_handle_get_info PMPI_T_event_handle_get_info +#endif + +int MPI_T_event_handle_get_info (MPI_T_event_registration event_registration, + MPI_Info *info_used) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_handle_set_info.c b/ompi/mpi/tool/event_handle_set_info.c new file mode 100644 index 00000000000..0c35e27d2a1 --- /dev/null +++ b/ompi/mpi/tool/event_handle_set_info.c @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2019 Google, LLC. All rights reserved. + * Copyright (c) 2019-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_handle_set_info = PMPI_T_event_handle_set_info +#endif +#define MPI_T_event_handle_set_info PMPI_T_event_handle_set_info +#endif + +int MPI_T_event_handle_set_info (MPI_T_event_registration event_registration, + MPI_Info info) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_read.c b/ompi/mpi/tool/event_read.c new file mode 100644 index 00000000000..e16d3e33f50 --- /dev/null +++ b/ompi/mpi/tool/event_read.c @@ -0,0 +1,34 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_read = PMPI_T_event_read +#endif +#define MPI_T_event_read PMPI_T_event_read +#endif + +int MPI_T_event_read (MPI_T_event_instance event, int element_index, void *buffer) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_register_callback.c b/ompi/mpi/tool/event_register_callback.c new file mode 100644 index 00000000000..4550fabe520 --- /dev/null +++ b/ompi/mpi/tool/event_register_callback.c @@ -0,0 +1,36 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2018-2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_register_callback = PMPI_T_event_register_callback +#endif +#define MPI_T_event_register_callback PMPI_T_event_register_callback +#endif + +int MPI_T_event_register_callback (MPI_T_event_registration event_registration, + MPI_T_cb_safety cb_safety, MPI_Info info, void *user_data, + MPI_T_event_cb_function event_cb_function) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/event_set_dropped_handler.c b/ompi/mpi/tool/event_set_dropped_handler.c new file mode 100644 index 00000000000..fe15695abb8 --- /dev/null +++ b/ompi/mpi/tool/event_set_dropped_handler.c @@ -0,0 +1,35 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2017 IBM Corporation. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_event_set_dropped_handler = PMPI_T_event_set_dropped_handler +#endif +#define MPI_T_event_set_dropped_handler PMPI_T_event_set_dropped_handler +#endif + +int MPI_T_event_set_dropped_handler (MPI_T_event_registration handle, MPI_T_event_dropped_cb_function dropped_cb_function) + +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_HANDLE; +} diff --git a/ompi/mpi/tool/source_get_info.c b/ompi/mpi/tool/source_get_info.c new file mode 100644 index 00000000000..94017246fa2 --- /dev/null +++ b/ompi/mpi/tool/source_get_info.c @@ -0,0 +1,34 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_source_get_info = PMPI_T_source_get_info +#endif +#define MPI_T_source_get_info PMPI_T_source_get_info +#endif + +int MPI_T_source_get_info (int source_index, char *name, int *name_len, char *desc, int *desc_len, MPI_T_source_order *ordering, + MPI_Count *ticks_per_second, MPI_Count *max_timestamp, MPI_Info *info) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + return MPI_T_ERR_INVALID_INDEX; +} diff --git a/ompi/mpi/tool/source_get_num.c b/ompi/mpi/tool/source_get_num.c new file mode 100644 index 00000000000..6b31862ff27 --- /dev/null +++ b/ompi/mpi/tool/source_get_num.c @@ -0,0 +1,38 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_source_get_num = PMPI_T_source_get_num +#endif +#define MPI_T_source_get_num PMPI_T_source_get_num +#endif + +int MPI_T_source_get_num (int *num_source) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + if (MPI_PARAM_CHECK && NULL == num_source) { + return MPI_ERR_ARG; + } + + *num_source = 0; + return MPI_SUCCESS; +} diff --git a/ompi/mpi/tool/source_get_timestamp.c b/ompi/mpi/tool/source_get_timestamp.c new file mode 100644 index 00000000000..02a4303d286 --- /dev/null +++ b/ompi/mpi/tool/source_get_timestamp.c @@ -0,0 +1,37 @@ +/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */ +/* + * Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights + * reserved. + * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2025 Triad National Security, LLC. All rights + * reserved. + * $COPYRIGHT$ + * + * Additional copyrights may follow + * + * $HEADER$ + */ + +#include "ompi_config.h" + +#include "ompi/mpi/tool/mpit-internal.h" + +#if OMPI_BUILD_MPI_PROFILING +#if OPAL_HAVE_WEAK_SYMBOLS +#pragma weak MPI_T_source_get_timestamp = PMPI_T_source_get_timestamp +#endif +#define MPI_T_source_get_timestamp PMPI_T_source_get_timestamp +#endif + +int MPI_T_source_get_timestamp (int source_index, MPI_Count *timestamp) +{ + if (!mpit_is_initialized ()) { + return MPI_T_ERR_NOT_INITIALIZED; + } + + if (MPI_PARAM_CHECK && !timestamp) { + return MPI_ERR_ARG; + } + + return MPI_T_ERR_INVALID_INDEX; +} From d0037fcff954825e5697d31b72748e13fe07e16d Mon Sep 17 00:00:00 2001 From: Howard Pritchard Date: Thu, 27 Feb 2025 11:19:48 -0700 Subject: [PATCH 2/2] MPI_T events: man pages Signed-off-by: Howard Pritchard --- docs/man-openmpi/man3/MPI_T.3.rst | 45 ++++++++++++++++++ docs/man-openmpi/man3/MPI_T_ERRORS.rst | 7 +++ .../man3/MPI_T_event_callback_get_info.3.rst | 12 ++--- .../man3/MPI_T_event_callback_set_info.3.rst | 10 +--- docs/man-openmpi/man3/MPI_T_event_copy.3.rst | 7 +-- .../man3/MPI_T_event_get_info.3.rst | 4 +- .../man3/MPI_T_event_get_source.3.rst | 2 +- .../man3/MPI_T_event_get_timestamp.3.rst | 6 +-- .../man3/MPI_T_event_handle_alloc.3.rst | 26 +++++----- .../man3/MPI_T_event_handle_free.3.rst | 47 +++++++++++++++++-- docs/man-openmpi/man3/MPI_T_event_read.3.rst | 9 +--- .../man3/MPI_T_event_register_callback.3.rst | 4 +- .../MPI_T_event_set_dropped_handler.3.rst | 10 ++-- .../man3/MPI_T_source_get_info.3.rst | 4 +- 14 files changed, 128 insertions(+), 65 deletions(-) create mode 100644 docs/man-openmpi/man3/MPI_T_ERRORS.rst diff --git a/docs/man-openmpi/man3/MPI_T.3.rst b/docs/man-openmpi/man3/MPI_T.3.rst index 0f21fe4a5d9..889519bddb6 100644 --- a/docs/man-openmpi/man3/MPI_T.3.rst +++ b/docs/man-openmpi/man3/MPI_T.3.rst @@ -123,4 +123,49 @@ Open MPI's MPI_T categories are organized hierarchically: .. seealso:: + * :ref:`MPI_T_category_changed` + * :ref:`MPI_T_category_get_categories` + * :ref:`MPI_T_category_get_cvars` + * :ref:`MPI_T_category_get_info` + * :ref:`MPI_T_category_get_num` + * :ref:`MPI_T_category_get_pvars` + * :ref:`MPI_T_cvar_get_info` + * :ref:`MPI_T_cvar_get_num` + * :ref:`MPI_T_cvar_handle_alloc` + * :ref:`MPI_T_cvar_handle_free` + * :ref:`MPI_T_cvar_read` + * :ref:`MPI_T_cvar_write` + * :ref:`MPI_T_enum_get_info` + * :ref:`MPI_T_enum_get_item` + * :ref:`MPI_T_event_callback_get_info` + * :ref:`MPI_T_event_callback_set_info` + * :ref:`MPI_T_event_copy` + * :ref:`MPI_T_event_get_index` + * :ref:`MPI_T_event_get_info` + * :ref:`MPI_T_event_get_num` + * :ref:`MPI_T_event_get_source` + * :ref:`MPI_T_event_get_timestamp` + * :ref:`MPI_T_event_handle_alloc` + * :ref:`MPI_T_event_handle_free` + * :ref:`MPI_T_event_handle_get_info` + * :ref:`MPI_T_event_handle_set_info` + * :ref:`MPI_T_event_read` + * :ref:`MPI_T_event_register_callback` + * :ref:`MPI_T_event_set_dropped_handler` + * :ref:`MPI_T_finalize` * :ref:`MPI_T_init_thread` + * :ref:`MPI_T_pvar_get_info` + * :ref:`MPI_T_pvar_get_num` + * :ref:`MPI_T_pvar_handle_alloc` + * :ref:`MPI_T_pvar_handle_free` + * :ref:`MPI_T_pvar_read` + * :ref:`MPI_T_pvar_readreset` + * :ref:`MPI_T_pvar_reset` + * :ref:`MPI_T_pvar_session_create` + * :ref:`MPI_T_pvar_session_free` + * :ref:`MPI_T_pvar_start` + * :ref:`MPI_T_pvar_stop` + * :ref:`MPI_T_pvar_write` + * :ref:`MPI_T_source_get_info` + * :ref:`MPI_T_source_get_num` + * :ref:`MPI_T_source_get_timestamp` diff --git a/docs/man-openmpi/man3/MPI_T_ERRORS.rst b/docs/man-openmpi/man3/MPI_T_ERRORS.rst new file mode 100644 index 00000000000..dd3860ffdeb --- /dev/null +++ b/docs/man-openmpi/man3/MPI_T_ERRORS.rst @@ -0,0 +1,7 @@ +* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface is not initialized. + +* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid. + +* ``MPI_T_ERR_INVALID_HANDLE``: Invalid use of the interface or bad parameter values(s). + +* ``MPI_T_ERR_OTHER``: Other error diff --git a/docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst index 24b922ca879..b52353f16a5 100644 --- a/docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_callback_get_info.3.rst @@ -37,8 +37,8 @@ DESCRIPTION ----------- :ref:`MPI_T_event_callback_get_info` returns a new info object containing the -hints of the callback function registered for the callback safety level specified by `cb_safety` of -the event-registration handle associated with `event_registration`. +hints of the callback function registered for the callback safety level specified by ``cb_safety`` of +the event-registration handle associated with ``event_registration``. ERRORS @@ -46,10 +46,4 @@ ERRORS :ref:`MPI_T_event_callback_get_info` will fail if: -* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized - -* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid - -* ``MPI_T_ERR_INVALID_HANDLE``: Invalid use of the interface or bad parameter values(s). - -* ``MPI_T_ERR_OTHER``: Other error +.. include:: ./MPI_T_ERRORS.rst diff --git a/docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst index 4f62d7aabc8..d048d1f59ae 100644 --- a/docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_callback_set_info.3.rst @@ -32,7 +32,7 @@ INPUT PARAMETERS DESCRIPTION ----------- -:ref:`MPI_T_event_callback_set_info` Updates the hints of the callback function registered for the callback safety level specified by `cb_safety` of the event-registration handle associated with event_registration. +:ref:`MPI_T_event_callback_set_info` Updates the hints of the callback function registered for the callback safety level specified by ``cb_safety`` of the event-registration handle associated with event_registration. ERRORS @@ -40,10 +40,4 @@ ERRORS :ref:`MPI_T_event_callback_set_info` will fail if: -* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized - -* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid - -* ``MPI_T_ERR_INVALID_HANDLE``: Invalid use of the interface or bad parameter values(s). - -* ``MPI_T_ERR_OTHER``: Other error +.. include:: ./MPI_T_ERRORS.rst diff --git a/docs/man-openmpi/man3/MPI_T_event_copy.3.rst b/docs/man-openmpi/man3/MPI_T_event_copy.3.rst index 7e83a652509..1b8f276f290 100644 --- a/docs/man-openmpi/man3/MPI_T_event_copy.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_copy.3.rst @@ -41,12 +41,7 @@ ERRORS :ref:`MPI_T_event_copy` will fail if: -* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized - -* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid - -* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s). - +.. include:: ./MPI_T_ERRORS.rst .. seealso:: * :ref:`MPI_T_event_read` diff --git a/docs/man-openmpi/man3/MPI_T_event_get_info.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_info.3.rst index d48ce779c08..7f031cff170 100644 --- a/docs/man-openmpi/man3/MPI_T_event_get_info.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_get_info.3.rst @@ -40,12 +40,12 @@ OUTPUT PARAMETERS ----------------- * ``name``: Buffer to return the string containing the name of the event type. * ``verbosity``: Verbosity level of this event type -* ``array_of_datatypes``: Array of mpi basic datatypes used to encode the event data +* ``array_of_datatypes``: Array of MPI basic datatypes used to encode the event data * ``array_of_displacements``: Array of byte displacements of the elements in the event buffer * ``enumtype``: Optional descriptor for enumeration information * ``info``: Optional info argument. * ``desc``: Buffer to return the string containing the description of the event type. -* ``bind``: Type of mpi object to which an event of this type must be bound +* ``bind``: Type of MPI object to which an event of this type must be bound DESCRIPTION ----------- diff --git a/docs/man-openmpi/man3/MPI_T_event_get_source.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_source.3.rst index e3f00158dcb..18ab6808cbb 100644 --- a/docs/man-openmpi/man3/MPI_T_event_get_source.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_get_source.3.rst @@ -34,7 +34,7 @@ OUTPUT PARAMETERS DESCRIPTION ----------- -:ref:`MPI_T_event_get_source` returns the index of the source of `event_instance`. +:ref:`MPI_T_event_get_source` returns the index of the source of ``event_instance``. ERRORS ------ diff --git a/docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst b/docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst index 6f0fd157c15..b10cf5674a8 100644 --- a/docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_get_timestamp.3.rst @@ -43,8 +43,4 @@ ERRORS :ref:`MPI_T_event_get_timestamp` will fail if: -* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized - -* ``MPI_T_ERR_INVALID_INDEX``: The handle is invalid - -* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s) +.. include:: ./MPI_T_ERRORS.rst diff --git a/docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst b/docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst index b5ca3239414..ed92683ce51 100644 --- a/docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_handle_alloc.3.rst @@ -6,8 +6,7 @@ MPI_T_event_handle_alloc .. include_body -:ref:`MPI_T_event_handle_alloc`, :ref:`MPI_T_event_handle_free` - Allocate/free -event handles +:ref:`MPI_T_event_handle_alloc` - Allocate event handles SYNTAX @@ -21,11 +20,19 @@ C Syntax #include - int MPI_T_event_handle_alloc(int event_index, void *obj_handle, + int MPI_T_event_handle_alloc(int event_index, void *obj_handle, MPI info, MPI_T_event_registration *event_registration) - int MPI_T_event_handle_free(MPI_T_event_registration event_registration, - void *user_data, MPI_T_event_free_cb_function free_cb_function) +INPUT PARAMETERS +---------------- +* ``event_index``: Index of event type for which the registration handle is to be allocated. +* ``obj_handle``: reference to a handle of the MPI object to which this event is supposed to be bound. +* ``info``: Info object. + +OUTPUT PARAMETERS +----------------- +* ``event_registration``: Event registration. + DESCRIPTION ----------- @@ -35,19 +42,12 @@ DESCRIPTION :ref:`MPI_T_event_get_info` returns MPI_T_BIND_NO_OBJECT as the binding of the variable the *obj_handle* argument is ignored. -:ref:`MPI_T_event_handle_free` frees a handle allocated by -:ref:`MPI_T_event_handle_alloc`. - ERRORS ------ :ref:`MPI_T_event_handle_alloc` will fail if: -* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized - -* ``MPI_T_ERR_INVALID_INDEX``: The supplied event index is invalid - -* ``MPI_T_ERR_INVALID``: The supplied input parameter is invalid +.. include:: ./MPI_T_ERRORS.rst .. seealso:: * :ref:`MPI_T_event_get_info` diff --git a/docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst b/docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst index 65b6253280d..ef104139a85 100644 --- a/docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_handle_free.3.rst @@ -1,9 +1,50 @@ .. _mpi_t_event_handle_free: + MPI_T_event_handle_free ======================= - .. include_body -.. include:: ../man3/MPI_T_event_handle_alloc.3.rst - :start-after: .. include_body +.. include_body + +:ref:`MPI_T_event_handle_free` - Free event handles + + +SYNTAX +------ + + +C Syntax +^^^^^^^^ + +.. code-block:: c + + #include + + int MPI_T_event_handle_free(MPI_T_event_registration event_registration, + void *user_data, MPI_T_event_free_cb_function free_cb_function) + +INPUT PARAMETERS +---------------- +* ``user_data``: Pointer to a user-controlled buffer. +* ``free_cb_function``: Pointer to user-defined callback function. + +INPUT/OUTPUT PARAMETERS +----------------------- +* ``event_registration``: Event registration. + + +DESCRIPTION +----------- + +:ref:`MPI_T_event_handle_free` frees a handle allocated by +:ref:`MPI_T_event_handle_alloc`. + +ERRORS +------ + +:ref:`MPI_T_event_handle_free` will fail if: + +.. include:: ./MPI_T_ERRORS.rst +.. seealso:: + * :ref:`MPI_T_event_get_info` diff --git a/docs/man-openmpi/man3/MPI_T_event_read.3.rst b/docs/man-openmpi/man3/MPI_T_event_read.3.rst index fe49ef91000..4c3ea3c1f90 100644 --- a/docs/man-openmpi/man3/MPI_T_event_read.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_read.3.rst @@ -27,7 +27,7 @@ INPUT PARAMETERS ---------------- * ``event_instance``: event-instance handle provided to the callback function. * ``elem_index``: index into the array of datatypes of the item to be queried. -* ``buf``: pointer to a memory location to store the item data +* ``buffer``: pointer to a memory location to store the item data DESCRIPTION ----------- @@ -40,12 +40,7 @@ ERRORS :ref:`MPI_T_event_read` will fail if: -* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized - -* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid - -* ``MPI_T_ERR_INVALID``: Invalid use of the interface or bad parameter values(s). - +.. include:: ./MPI_T_ERRORS.rst .. seealso:: * :ref:`MPI_T_event_copy` diff --git a/docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst b/docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst index 9fa006a1941..ad1c1ac48a3 100644 --- a/docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_register_callback.3.rst @@ -37,8 +37,8 @@ DESCRIPTION ----------- :ref:`MPI_T_event_register_callback` associates a user-defined function pointed to -by `event_cb_function` with an allocated event-registration handle. The maximum callback -safety level supported by the callback function is passed in the argument `cb_safety`. +by ``event_cb_function`` with an allocated event-registration handle. The maximum callback +safety level supported by the callback function is passed in the argument ``cb_safety``. ERRORS diff --git a/docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst b/docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst index fed7787676c..d79c4f00ffe 100644 --- a/docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst +++ b/docs/man-openmpi/man3/MPI_T_event_set_dropped_handler.3.rst @@ -33,8 +33,8 @@ DESCRIPTION ----------- :ref:`MPI_T_event_set_dropped_handler` registers the function -`dropped_cb_function` to be called by the MPI implementation when event information is -dropped for the registration handle specified in `event_registration`. +``dropped_cb_function`` to be called by the MPI implementation when event information is +dropped for the registration handle specified in ``event_registration``. ERRORS @@ -42,8 +42,4 @@ ERRORS :ref:`MPI_T_event_set_dropped_handler` will fail if: -* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized - -* ``MPI_T_ERR_INVALID_HANDLE``: The handle is invalid - -* ``MPI_T_ERR_OTHER``: Other error +.. include:: ./MPI_T_ERRORS.rst diff --git a/docs/man-openmpi/man3/MPI_T_source_get_info.3.rst b/docs/man-openmpi/man3/MPI_T_source_get_info.3.rst index fc29032ad91..2858c6cbc71 100644 --- a/docs/man-openmpi/man3/MPI_T_source_get_info.3.rst +++ b/docs/man-openmpi/man3/MPI_T_source_get_info.3.rst @@ -21,8 +21,8 @@ C Syntax #include int MPI_T_source_get_info(int source_index, char *name, int *name_len, - char *desc, int *desc_len, MPI_T_source_order *ordering, - MPI_Count *ticks_per_second, MPI_Count *max_ticks, MPI_Info *info) + char *desc, int *desc_len, MPI_T_source_order *ordering, + MPI_Count *ticks_per_second, MPI_Count *max_ticks, MPI_Info *info) INPUT PARAMETERS