@@ -105,15 +105,13 @@ get_stride_elem(const void *base, ptrdiff_t sst, size_t nelems, size_t elem_size
105105}
106106
107107static inline int
108- get_dst_pe (struct oshmem_group_t * group , int src_blk_idx , int dst_blk_idx )
108+ get_dst_pe (struct oshmem_group_t * group , int src_blk_idx , int dst_blk_idx , int * dst_pe_idx )
109109{
110- int dst_grp_pe ;
111-
112110 /* index permutation for better distribution of traffic */
113- dst_grp_pe = (dst_blk_idx + src_blk_idx ) % group -> proc_count ;
111+ ( * dst_pe_idx ) = (dst_blk_idx + src_blk_idx ) % group -> proc_count ;
114112
115113 /* convert to the global pe */
116- return oshmem_proc_pe (group -> proc_array [dst_grp_pe ]);
114+ return oshmem_proc_pe (group -> proc_array [* dst_pe_idx ]);
117115}
118116
119117static int a2as_alg_simple (struct oshmem_group_t * group ,
@@ -127,6 +125,7 @@ static int a2as_alg_simple(struct oshmem_group_t *group,
127125 int dst_pe ;
128126 int src_blk_idx ;
129127 int dst_blk_idx ;
128+ int dst_pe_idx ;
130129 size_t elem_idx ;
131130
132131 SCOLL_VERBOSE (14 ,
@@ -137,14 +136,14 @@ static int a2as_alg_simple(struct oshmem_group_t *group,
137136
138137 for (src_blk_idx = 0 ; src_blk_idx < group -> proc_count ; src_blk_idx ++ ) {
139138
140- dst_pe = get_dst_pe (group , src_blk_idx , dst_blk_idx );
139+ dst_pe = get_dst_pe (group , src_blk_idx , dst_blk_idx , & dst_pe_idx );
141140 for (elem_idx = 0 ; elem_idx < nelems ; elem_idx ++ ) {
142141 rc = MCA_SPML_CALL (put (
143142 get_stride_elem (target , tst , nelems , element_size ,
144143 dst_blk_idx , elem_idx ),
145144 element_size ,
146145 get_stride_elem (source , sst , nelems , element_size ,
147- src_blk_idx , elem_idx ),
146+ dst_pe_idx , elem_idx ),
148147 dst_pe ));
149148 if (OSHMEM_SUCCESS != rc ) {
150149 return rc ;
@@ -164,6 +163,7 @@ static int a2a_alg_simple(struct oshmem_group_t *group,
164163 int dst_pe ;
165164 int src_blk_idx ;
166165 int dst_blk_idx ;
166+ int dst_pe_idx ;
167167 void * dst_blk ;
168168
169169 SCOLL_VERBOSE (14 ,
@@ -177,11 +177,11 @@ static int a2a_alg_simple(struct oshmem_group_t *group,
177177
178178 for (src_blk_idx = 0 ; src_blk_idx < group -> proc_count ; src_blk_idx ++ ) {
179179
180- dst_pe = get_dst_pe (group , src_blk_idx , dst_blk_idx );
180+ dst_pe = get_dst_pe (group , src_blk_idx , dst_blk_idx , & dst_pe_idx );
181181 rc = MCA_SPML_CALL (put (dst_blk ,
182182 nelems * element_size ,
183183 get_stride_elem (source , 1 , nelems ,
184- element_size , src_blk_idx , 0 ),
184+ element_size , dst_pe_idx , 0 ),
185185 dst_pe ));
186186 if (OSHMEM_SUCCESS != rc ) {
187187 return rc ;
0 commit comments