Skip to content

Commit b1658fb

Browse files
committed
Merge pull request open-mpi#636 from miked-mellanox/topic/v2.x_finalize_flag_and_fca_use_it
v2.x - Add in-finalize indicator, fca fall back to prev barrier if in-finalize
2 parents d9b5806 + 5e6f624 commit b1658fb

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

ompi/mca/coll/fca/coll_fca_ops.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ int mca_coll_fca_barrier(struct ompi_communicator_t *comm,
153153
int ret;
154154

155155
FCA_VERBOSE(5,"Using FCA Barrier");
156+
if (OPAL_UNLIKELY(ompi_mpi_finalize_started)) {
157+
FCA_VERBOSE(5, "In finalize, reverting to previous barrier");
158+
goto orig_barrier;
159+
}
156160
ret = fca_do_barrier(fca_module->fca_comm);
157161
if (ret < 0) {
158162
if (ret == -EUSEMPI) {

ompi/runtime/mpiruntime.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ OMPI_DECLSPEC extern bool ompi_mpi_initialized;
5555
OMPI_DECLSPEC extern bool ompi_mpi_finalized;
5656
/** Has the RTE been initialized? */
5757
OMPI_DECLSPEC extern bool ompi_rte_initialized;
58+
/** Did mpi start to finalize? */
59+
OMPI_DECLSPEC extern int32_t ompi_mpi_finalize_started;
5860

5961
/** Do we have multiple threads? */
6062
OMPI_DECLSPEC extern bool ompi_mpi_thread_multiple;

ompi/runtime/ompi_mpi_finalize.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ extern bool ompi_enable_timing_ext;
9393
int ompi_mpi_finalize(void)
9494
{
9595
int ret;
96-
static int32_t finalize_has_already_started = 0;
9796
opal_list_item_t *item;
9897
ompi_proc_t** procs;
9998
size_t nprocs;
@@ -106,7 +105,7 @@ int ompi_mpi_finalize(void)
106105
ompi_comm_free() (or run into other nasty lions, tigers, or
107106
bears) */
108107

109-
if (! opal_atomic_cmpset_32(&finalize_has_already_started, 0, 1)) {
108+
if (! opal_atomic_cmpset_32(&ompi_mpi_finalize_started, 0, 1)) {
110109
/* Note that if we're already finalized, we cannot raise an
111110
MPI exception. The best that we can do is write something
112111
to stderr. */

ompi/runtime/ompi_mpi_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ bool ompi_mpi_init_started = false;
128128
bool ompi_mpi_initialized = false;
129129
bool ompi_mpi_finalized = false;
130130
bool ompi_rte_initialized = false;
131+
int32_t ompi_mpi_finalize_started = false;
131132

132133
bool ompi_mpi_thread_multiple = false;
133134
int ompi_mpi_thread_requested = MPI_THREAD_SINGLE;

0 commit comments

Comments
 (0)