Skip to content

Commit f6fe1d4

Browse files
authored
Merge pull request #13197 from hppritcha/oops_missing_event_functions
2 parents 08ac1be + 59e4e4e commit f6fe1d4

8 files changed

+193
-1
lines changed

docs/Makefile.am

+2
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,10 @@ OMPI_MAN3 = \
432432
MPI_T_category_changed.3 \
433433
MPI_T_category_get_categories.3 \
434434
MPI_T_category_get_cvars.3 \
435+
MPI_T_category_get_events.3 \
435436
MPI_T_category_get_info.3 \
436437
MPI_T_category_get_num.3 \
438+
MPI_T_category_get_num_events.3 \
437439
MPI_T_category_get_pvars.3 \
438440
MPI_T_cvar_get_info.3 \
439441
MPI_T_cvar_get_num.3 \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
.. _mpi_t_category_get_events:
2+
3+
4+
MPI_T_category_get_events
5+
=========================
6+
7+
.. include_body
8+
9+
:ref:`MPI_T_category_get_events` |mdash| Query which events are in a
10+
category
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_T_category_get_events(int cat_index, int len, int indices[])
25+
26+
27+
INPUT PARAMETERS
28+
----------------
29+
* ``cat_index``: Index of the category to be queried.
30+
* ``len``: The length of the indices array.
31+
32+
OUTPUT PARAMETERS
33+
-----------------
34+
* ``indices``: An integer array of size len, indicating event indices.
35+
36+
DESCRIPTION
37+
-----------
38+
39+
:ref:`MPI_T_category_get_events` can be used to query which events
40+
are contained in a particular category.
41+
42+
43+
ERRORS
44+
------
45+
46+
:ref:`MPI_T_category_get_events` will fail if:
47+
48+
* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized
49+
50+
* ``MPI_T_ERR_INVALID_INDEX``: The category index is invalid
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
.. _mpi_t_category_get_num_events:
2+
3+
4+
MPI_T_category_get_num_events
5+
=============================
6+
7+
.. include_body
8+
9+
:ref:`MPI_T_category_get_num_events` |mdash| Query returns the number of event types contained
10+
in the queried category.
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_T_category_get_num_events(int cat_index, int *num_events)
25+
26+
27+
INPUT PARAMETERS
28+
----------------
29+
* ``cat_index``: Index of the category to be queried
30+
31+
OUTPUT PARAMETERS
32+
-----------------
33+
* ``num_events``: Number of event types in the category
34+
35+
DESCRIPTION
36+
-----------
37+
38+
:ref:`MPI_T_category_get_num_events` can be used to query the number of events
39+
contained in the category.
40+
41+
42+
ERRORS
43+
------
44+
45+
:ref:`MPI_T_category_get_num_events` will fail if:
46+
47+
* ``MPI_T_ERR_NOT_INITIALIZED``: The MPI Tools interface not initialized

docs/man-openmpi/man3/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,10 @@ MPI API manual pages (section 3)
357357
MPI_T_category_changed.3.rst
358358
MPI_T_category_get_categories.3.rst
359359
MPI_T_category_get_cvars.3.rst
360+
MPI_T_category_get_events.3.rst
360361
MPI_T_category_get_info.3.rst
361362
MPI_T_category_get_num.3.rst
363+
MPI_T_category_get_num_events.3.rst
362364
MPI_T_category_get_pvars.3.rst
363365
MPI_T_cvar_get_info.3.rst
364366
MPI_T_cvar_get_num.3.rst

ompi/include/mpi.h.in

