50
50
* and count) to send the data to the other.
51
51
*/
52
52
int
53
- mca_coll_base_alltoallv_intra_basic_inplace (const void * rbuf , const int * rcounts , const int * rdisps ,
53
+ mca_coll_base_alltoallv_intra_basic_inplace (const void * rbuf , ompi_count_array * rcounts , ompi_disp_array * rdisps ,
54
54
struct ompi_datatype_t * rdtype ,
55
55
struct ompi_communicator_t * comm ,
56
56
mca_coll_base_module_t * module )
@@ -72,7 +72,7 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
72
72
if (i == rank ) {
73
73
continue ;
74
74
}
75
- packed_size = rcounts [ i ] * type_size ;
75
+ packed_size = ompi_count_array_get ( rcounts , i ) * type_size ;
76
76
max_size = opal_max (packed_size , max_size );
77
77
}
78
78
@@ -111,11 +111,11 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
111
111
right = (rank + i ) % size ;
112
112
left = (rank + size - i ) % size ;
113
113
114
- if ( 0 != rcounts [ right ] ) { /* nothing to exchange with the peer on the right */
114
+ if ( 0 != ompi_count_array_get ( rcounts , right ) ) { /* nothing to exchange with the peer on the right */
115
115
ompi_proc_t * right_proc = ompi_comm_peer_lookup (comm , right );
116
116
opal_convertor_clone (right_proc -> super .proc_convertor , & convertor , 0 );
117
- opal_convertor_prepare_for_send (& convertor , & rdtype -> super , rcounts [ right ] ,
118
- (char * ) rbuf + rdisps [ right ] * extent );
117
+ opal_convertor_prepare_for_send (& convertor , & rdtype -> super , ompi_count_array_get ( rcounts , right ) ,
118
+ (char * ) rbuf + ompi_disp_array_get ( rdisps , right ) * extent );
119
119
packed_size = max_size ;
120
120
err = opal_convertor_pack (& convertor , & iov , & iov_count , & packed_size );
121
121
if (1 != err ) {
@@ -124,17 +124,19 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
124
124
}
125
125
126
126
/* Receive data from the right */
127
- err = MCA_PML_CALL (irecv ((char * ) rbuf + rdisps [right ] * extent , rcounts [right ], rdtype ,
127
+ err = MCA_PML_CALL (irecv ((char * ) rbuf + ompi_disp_array_get (rdisps , right ) * extent ,
128
+ ompi_count_array_get (rcounts , right ), rdtype ,
128
129
right , MCA_COLL_BASE_TAG_ALLTOALLV , comm , & req ));
129
130
if (MPI_SUCCESS != err ) {
130
131
line = __LINE__ ;
131
132
goto error_hndl ;
132
133
}
133
134
}
134
135
135
- if ( (left != right ) && (0 != rcounts [ left ] ) ) {
136
+ if ( (left != right ) && (0 != ompi_count_array_get ( rcounts , left ) ) ) {
136
137
/* Send data to the left */
137
- err = MCA_PML_CALL (send ((char * ) rbuf + rdisps [left ] * extent , rcounts [left ], rdtype ,
138
+ err = MCA_PML_CALL (send ((char * ) rbuf + ompi_disp_array_get (rdisps , left ) * extent ,
139
+ ompi_count_array_get (rcounts , left ), rdtype ,
138
140
left , MCA_COLL_BASE_TAG_ALLTOALLV , MCA_PML_BASE_SEND_STANDARD ,
139
141
comm ));
140
142
if (MPI_SUCCESS != err ) {
@@ -149,15 +151,16 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
149
151
}
150
152
151
153
/* Receive data from the left */
152
- err = MCA_PML_CALL (irecv ((char * ) rbuf + rdisps [left ] * extent , rcounts [left ], rdtype ,
154
+ err = MCA_PML_CALL (irecv ((char * ) rbuf + ompi_disp_array_get (rdisps , left ) * extent ,
155
+ ompi_count_array_get (rcounts , left ), rdtype ,
153
156
left , MCA_COLL_BASE_TAG_ALLTOALLV , comm , & req ));
154
157
if (MPI_SUCCESS != err ) {
155
158
line = __LINE__ ;
156
159
goto error_hndl ;
157
160
}
158
161
}
159
162
160
- if ( 0 != rcounts [ right ] ) { /* nothing to exchange with the peer on the right */
163
+ if ( 0 != ompi_count_array_get ( rcounts , right ) ) { /* nothing to exchange with the peer on the right */
161
164
/* Send data to the right */
162
165
err = MCA_PML_CALL (send ((char * ) tmp_buffer , packed_size , MPI_PACKED ,
163
166
right , MCA_COLL_BASE_TAG_ALLTOALLV , MCA_PML_BASE_SEND_STANDARD ,
@@ -191,9 +194,9 @@ mca_coll_base_alltoallv_intra_basic_inplace(const void *rbuf, const int *rcounts
191
194
}
192
195
193
196
int
194
- ompi_coll_base_alltoallv_intra_pairwise (const void * sbuf , const int * scounts , const int * sdisps ,
197
+ ompi_coll_base_alltoallv_intra_pairwise (const void * sbuf , ompi_count_array * scounts , ompi_disp_array * sdisps ,
195
198
struct ompi_datatype_t * sdtype ,
196
- void * rbuf , const int * rcounts , const int * rdisps ,
199
+ void * rbuf , ompi_count_array * rcounts , ompi_disp_array * rdisps ,
197
200
struct ompi_datatype_t * rdtype ,
198
201
struct ompi_communicator_t * comm ,
199
202
mca_coll_base_module_t * module )
@@ -230,21 +233,21 @@ ompi_coll_base_alltoallv_intra_pairwise(const void *sbuf, const int *scounts, co
230
233
recvfrom = (rank + size - step ) % size ;
231
234
232
235
/* Determine sending and receiving locations */
233
- psnd = (char * )sbuf + ( ptrdiff_t ) sdisps [ sendto ] * sext ;
234
- prcv = (char * )rbuf + ( ptrdiff_t ) rdisps [ recvfrom ] * rext ;
236
+ psnd = (char * )sbuf + ompi_disp_array_get ( sdisps , sendto ) * sext ;
237
+ prcv = (char * )rbuf + ompi_disp_array_get ( rdisps , recvfrom ) * rext ;
235
238
236
239
/* send and receive */
237
- if (0 < rcounts [ recvfrom ] && 0 < rdtype_size ) {
238
- err = MCA_PML_CALL (irecv (prcv , rcounts [ recvfrom ] , rdtype , recvfrom ,
240
+ if (0 < ompi_count_array_get ( rcounts , recvfrom ) && 0 < rdtype_size ) {
241
+ err = MCA_PML_CALL (irecv (prcv , ompi_count_array_get ( rcounts , recvfrom ) , rdtype , recvfrom ,
239
242
MCA_COLL_BASE_TAG_ALLTOALLV , comm , & req ));
240
243
if (MPI_SUCCESS != err ) {
241
244
line = __LINE__ ;
242
245
goto err_hndl ;
243
246
}
244
247
}
245
248
246
- if (0 < scounts [ sendto ] && 0 < sdtype_size ) {
247
- err = MCA_PML_CALL (send (psnd , scounts [ sendto ] , sdtype , sendto ,
249
+ if (0 < ompi_count_array_get ( scounts , sendto ) && 0 < sdtype_size ) {
250
+ err = MCA_PML_CALL (send (psnd , ompi_count_array_get ( scounts , sendto ) , sdtype , sendto ,
248
251
MCA_COLL_BASE_TAG_ALLTOALLV , MCA_PML_BASE_SEND_STANDARD , comm ));
249
252
if (MPI_SUCCESS != err ) {
250
253
line = __LINE__ ;
@@ -280,9 +283,9 @@ ompi_coll_base_alltoallv_intra_pairwise(const void *sbuf, const int *scounts, co
280
283
* differently and so will not have to duplicate code.
281
284
*/
282
285
int
283
- ompi_coll_base_alltoallv_intra_basic_linear (const void * sbuf , const int * scounts , const int * sdisps ,
286
+ ompi_coll_base_alltoallv_intra_basic_linear (const void * sbuf , ompi_count_array * scounts , ompi_disp_array * sdisps ,
284
287
struct ompi_datatype_t * sdtype ,
285
- void * rbuf , const int * rcounts , const int * rdisps ,
288
+ void * rbuf , ompi_count_array * rcounts , ompi_disp_array * rdisps ,
286
289
struct ompi_datatype_t * rdtype ,
287
290
struct ompi_communicator_t * comm ,
288
291
mca_coll_base_module_t * module )
@@ -313,11 +316,11 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts
313
316
ompi_datatype_type_extent (rdtype , & rext );
314
317
315
318
/* Simple optimization - handle send to self first */
316
- psnd = ((char * ) sbuf ) + ( ptrdiff_t ) sdisps [ rank ] * sext ;
317
- prcv = ((char * ) rbuf ) + ( ptrdiff_t ) rdisps [ rank ] * rext ;
318
- if (0 < scounts [ rank ] && 0 < sdtype_size ) {
319
- err = ompi_datatype_sndrcv (psnd , scounts [ rank ] , sdtype ,
320
- prcv , rcounts [ rank ] , rdtype );
319
+ psnd = ((char * ) sbuf ) + ompi_disp_array_get ( sdisps , rank ) * sext ;
320
+ prcv = ((char * ) rbuf ) + ompi_disp_array_get ( rdisps , rank ) * rext ;
321
+ if (0 < ompi_count_array_get ( scounts , rank ) && 0 < sdtype_size ) {
322
+ err = ompi_datatype_sndrcv (psnd , ompi_count_array_get ( scounts , rank ) , sdtype ,
323
+ prcv , ompi_count_array_get ( rcounts , rank ) , rdtype );
321
324
if (MPI_SUCCESS != err ) {
322
325
return err ;
323
326
}
@@ -339,10 +342,10 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts
339
342
continue ;
340
343
}
341
344
342
- if (0 < rcounts [ i ] && 0 < rdtype_size ) {
345
+ if (0 < ompi_count_array_get ( rcounts , i ) && 0 < rdtype_size ) {
343
346
++ nreqs ;
344
- prcv = ((char * ) rbuf ) + ( ptrdiff_t ) rdisps [ i ] * rext ;
345
- err = MCA_PML_CALL (irecv_init (prcv , rcounts [ i ] , rdtype ,
347
+ prcv = ((char * ) rbuf ) + ompi_disp_array_get ( rdisps , i ) * rext ;
348
+ err = MCA_PML_CALL (irecv_init (prcv , ompi_count_array_get ( rcounts , i ) , rdtype ,
346
349
i , MCA_COLL_BASE_TAG_ALLTOALLV , comm ,
347
350
preq ++ ));
348
351
if (MPI_SUCCESS != err ) { goto err_hndl ; }
@@ -355,10 +358,10 @@ ompi_coll_base_alltoallv_intra_basic_linear(const void *sbuf, const int *scounts
355
358
continue ;
356
359
}
357
360
358
- if (0 < scounts [ i ] && 0 < sdtype_size ) {
361
+ if (0 < ompi_count_array_get ( scounts , i ) && 0 < sdtype_size ) {
359
362
++ nreqs ;
360
- psnd = ((char * ) sbuf ) + ( ptrdiff_t ) sdisps [ i ] * sext ;
361
- err = MCA_PML_CALL (isend_init (psnd , scounts [ i ] , sdtype ,
363
+ psnd = ((char * ) sbuf ) + ompi_disp_array_get ( sdisps , i ) * sext ;
364
+ err = MCA_PML_CALL (isend_init (psnd , ompi_count_array_get ( scounts , i ) , sdtype ,
362
365
i , MCA_COLL_BASE_TAG_ALLTOALLV ,
363
366
MCA_PML_BASE_SEND_STANDARD , comm ,
364
367
preq ++ ));
0 commit comments