Skip to content

Commit 89c09f1

Browse files
authored
Merge pull request #9758 from jsquyres/pr/fix-mpi-calls
ompi/util/timings.h: use back-end OMPI calls
2 parents 14def94 + 0db92e6 commit 89c09f1

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

ompi/runtime/ompi_mpi_init.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* University of Stuttgart. All rights reserved.
1111
* Copyright (c) 2004-2005 The Regents of the University of California.
1212
* All rights reserved.
13-
* Copyright (c) 2006-2018 Cisco Systems, Inc. All rights reserved
13+
* Copyright (c) 2006-2022 Cisco Systems, Inc. All rights reserved
1414
* Copyright (c) 2006-2015 Los Alamos National Security, LLC. All rights
1515
* reserved.
1616
* Copyright (c) 2006-2009 University of Houston. All rights reserved.
@@ -728,7 +728,7 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
728728
if (OMPI_TIMING_ENABLED && !opal_pmix_base_async_modex &&
729729
opal_pmix_collect_all_data && !ompi_singleton) {
730730
if (PMIX_SUCCESS != (rc = PMIx_Fence(NULL, 0, NULL, 0))) {
731-
ret - opal_pmix_convert_status(rc);
731+
ret = opal_pmix_convert_status(rc);
732732
error = "timing: pmix-barrier-1 failed";
733733
goto error;
734734
}

ompi/util/timings.h

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*
22
* Copyright (c) 2017-2018 Mellanox Technologies Ltd. All rights reserved.
33
* Copyright (c) 2017 Intel, Inc. All rights reserved.
4+
* Copyright (c) 2021-2022 Cisco Systems, Inc. All rights reserved
45
* $COPYRIGHT$
56
*
67
* Additional copyrights may follow
@@ -12,7 +13,6 @@
1213
#define OMPI_UTIL_TIMING_H
1314

1415
#include "opal/util/timings.h"
15-
/* TODO: we need access to MPI_* functions */
1616

1717
#if (OPAL_ENABLE_TIMING)
1818

@@ -166,16 +166,17 @@ typedef struct ompi_timing_t {
166166
#define OMPI_TIMING_OUT \
167167
do { \
168168
if (OMPI_TIMING.enabled) { \
169-
int i, size, rank; \
170-
MPI_Comm_size(MPI_COMM_WORLD, &size); \
171-
MPI_Comm_rank(MPI_COMM_WORLD, &rank); \
172-
int error = 0; \
169+
int i; \
170+
int size = ompi_comm_size(MPI_COMM_WORLD); \
171+
int rank = ompi_comm_rank(MPI_COMM_WORLD); \
172+
int timing_error = 0; \
173173
int imported = 0; \
174174
\
175-
MPI_Reduce(&OMPI_TIMING.error, &error, 1, \
176-
MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD); \
175+
MPI_COMM_WORLD->c_coll->coll_reduce(&OMPI_TIMING.error, &timing_error, 1, \
176+
MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD, \
177+
MPI_COMM_WORLD->c_coll->coll_reduce_module); \
177178
\
178-
if (error) { \
179+
if (timing_error) { \
179180
if (0 == rank) { \
180181
printf("==OMPI_TIMING== error: something went wrong, timings doesn't work\n"); \
181182
} \
@@ -196,12 +197,15 @@ typedef struct ompi_timing_t {
196197
do { \
197198
int use; \
198199
for (use = 0; use < timing->use; use++) { \
199-
MPI_Reduce(&timing->val[use].ts, avg + i, 1, \
200-
MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); \
201-
MPI_Reduce(&timing->val[use].ts, min + i, 1, \
202-
MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD); \
203-
MPI_Reduce(&timing->val[use].ts, max + i, 1, \
204-
MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); \
200+
MPI_COMM_WORLD->c_coll->coll_reduce(&timing->val[use].ts, avg + i, 1, \
201+
MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD, \
202+
MPI_COMM_WORLD->c_coll->coll_reduce_module); \
203+
MPI_COMM_WORLD->c_coll->coll_reduce(&timing->val[use].ts, min + i, 1, \
204+
MPI_DOUBLE, MPI_MIN, 0, MPI_COMM_WORLD, \
205+
MPI_COMM_WORLD->c_coll->coll_reduce_module); \
206+
MPI_COMM_WORLD->c_coll->coll_reduce(&timing->val[use].ts, max + i, 1, \
207+
MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD, \
208+
MPI_COMM_WORLD->c_coll->coll_reduce_module); \
205209
desc[i] = timing->val[use].desc; \
206210
prefix[i] = timing->val[use].prefix; \
207211
file[i] = timing->val[use].file; \

0 commit comments

Comments
 (0)