Skip to content

Commit 6e9cce0

Browse files
committed
comm: temporary replacement code for determine_low_group
We will in the coming commits exchange world information upon dynamic processes making connections. After that, we will be able to determin_low_group just using lpids. For now, perform an additional sendrecv to exchange the world namespace. The commit will be reverted with the future commits.
1 parent 0335202 commit 6e9cce0

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/mpi/comm/comm_impl.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,7 @@ int MPIR_Comm_set_info_impl(MPIR_Comm * comm_ptr, MPIR_Info * info_ptr)
949949
goto fn_exit;
950950
}
951951

952+
#if 0
952953
/* arbitrarily determine which group is the low_group by comparing
953954
* world namespaces and world ranks */
954955
static int determine_low_group(MPIR_Lpid remote_lpid, bool * is_low_group_out)
@@ -978,6 +979,7 @@ static int determine_low_group(MPIR_Lpid remote_lpid, bool * is_low_group_out)
978979

979980
return mpi_errno;
980981
}
982+
#endif
981983

982984
int MPIR_Intercomm_create_impl(MPIR_Comm * local_comm_ptr, int local_leader,
983985
MPIR_Comm * peer_comm_ptr, int remote_leader, int tag,
@@ -1015,8 +1017,34 @@ int MPIR_Intercomm_create_impl(MPIR_Comm * local_comm_ptr, int local_leader,
10151017
MPIR_ERR_CHECK(mpi_errno);
10161018

10171019
bool is_low_group;
1020+
#if 0
10181021
mpi_errno = determine_low_group(remote_lpids[0], &is_low_group);
10191022
MPIR_ERR_CHECK(mpi_errno);
1023+
#else
1024+
if (local_comm_ptr->rank == local_leader) {
1025+
if (MPIR_LPID_WORLD_INDEX(remote_lpids[0]) == 0) {
1026+
is_low_group = (MPIR_Process.rank < MPIR_LPID_WORLD_RANK(remote_lpids[0]));
1027+
} else {
1028+
char remote_namespace[MPIR_NAMESPACE_MAX];
1029+
mpi_errno = MPIC_Sendrecv(MPIR_Worlds[0].namespace, MPIR_NAMESPACE_MAX,
1030+
MPIR_CHAR_INTERNAL, remote_leader, tag,
1031+
remote_namespace, MPIR_NAMESPACE_MAX, MPIR_CHAR_INTERNAL,
1032+
remote_leader, tag, peer_comm_ptr, MPI_STATUS_IGNORE,
1033+
MPIR_ERR_NONE);
1034+
MPIR_ERR_CHECK(mpi_errno);
1035+
int cmp_result;
1036+
cmp_result = strncmp(MPIR_Worlds[0].namespace, remote_namespace, MPIR_NAMESPACE_MAX);
1037+
MPIR_Assert(cmp_result != 0);
1038+
if (cmp_result < 0)
1039+
is_low_group = false;
1040+
else
1041+
is_low_group = true;
1042+
}
1043+
}
1044+
mpi_errno = MPIR_Bcast_impl(&is_low_group, 1, MPIR_C_BOOL_INTERNAL,
1045+
local_leader, local_comm_ptr, MPIR_ERR_NONE);
1046+
MPIR_ERR_CHECK(mpi_errno);
1047+
#endif
10201048

10211049
/* At last, we now have the information that we need to build the
10221050
* intercommunicator */

0 commit comments

Comments
 (0)