Skip to content

Commit 0335202

Browse files
committed
ADI: remove MPID_Comm_get_lpid
This is fully replaced with MPIR_comm_rank_to_lpid or MPIR_Group_rank_to_lpid.
1 parent 4b4239b commit 0335202

File tree

7 files changed

+10
-57
lines changed

7 files changed

+10
-57
lines changed

src/mpi/coll/algorithms/treealgo/treeutil.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,10 @@ static int MPII_Treeutil_hierarchy_populate(MPIR_Comm * comm, int rank, int nran
504504
MPIR_Assert(upper_level != NULL);
505505

506506
/* Get wrank from the communicator as the coords are stored with wrank */
507-
MPIR_Lpid temp = 0;
508-
MPID_Comm_get_lpid(comm, r, &temp, FALSE);
509-
int wrank = (int) temp;
510-
if (wrank < 0)
507+
MPIR_Lpid temp = MPIR_comm_rank_to_lpid(comm, r);
508+
int world_idx = MPIR_LPID_WORLD_INDEX(temp);
509+
int wrank = MPIR_LPID_WORLD_RANK(temp);
510+
if (world_idx != 0)
511511
goto fn_fail;
512512
MPIR_Assert(0 <= wrank && wrank < MPIR_Process.size);
513513

src/mpi/comm/comm_impl.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ static int comm_create_local_group(MPIR_Comm * comm_ptr)
7373
MPIR_Lpid *map = MPL_malloc(n * sizeof(MPIR_Lpid), MPL_MEM_GROUP);
7474

7575
for (int i = 0; i < n; i++) {
76-
mpi_errno = MPID_Comm_get_lpid(comm_ptr, i, &map[i], FALSE);
77-
MPIR_ERR_CHECK(mpi_errno);
76+
map[i] = MPIR_Group_rank_to_lpid(comm_ptr->local_group, i);
7877
}
7978

8079
mpi_errno = MPIR_Group_create_map(n, comm_ptr->rank, comm_ptr->session_ptr, map,
@@ -238,8 +237,7 @@ int MPII_Comm_create_calculate_mapping(MPIR_Group * group_ptr,
238237
/* FIXME : BUBBLE SORT */
239238
mapping[i] = -1;
240239
for (j = 0; j < comm_ptr->local_size; j++) {
241-
MPIR_Lpid comm_lpid;
242-
MPID_Comm_get_lpid(comm_ptr, j, &comm_lpid, FALSE);
240+
MPIR_Lpid comm_lpid = MPIR_Group_rank_to_lpid(comm_ptr->local_group, j);
243241
if (comm_lpid == MPIR_Group_rank_to_lpid(group_ptr, i)) {
244242
mapping[i] = j;
245243
break;
@@ -918,8 +916,7 @@ int MPIR_Comm_remote_group_impl(MPIR_Comm * comm_ptr, MPIR_Group ** group_ptr)
918916
MPIR_Lpid *map = MPL_malloc(n * sizeof(MPIR_Lpid), MPL_MEM_GROUP);
919917

920918
for (int i = 0; i < n; i++) {
921-
mpi_errno = MPID_Comm_get_lpid(comm_ptr, i, &map[i], TRUE);
922-
MPIR_ERR_CHECK(mpi_errno);
919+
map[i] = MPIR_Group_rank_to_lpid(comm_ptr->remote_group, i);
923920
}
924921
mpi_errno = MPIR_Group_create_map(n, MPI_UNDEFINED, comm_ptr->session_ptr, map,
925922
&comm_ptr->remote_group);

src/mpid/ch3/include/mpidpost.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ int MPID_Intercomm_exchange(MPIR_Comm *local_comm_ptr, int local_leader,
192192
int *remote_size, MPIR_Lpid **remote_lpids);
193193
int MPID_Create_intercomm_from_lpids( MPIR_Comm *newcomm_ptr,
194194
int size, const MPIR_Lpid lpids[] );
195-
int MPID_Comm_get_lpid(MPIR_Comm *comm_ptr, int idx, MPIR_Lpid *lpid_ptr, bool is_remote);
196195

197196
/* ULFM support */
198197
MPL_STATIC_INLINE_PREFIX int MPID_Comm_AS_enabled(MPIR_Comm * comm_ptr)

src/mpid/ch3/src/mpid_vc.c

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -222,25 +222,6 @@ int MPIDI_VCR_Dup(MPIDI_VCR orig_vcr, MPIDI_VCR * new_vcr)
222222
return MPI_SUCCESS;
223223
}
224224

225-
/*@
226-
MPID_Comm_get_lpid - Get the local process ID for a given VC reference
227-
@*/
228-
int MPID_Comm_get_lpid(MPIR_Comm *comm_ptr, int idx, MPIR_Lpid *lpid_ptr, bool is_remote)
229-
{
230-
231-
MPIR_FUNC_ENTER;
232-
233-
if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM)
234-
*lpid_ptr = comm_ptr->dev.vcrt->vcr_table[idx]->lpid;
235-
else if (is_remote)
236-
*lpid_ptr = comm_ptr->dev.vcrt->vcr_table[idx]->lpid;
237-
else
238-
*lpid_ptr = comm_ptr->dev.local_vcrt->vcr_table[idx]->lpid;
239-
240-
MPIR_FUNC_EXIT;
241-
return MPI_SUCCESS;
242-
}
243-
244225
/*
245226
* The following routines convert to/from the global pids, which are
246227
* represented as pairs of ints (process group id, rank in that process group)
@@ -363,13 +344,10 @@ int MPIDI_GPID_ToLpidArray( int size, MPIDI_Gpid in_gpid[], MPIR_Lpid lpid[] )
363344
static inline int MPIDI_LPID_GetAllInComm(MPIR_Comm *comm_ptr, int local_size,
364345
MPIR_Lpid local_lpids[])
365346
{
366-
int i;
367347
int mpi_errno = MPI_SUCCESS;
368348
MPIR_Assert( comm_ptr->local_size == local_size );
369-
for (i=0; i<comm_ptr->local_size; i++) {
370-
MPIR_Lpid tmp_lpid;
371-
mpi_errno |= MPID_Comm_get_lpid( comm_ptr, i, &tmp_lpid, FALSE );
372-
local_lpids[i] = tmp_lpid;
349+
for (int i=0; i<comm_ptr->local_size; i++) {
350+
local_lpids[i] = comm_ptr->dev.vcrt->vcr_table[i]->lpid;
373351
}
374352
return mpi_errno;
375353
}

src/mpid/ch4/include/mpidch4.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ int MPID_Comm_get_all_failed_procs(MPIR_Comm *, MPIR_Group **, int);
2626
int MPID_Comm_revoke(MPIR_Comm *, int);
2727
int MPID_Comm_failure_ack(MPIR_Comm *);
2828
MPL_STATIC_INLINE_PREFIX int MPID_Comm_AS_enabled(MPIR_Comm *) MPL_STATIC_INLINE_SUFFIX;
29-
int MPID_Comm_get_lpid(MPIR_Comm *, int, MPIR_Lpid *, bool);
3029
int MPID_CS_finalize(void);
3130
int MPID_Finalize(void);
3231
int MPID_Get_universe_size(int *);

src/mpid/ch4/src/ch4_impl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ MPL_STATIC_INLINE_PREFIX int MPIDIU_valid_group_rank(MPIR_Comm * comm, int rank,
389389

390390
MPIR_FUNC_ENTER;
391391

392-
MPID_Comm_get_lpid(comm, rank, &lpid, FALSE);
392+
lpid = MPIR_comm_rank_to_lpid(comm, rank);
393393

394394
for (z = 0; z < size; ++z) {
395395
if (lpid == MPIR_Group_rank_to_lpid(grp, z)) {

src/mpid/ch4/src/ch4_init.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -984,26 +984,6 @@ int MPID_Free_mem(void *user_buf)
984984
goto fn_exit;
985985
}
986986

987-
int MPID_Comm_get_lpid(MPIR_Comm * comm_ptr, int idx, MPIR_Lpid * lpid_ptr, bool is_remote)
988-
{
989-
int mpi_errno = MPI_SUCCESS;
990-
int avtid = 0, lpid = 0;
991-
MPIR_FUNC_ENTER;
992-
993-
if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM)
994-
MPIDIU_comm_rank_to_pid(comm_ptr, idx, &lpid, &avtid);
995-
else if (is_remote)
996-
MPIDIU_comm_rank_to_pid(comm_ptr, idx, &lpid, &avtid);
997-
else {
998-
MPIDIU_comm_rank_to_pid_local(comm_ptr, idx, &lpid, &avtid);
999-
}
1000-
1001-
*lpid_ptr = MPIDIU_GPID_CREATE(avtid, lpid);
1002-
1003-
MPIR_FUNC_EXIT;
1004-
return mpi_errno;
1005-
}
1006-
1007987
int MPID_Get_node_id(MPIR_Comm * comm, int rank, int *id_p)
1008988
{
1009989
int mpi_errno = MPI_SUCCESS;

0 commit comments

Comments
 (0)