Skip to content

Commit c4405ad

Browse files
committed
Use OMPI's profiling convention in MPI tools
The mpi/tool/*.c files had a different system for handling profiling (both renaming functions and setting weak symbols) than the rest of the MPI codebase. This patch changes them to follow the convention used elsewhere. Also, make sure ompi_config.h is the first header included in the .c file, per OMPI's coding convention. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent 699d45e commit c4405ad

32 files changed

+216
-218
lines changed

ompi/mpi/tool/category_changed.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,26 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
8+
* reserved.
79
* $COPYRIGHT$
810
*
911
* Additional copyrights may follow
1012
*
1113
* $HEADER$
1214
*/
1315

16+
#include "ompi_config.h"
17+
1418
#include "ompi/mpi/tool/mpit-internal.h"
1519

16-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
20+
#if OMPI_BUILD_MPI_PROFILING
21+
#if OPAL_HAVE_WEAK_SYMBOLS
1722
#pragma weak MPI_T_category_changed = PMPI_T_category_changed
1823
#endif
19-
20-
#if OMPI_PROFILING_DEFINES
21-
#include "ompi/mpi/tool/profile/defines.h"
24+
#define MPI_T_category_changed PMPI_T_category_changed
2225
#endif
2326

24-
2527
int MPI_T_category_changed(int *stamp)
2628
{
2729
if (!mpit_is_initialized ()) {

ompi/mpi/tool/category_get_categories.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_category_get_categories = PMPI_T_category_get_categories
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_category_get_categories PMPI_T_category_get_categories
2528
#endif
2629

27-
2830
int MPI_T_category_get_categories(int cat_index, int len, int indices[])
2931
{
3032
const mca_base_var_group_t *group;

ompi/mpi/tool/category_get_cvars.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_category_get_cvars = PMPI_T_category_get_cvars
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_category_get_cvars PMPI_T_category_get_cvars
2528
#endif
2629

27-
2830
int MPI_T_category_get_cvars(int cat_index, int len, int indices[])
2931
{
3032
const mca_base_var_group_t *group;

ompi/mpi/tool/category_get_index.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10-
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1112
* $COPYRIGHT$
1213
*
1314
* Additional copyrights may follow
1415
*
1516
* $HEADER$
1617
*/
1718

19+
#include "ompi_config.h"
20+
1821
#include "ompi/mpi/tool/mpit-internal.h"
1922

20-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2125
#pragma weak MPI_T_category_get_index = PMPI_T_category_get_index
2226
#endif
23-
24-
#if OMPI_PROFILING_DEFINES
25-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_category_get_index PMPI_T_category_get_index
2628
#endif
2729

28-
2930
int MPI_T_category_get_index (const char *name, int *category_index)
3031
{
3132
int ret;

ompi/mpi/tool/category_get_info.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_category_get_info = PMPI_T_category_get_info
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_category_get_info PMPI_T_category_get_info
2528
#endif
2629

27-
2830
int MPI_T_category_get_info(int cat_index, char *name, int *name_len,
2931
char *desc, int *desc_len, int *num_cvars,
3032
int *num_pvars, int *num_categories)

ompi/mpi/tool/category_get_num.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_category_get_num = PMPI_T_category_get_num
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_category_get_num PMPI_T_category_get_num
2528
#endif
2629

27-
2830
int MPI_T_category_get_num (int *num_cat)
2931
{
3032
if (!mpit_is_initialized ()) {

ompi/mpi/tool/category_get_pvars.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_category_get_pvars = PMPI_T_category_get_pvars
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_category_get_pvars PMPI_T_category_get_pvars
2528
#endif
2629

27-
2830
int MPI_T_category_get_pvars(int cat_index, int len, int indices[])
2931
{
3032
const mca_base_var_group_t *group;

ompi/mpi/tool/cvar_get_index.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_cvar_get_index = PMPI_T_cvar_get_index
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_cvar_get_index PMPI_T_cvar_get_index
2528
#endif
2629

27-
2830
int MPI_T_cvar_get_index (const char *name, int *cvar_index)
2931
{
3032
int ret;

ompi/mpi/tool/cvar_get_info.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_cvar_get_info = PMPI_T_cvar_get_info
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_cvar_get_info PMPI_T_cvar_get_info
2528
#endif
2629

27-
2830
int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosity,
2931
MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc,
3032
int *desc_len, int *bind, int *scope)

ompi/mpi/tool/cvar_get_num.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,26 @@
77
* Copyright (c) 2020 The University of Tennessee and The University
88
* of Tennessee Research Foundation. All rights
99
* reserved.
10+
* Copyright (c) 2021 Amazon.com, Inc. or its affiliates. All Rights
11+
* reserved.
1012
* $COPYRIGHT$
1113
*
1214
* Additional copyrights may follow
1315
*
1416
* $HEADER$
1517
*/
1618

19+
#include "ompi_config.h"
20+
1721
#include "ompi/mpi/tool/mpit-internal.h"
1822

19-
#if OPAL_HAVE_WEAK_SYMBOLS && OMPI_PROFILING_DEFINES
23+
#if OMPI_BUILD_MPI_PROFILING
24+
#if OPAL_HAVE_WEAK_SYMBOLS
2025
#pragma weak MPI_T_cvar_get_num = PMPI_T_cvar_get_num
2126
#endif
22-
23-
#if OMPI_PROFILING_DEFINES
24-
#include "ompi/mpi/tool/profile/defines.h"
27+
#define MPI_T_cvar_get_num PMPI_T_cvar_get_num
2528
#endif
2629

27-
2830
int MPI_T_cvar_get_num (int *num_cvar) {
2931
if (!mpit_is_initialized ()) {
3032
return MPI_T_ERR_NOT_INITIALIZED;

0 commit comments

Comments
 (0)