Skip to content

Commit f4a5d25

Browse files
committed
OMPI: set "in finalize" indicator in finalize flow
1 parent 033c597 commit f4a5d25

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

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)