Skip to content

Commit 5cc1dc3

Browse files
committed
communicator bugfix: disjoint function does not have the correct max_local_peers value
local_peers is passed in the non-blocking function iallreduce_fn as a stack variable. Change it to be part of the context struct so the correct value is passed. Signed-off-by: Jessie Yang <[email protected]>
1 parent c89ea33 commit 5cc1dc3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ompi/communicator/comm_cid.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ struct ompi_comm_cid_context_t {
9999
int iter;
100100
/** storage for activate barrier */
101101
int max_local_peers;
102+
int local_peers;
102103
char *port_string;
103104
bool send_first;
104105
int pml_tag;
@@ -267,6 +268,7 @@ static ompi_comm_cid_context_t *mca_comm_cid_context_alloc (ompi_communicator_t
267268
context->send_first = send_first;
268269
context->iter = 0;
269270
context->max_local_peers = ompi_group_count_local_peers(newcomm->c_local_group);
271+
context->local_peers = context->max_local_peers;
270272

271273
return context;
272274
}
@@ -870,7 +872,7 @@ int ompi_comm_activate_nb (ompi_communicator_t **newcomm, ompi_communicator_t *c
870872
ompi_comm_cid_context_t *context;
871873
ompi_comm_request_t *request;
872874
ompi_request_t *subreq;
873-
int ret = 0, local_peers = -1;
875+
int ret = 0;
874876

875877
/* the caller should not pass NULL for comm (it may be the same as *newcomm) */
876878
assert (NULL != comm);
@@ -907,9 +909,8 @@ int ompi_comm_activate_nb (ompi_communicator_t **newcomm, ompi_communicator_t *c
907909
* 1. The communicator's disjointness is inferred from max_local_peers.
908910
* 2. After the operation it is allowed to send messages over the new communicator.
909911
*/
910-
local_peers = context->max_local_peers;
911-
ret = context->iallreduce_fn (&local_peers, &context->max_local_peers, 1, MPI_MAX, context,
912-
&subreq);
912+
ret = context->iallreduce_fn (&context->local_peers, &context->max_local_peers, 1, MPI_MAX, context,
913+
&subreq);
913914
if (OMPI_SUCCESS != ret) {
914915
ompi_comm_request_return (request);
915916
return ret;

0 commit comments

Comments
 (0)