Skip to content

Commit c296dad

Browse files
authored
Merge pull request #7525 from rhc54/topic/fence
Correct fence logic in MPI_Init
2 parents 7c31586 + dd623ce commit c296dad

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

ompi/runtime/ompi_mpi_init.c

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -679,38 +679,39 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided,
679679
#endif
680680

681681
if (!ompi_singleton) {
682-
/* If we have a non-blocking fence:
683-
* if we are doing an async modex, but we are collecting all
684-
* data, then execute the non-blocking modex in the background.
685-
* All calls to modex_recv will be cached until the background
686-
* modex completes. If collect_all_data is false, then we skip
687-
* the fence completely and retrieve data on-demand from the
688-
* source node.
689-
*
690-
* If we do not have a non-blocking fence, then we must always
691-
* execute the blocking fence as the system does not support
692-
* later data retrieval. */
693682
if (opal_pmix_base_async_modex) {
694-
/* execute the fence_nb in the background to collect
695-
* the data */
696-
background_fence = true;
697-
active = true;
698-
OPAL_POST_OBJECT(&active);
699-
PMIX_INFO_LOAD(&info[0], PMIX_COLLECT_DATA, &opal_pmix_collect_all_data, PMIX_BOOL);
700-
if( PMIX_SUCCESS != (rc = PMIx_Fence_nb(NULL, 0, NULL, 0,
701-
fence_release,
702-
(void*)&active))) {
703-
ret = opal_pmix_convert_status(rc);
704-
error = "PMIx_Fence_nb() failed";
705-
goto error;
683+
/* if we are doing an async modex, but we are collecting all
684+
* data, then execute the non-blocking modex in the background.
685+
* All calls to modex_recv will be cached until the background
686+
* modex completes. If collect_all_data is false, then we skip
687+
* the fence completely and retrieve data on-demand from the
688+
* source node.
689+
*/
690+
if (opal_pmix_collect_all_data) {
691+
/* execute the fence_nb in the background to collect
692+
* the data */
693+
background_fence = true;
694+
active = true;
695+
OPAL_POST_OBJECT(&active);
696+
PMIX_INFO_LOAD(&info[0], PMIX_COLLECT_DATA, &opal_pmix_collect_all_data, PMIX_BOOL);
697+
if( PMIX_SUCCESS != (rc = PMIx_Fence_nb(NULL, 0, NULL, 0,
698+
fence_release,
699+
(void*)&active))) {
700+
ret = opal_pmix_convert_status(rc);
701+
error = "PMIx_Fence_nb() failed";
702+
goto error;
703+
}
706704
}
707-
708-
} else if (!opal_pmix_base_async_modex) {
709-
/* we want to do the modex */
705+
} else {
706+
/* we want to do the modex - we block at this point, but we must
707+
* do so in a manner that allows us to call opal_progress so our
708+
* event library can be cycled as we have tied PMIx to that
709+
* event base */
710710
active = true;
711711
OPAL_POST_OBJECT(&active);
712712
PMIX_INFO_LOAD(&info[0], PMIX_COLLECT_DATA, &opal_pmix_collect_all_data, PMIX_BOOL);
713-
if( PMIX_SUCCESS != (rc = PMIx_Fence_nb(NULL, 0, info, 1, fence_release, (void*)&active))) {
713+
rc = PMIx_Fence_nb(NULL, 0, info, 1, fence_release, (void*)&active);
714+
if( PMIX_SUCCESS != rc) {
714715
ret = opal_pmix_convert_status(rc);
715716
error = "PMIx_Fence() failed";
716717
goto error;

0 commit comments

Comments
 (0)