+4
Original file line numberDiff line numberDiff line change
@@ -3760,11 +3760,13 @@ OMPI_DECLSPEC int PMPI_T_cvar_handle_free (MPI_T_cvar_handle *handle);
37603760
OMPI_DECLSPEC int PMPI_T_cvar_read (MPI_T_cvar_handle handle, void *buf);
37613761
OMPI_DECLSPEC int PMPI_T_cvar_write (MPI_T_cvar_handle handle, const void *buf);
37623762
OMPI_DECLSPEC int PMPI_T_category_get_num(int *num_cat);
3763+
OMPI_DECLSPEC int PMPI_T_category_get_num_events (int cat_index, int *num_events);
37633764
OMPI_DECLSPEC int PMPI_T_category_get_info(int cat_index, char *name, int *name_len,
37643765
char *desc, int *desc_len, int *num_cvars,
37653766
int *num_pvars, int *num_categories);
37663767
OMPI_DECLSPEC int PMPI_T_category_get_index (const char *name, int *category_index);
37673768
OMPI_DECLSPEC int PMPI_T_category_get_cvars(int cat_index, int len, int indices[]);
3769+
OMPI_DECLSPEC int PMPI_T_category_get_events(int cat_index, int len, int indices[]);
37683770
OMPI_DECLSPEC int PMPI_T_category_get_pvars(int cat_index, int len, int indices[]);
37693771
OMPI_DECLSPEC int PMPI_T_category_get_categories(int cat_index, int len, int indices[]);
37703772
OMPI_DECLSPEC int PMPI_T_category_changed(int *stamp);
@@ -3845,11 +3847,13 @@ OMPI_DECLSPEC int MPI_T_cvar_handle_free (MPI_T_cvar_handle *handle);
38453847
OMPI_DECLSPEC int MPI_T_cvar_read (MPI_T_cvar_handle handle, void *buf);
38463848
OMPI_DECLSPEC int MPI_T_cvar_write (MPI_T_cvar_handle handle, const void *buf);
38473849
OMPI_DECLSPEC int MPI_T_category_get_num(int *num_cat);
3850+
OMPI_DECLSPEC int MPI_T_category_get_num_events (int cat_index, int *num_events);
38483851
OMPI_DECLSPEC int MPI_T_category_get_info(int cat_index, char *name, int *name_len,
38493852
char *desc, int *desc_len, int *num_cvars,
38503853
int *num_pvars, int *num_categories);
38513854
OMPI_DECLSPEC int MPI_T_category_get_index (const char *name, int *category_index);
38523855
OMPI_DECLSPEC int MPI_T_category_get_cvars(int cat_index, int len, int indices[]);
3856+
OMPI_DECLSPEC int MPI_T_category_get_events(int cat_index, int len, int indices[]);
38533857
OMPI_DECLSPEC int MPI_T_category_get_pvars(int cat_index, int len, int indices[]);
38543858
OMPI_DECLSPEC int MPI_T_category_get_categories(int cat_index, int len, int indices[]);
38553859
OMPI_DECLSPEC int MPI_T_category_changed(int *stamp);

ompi/mpi/tool/Makefile.am

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# University of Stuttgart. All rights reserved.
77
# Copyright (c) 2012-2018 Los Alamos National Security, LLC. All rights
88
# reserved.
9-
# Copyright (c) 2018-2025 Triad National Security, LLC. All rightsa
9+
# Copyright (c) 2018-2025 Triad National Security, LLC. All rights
1010
# reserved.
1111
# Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
1212
# reserved.
@@ -54,9 +54,11 @@ interface_profile_sources = \
5454
category_changed.c \
5555
category_get_categories.c \
5656
category_get_cvars.c \
57+
category_get_events.c \
5758
category_get_info.c \
5859
category_get_index.c \
5960
category_get_num.c \
61+
category_get_num_events.c \
6062
category_get_pvars.c \
6163
cvar_get_info.c \
6264
cvar_get_index.c \

ompi/mpi/tool/category_get_events.c

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
4+
* reserved.
5+
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
6+
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
12+
* Copyright (c) 2025 Triad National Security, LLC. All rights
13+
* reserved.
14+
* $COPYRIGHT$
15+
*
16+
* Additional copyrights may follow
17+
*
18+
* $HEADER$
19+
*/
20+
21+
#include "ompi_config.h"
22+
23+
#include "ompi/mpi/tool/mpit-internal.h"
24+
25+
#if OMPI_BUILD_MPI_PROFILING
26+
#if OPAL_HAVE_WEAK_SYMBOLS
27+
#pragma weak MPI_T_category_get_events = PMPI_T_category_get_events
28+
#endif
29+
#define MPI_T_category_get_events PMPI_T_category_get_events
30+
#endif
31+
32+
int MPI_T_category_get_events(int cat_index, int len, int indices[])
33+
{
34+
int rc = MPI_SUCCESS;
35+
36+
if (!mpit_is_initialized ()) {
37+
return MPI_T_ERR_NOT_INITIALIZED;
38+
}
39+
return rc;
40+
}
+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2+
/*
3+
* Copyright (c) 2012-2013 Los Alamos National Security, LLC. All rights
4+
* reserved.
5+
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
6+
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
12+
* Copyright (c) 2025 Triad National Security, LLC. All rights
13+
* reserved.
14+
* $COPYRIGHT$
15+
*
16+
* Additional copyrights may follow
17+
*
18+
* $HEADER$
19+
*/
20+
21+
#include "ompi_config.h"
22+
23+
#include "ompi/mpi/tool/mpit-internal.h"
24+
25+
#if OMPI_BUILD_MPI_PROFILING
26+
#if OPAL_HAVE_WEAK_SYMBOLS
27+
#pragma weak MPI_T_category_get_num_events = PMPI_T_category_get_num_events
28+
#endif
29+
#define MPI_T_category_get_num_events PMPI_T_category_get_num_events
30+
#endif
31+
32+
int MPI_T_category_get_num_events (int cat_index, int *num_events)
33+
{
34+
if (!mpit_is_initialized ()) {
35+
return MPI_T_ERR_NOT_INITIALIZED;
36+
}
37+
38+
if (MPI_PARAM_CHECK && NULL == num_events) {
39+
return MPI_T_ERR_INVALID;
40+
}
41+
42+
*num_events = 0;
43+
44+
return MPI_SUCCESS;
45+
}

0 commit comments

Comments
 (0)