Skip to content

Commit 6fc034b

Browse files
committed
misc: use the new group rank/lpid conversion routines
For most external usages, we only need MPIR_Group_rank_to_lpid.
1 parent 066ed81 commit 6fc034b

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

src/mpi/comm/comm_impl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ int MPII_Comm_create_calculate_mapping(MPIR_Group * group_ptr,
224224
subsetOfWorld = 1;
225225
wsize = MPIR_Process.size;
226226
for (i = 0; i < n; i++) {
227-
uint64_t g_lpid = group_ptr->lrank_to_lpid[i].lpid;
227+
MPIR_Lpid g_lpid = MPIR_Group_rank_to_lpid(group_ptr, i);
228228

229229
/* This mapping is relative to comm world */
230230
MPL_DBG_MSG_FMT(MPIR_DBG_COMM, VERBOSE,
@@ -261,7 +261,7 @@ int MPII_Comm_create_calculate_mapping(MPIR_Group * group_ptr,
261261
for (j = 0; j < comm_ptr->local_size; j++) {
262262
uint64_t comm_lpid;
263263
MPID_Comm_get_lpid(comm_ptr, j, &comm_lpid, FALSE);
264-
if (comm_lpid == group_ptr->lrank_to_lpid[i].lpid) {
264+
if (comm_lpid == MPIR_Group_rank_to_lpid(group_ptr, i)) {
265265
mapping[i] = j;
266266
break;
267267
}
@@ -795,7 +795,7 @@ int MPIR_Intercomm_create_from_groups_impl(MPIR_Group * local_group_ptr, int loc
795795

796796
int tag = get_tag_from_stringtag(stringtag);
797797
/* FIXME: ensure lpid is from comm_world */
798-
uint64_t remote_lpid = remote_group_ptr->lrank_to_lpid[remote_leader].lpid;
798+
MPIR_Lpid remote_lpid = MPIR_Group_rank_to_lpid(remote_group_ptr, remote_leader);
799799
MPIR_Assert(remote_lpid < MPIR_Process.size);
800800
mpi_errno = MPIR_Intercomm_create_impl(local_comm, local_leader,
801801
MPIR_Process.comm_world, (int) remote_lpid,

src/mpid/ch3/src/ch3u_comm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ static int nonempty_intersection(MPIR_Comm *comm, MPIR_Group *group, int *flag)
512512

513513
for (i_g = 0; i_g < group->size; ++i_g) {
514514
/* FIXME: This won't work for dynamic procs */
515-
MPIDI_PG_Get_vc(MPIDI_Process.my_pg, group->lrank_to_lpid[i_g].lpid, &vc_g);
515+
MPIDI_PG_Get_vc(MPIDI_Process.my_pg, MPIR_Group_rank_to_lpid(group, i_g), &vc_g);
516516
for (i_c = 0; i_c < comm->remote_size; ++i_c) {
517517
MPIDI_Comm_get_vc(comm, i_c, &vc_c);
518518
if (vc_g == vc_c) {

src/mpid/ch3/src/ch3u_handle_connection.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ static int terminate_failed_VCs(MPIR_Group *new_failed_group)
372372
MPIDI_VC_t *vc;
373373
/* terminate the VC */
374374
/* FIXME: This won't work for dynamic procs */
375-
MPIDI_PG_Get_vc(MPIDI_Process.my_pg, new_failed_group->lrank_to_lpid[i].lpid, &vc);
375+
MPIDI_PG_Get_vc(MPIDI_Process.my_pg, MPIR_Group_rank_to_lpid(new_failed_group, i), &vc);
376376
mpi_errno = MPIDI_CH3_Connection_terminate(vc);
377377
MPIR_ERR_CHECK(mpi_errno);
378378
}

src/mpid/ch4/src/ch4_impl.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,10 @@ MPL_STATIC_INLINE_PREFIX int MPIDIU_valid_group_rank(MPIR_Comm * comm, int rank,
387387

388388
MPIDI_NM_comm_get_gpid(comm, rank, &gpid, FALSE);
389389

390-
for (z = 0; z < size && gpid != grp->lrank_to_lpid[z].lpid; ++z) {
390+
for (z = 0; z < size; ++z) {
391+
if (gpid == MPIR_Group_rank_to_lpid(grp, z)) {
392+
break;
393+
}
391394
}
392395

393396
ret = (z < size);

0 commit comments

Comments
 (0)