Skip to content

Commit

Permalink
to be squashed: move wait-for-init loop to ompi_mpi_init()
Browse files Browse the repository at this point in the history
(Note: this commit would have been squashed with the prior commit, but
#5092 was accidentally merged
before the 2 commits were squashed together)

Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
(cherry picked from commit 9b9cb5f)
  • Loading branch information
jsquyres committed Jun 7, 2018
1 parent ed4e5a2 commit 9eea1c4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
6 changes: 5 additions & 1 deletion ompi/runtime/ompi_mpi_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,12 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
} else if (expected >= OMPI_MPI_STATE_INIT_STARTED) {
// In some cases (e.g., oshmem_shmem_init()), we may call
// ompi_mpi_init() multiple times. In such cases, just
// silently return successfully.
// silently return successfully once the initializing
// thread has completed.
if (reinit_ok) {
while (ompi_mpi_state < OMPI_MPI_STATE_INIT_COMPLETED) {
usleep(1);
}
return MPI_SUCCESS;
}

Expand Down
7 changes: 0 additions & 7 deletions oshmem/runtime/oshmem_shmem_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,6 @@ int oshmem_shmem_init(int argc, char **argv, int requested, int *provided)
if (!oshmem_shmem_initialized) {
ret = ompi_mpi_init(argc, argv, requested, provided, true);

// It's posible that another thread is initializing MPI and
// has not completed yet. Keep checking until it is
// completed.
while (ompi_mpi_state < OMPI_MPI_STATE_INIT_COMPLETED) {
usleep(1);
}

if (OSHMEM_SUCCESS != ret) {
return ret;
}
Expand Down

0 comments on commit 9eea1c4

Please sign in to comment.