Skip to content

Commit b47a64f

Browse files
committed
Merge pull request #1188 from artpol84/intercomm_split_fix
Yet one more fix to intercommunicator splitting logic.
2 parents dae3746 + 7690f40 commit b47a64f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

ompi/communicator/comm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
148148
local_size = ompi_group_size (local_group);
149149
}
150150

151-
if (NULL != remote_group) {
151+
if ( (NULL != remote_group) && (&ompi_mpi_group_null.group != remote_group) ) {
152152
remote_size = ompi_group_size (remote_group);
153153
}
154154

@@ -177,10 +177,10 @@ int ompi_comm_set_nb ( ompi_communicator_t **ncomm,
177177
newcomm->c_my_rank = newcomm->c_local_group->grp_my_rank;
178178

179179
/* Set remote group and duplicate the local comm, if applicable */
180-
if (0 < remote_size) {
180+
if ( NULL != remote_group ) {
181181
ompi_communicator_t *old_localcomm;
182182

183-
if (NULL == remote_group) {
183+
if (&ompi_mpi_group_null.group == remote_group) {
184184
ret = ompi_group_incl(oldcomm->c_remote_group, remote_size,
185185
remote_ranks, &newcomm->c_remote_group);
186186
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
@@ -432,7 +432,7 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
432432
int rc=OMPI_SUCCESS;
433433
ompi_communicator_t *newcomp = NULL;
434434
int *lranks=NULL, *rranks=NULL;
435-
ompi_group_t * local_group=NULL;
435+
ompi_group_t * local_group=NULL, *remote_group=NULL;
436436

437437
ompi_comm_allgatherfct *allgatherfct=NULL;
438438

@@ -508,6 +508,7 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
508508
/* Step 2: determine all the information for the remote group */
509509
/* --------------------------------------------------------- */
510510
if ( inter ) {
511+
remote_group = &ompi_mpi_group_null.group;
511512
rsize = comm->c_remote_group->grp_proc_count;
512513
rresults = (int *) malloc ( rsize * 2 * sizeof(int));
513514
if ( NULL == rresults ) {
@@ -591,7 +592,7 @@ int ompi_comm_split( ompi_communicator_t* comm, int color, int key,
591592
comm->error_handler,/* error handler */
592593
pass_on_topo,
593594
local_group, /* local group */
594-
NULL); /* remote group */
595+
remote_group); /* remote group */
595596

596597
if ( NULL == newcomp ) {
597598
rc = MPI_ERR_INTERN;

0 commit comments

Comments
 (0)