Skip to content

Commit 76b91ce

Browse files
authored
Merge pull request #11688 from bosilca/topic/fix_split_type_for_intercomm
Topic/fix split type for intercomm
2 parents 980bed2 + 74de336 commit 76b91ce

File tree

2 files changed

+21
-10
lines changed

2 files changed

+21
-10
lines changed

ompi/communicator/comm.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,16 @@ int ompi_comm_set_nb (ompi_communicator_t **ncomm, ompi_communicator_t *oldcomm,
241241
newcomm->c_assertions = 0;
242242

243243
/* Set remote group and duplicate the local comm, if applicable */
244+
if ((NULL == remote_group) && (NULL != remote_ranks)) {
245+
/* determine how the list of local_rank can be stored most
246+
efficiently */
247+
ret = ompi_group_incl(oldcomm->c_remote_group, remote_size,
248+
remote_ranks, &newcomm->c_remote_group);
249+
if (OPAL_UNLIKELY(OMPI_SUCCESS != ret)) {
250+
return ret;
251+
}
252+
remote_group = newcomm->c_remote_group;
253+
}
244254
if ( NULL != remote_group ) {
245255
ompi_communicator_t *old_localcomm;
246256

ompi/mca/coll/inter/coll_inter_allreduce.c

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
4848
mca_coll_base_module_t *module)
4949
{
5050
int err, rank, root = 0;
51-
char *tmpbuf = NULL, *pml_buffer = NULL;
51+
char *tmpbuf = NULL, *pml_buffer = NULL, *source;
5252
ptrdiff_t gap, span;
5353

5454
rank = ompi_comm_rank(comm);
@@ -58,20 +58,21 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
5858

5959
tmpbuf = (char *) malloc(span);
6060
if (NULL == tmpbuf) {
61-
return OMPI_ERR_OUT_OF_RESOURCE;
61+
return OMPI_ERR_OUT_OF_RESOURCE;
6262
}
6363
pml_buffer = tmpbuf - gap;
64+
source = (MPI_IN_PLACE == sbuf) ? rbuf : sbuf;
6465

65-
err = comm->c_local_comm->c_coll->coll_reduce(sbuf, pml_buffer, count,
66-
dtype, op, root,
67-
comm->c_local_comm,
68-
comm->c_local_comm->c_coll->coll_reduce_module);
66+
err = comm->c_local_comm->c_coll->coll_reduce(source, pml_buffer, count,
67+
dtype, op, root,
68+
comm->c_local_comm,
69+
comm->c_local_comm->c_coll->coll_reduce_module);
6970
if (OMPI_SUCCESS != err) {
70-
goto exit;
71+
goto exit;
7172
}
7273

7374
if (rank == root) {
74-
/* Do a send-recv between the two root procs. to avoid deadlock */
75+
/* Do a send-recv between the two root procs. to avoid deadlock */
7576
err = ompi_coll_base_sendrecv_actual(pml_buffer, count, dtype, 0,
7677
MCA_COLL_BASE_TAG_ALLREDUCE,
7778
rbuf, count, dtype, 0,
@@ -84,8 +85,8 @@ mca_coll_inter_allreduce_inter(const void *sbuf, void *rbuf, int count,
8485

8586
/* bcast the message to all the local processes */
8687
err = comm->c_local_comm->c_coll->coll_bcast(rbuf, count, dtype,
87-
root, comm->c_local_comm,
88-
comm->c_local_comm->c_coll->coll_bcast_module);
88+
root, comm->c_local_comm,
89+
comm->c_local_comm->c_coll->coll_bcast_module);
8990
if (OMPI_SUCCESS != err) {
9091
goto exit;
9192
}

0 commit comments

Comments
 (0)