Skip to content

Commit fed0a7f

Browse files
committed
group: refactor MPIR_Group
* add option to use stride to describe group composition * remove the linked list design
1 parent a834f5f commit fed0a7f

File tree

3 files changed

+103
-228
lines changed

3 files changed

+103
-228
lines changed

src/include/mpir_group.h

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,6 @@
1212
* MPI_Group_intersection) and for the scalable RMA synchronization
1313
*---------------------------------------------------------------------------*/
1414

15-
/* Abstract the integer type for lpid (process id). It is possible to use 32-bit
16-
* in principle, but 64-bit is simpler since we can trivially combine
17-
* (world_idx, world_rank).
18-
*/
19-
typedef uint64_t MPIR_Lpid;
20-
21-
/* This structure is used to implement the group operations such as
22-
MPI_Group_translate_ranks */
23-
/* note: next_lpid (with idx_of_first_lpid in MPIR_Group) gives a linked list
24-
* in a sorted lpid ascending order */
25-
typedef struct MPII_Group_pmap_t {
26-
MPIR_Lpid lpid; /* local process id, from VCONN */
27-
int next_lpid; /* Index of next lpid (in lpid order) */
28-
} MPII_Group_pmap_t;
29-
30-
/* Any changes in the MPIR_Group structure must be made to the
31-
predefined value in MPIR_Group_builtin for MPI_GROUP_EMPTY in
32-
src/mpi/group/grouputil.c */
3315
/*S
3416
MPIR_Group - Description of the Group data structure
3517
@@ -60,22 +42,35 @@ typedef struct MPII_Group_pmap_t {
6042
Group-DS
6143
6244
S*/
45+
46+
/* Abstract the integer type for lpid (process id). It is possible to use 32-bit
47+
* in principle, but 64-bit is simpler since we can trivially combine
48+
* (world_idx, world_rank).
49+
*/
50+
typedef uint64_t MPIR_Lpid;
51+
52+
struct MPIR_Pmap {
53+
int size; /* same as group->size, duplicate here so Pmap is logically complete */
54+
bool use_map;
55+
union {
56+
MPIR_Lpid *map;
57+
struct {
58+
MPIR_Lpid offset;
59+
MPIR_Lpid stride;
60+
MPIR_Lpid blocksize;
61+
} stride;
62+
} u;
63+
};
64+
6365
struct MPIR_Group {
6466
MPIR_OBJECT_HEADER; /* adds handle and ref_count fields */
6567
int size; /* Size of a group */
66-
int rank; /* rank of this process relative to this
67-
* group */
68-
int idx_of_first_lpid;
69-
MPII_Group_pmap_t *lrank_to_lpid; /* Array mapping a local rank to local
70-
* process number */
71-
int is_local_dense_monotonic; /* see NOTE-G1 */
72-
73-
/* We may want some additional data for the RMA syncrhonization calls */
74-
/* Other, device-specific information */
68+
int rank; /* rank of this process relative to this group */
69+
struct MPIR_Pmap pmap;
70+
MPIR_Session *session_ptr; /* Pointer to session to which this group belongs */
7571
#ifdef MPID_DEV_GROUP_DECL
7672
MPID_DEV_GROUP_DECL
7773
#endif
78-
MPIR_Session * session_ptr; /* Pointer to session to which this group belongs */
7974
};
8075

8176
/* NOTE-G1: is_local_dense_monotonic will be true iff the group meets the
@@ -104,10 +99,8 @@ extern MPIR_Group *const MPIR_Group_empty;
10499
#define MPIR_Group_release_ref(_group, _inuse) \
105100
do { MPIR_Object_release_ref(_group, _inuse); } while (0)
106101

107-
void MPII_Group_setup_lpid_list(MPIR_Group *);
108102
int MPIR_Group_check_valid_ranks(MPIR_Group *, const int[], int);
109103
int MPIR_Group_check_valid_ranges(MPIR_Group *, int[][3], int);
110-
void MPIR_Group_setup_lpid_pairs(MPIR_Group *, MPIR_Group *);
111104
int MPIR_Group_create(int, MPIR_Group **);
112105
int MPIR_Group_release(MPIR_Group * group_ptr);
113106

@@ -123,7 +116,4 @@ int MPIR_Group_check_subset(MPIR_Group * group_ptr, MPIR_Comm * comm_ptr);
123116
void MPIR_Group_set_session_ptr(MPIR_Group * group_ptr, MPIR_Session * session_out);
124117
int MPIR_Group_init(void);
125118

126-
/* internal functions */
127-
void MPII_Group_setup_lpid_list(MPIR_Group *);
128-
129119
#endif /* MPIR_GROUP_H_INCLUDED */

src/mpi/comm/comm_impl.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ int MPII_Comm_create_calculate_mapping(MPIR_Group * group_ptr,
198198
* exactly the same as the ranks in comm world.
199199
*/
200200

201-
/* we examine the group's lpids in both the intracomm and non-comm_world cases */
202-
MPII_Group_setup_lpid_list(group_ptr);
203-
204201
/* Optimize for groups contained within MPI_COMM_WORLD. */
205202
if (comm_ptr->comm_kind == MPIR_COMM_KIND__INTRACOMM) {
206203
int wsize;

0 commit comments

Comments
 (0)