@@ -125,7 +125,6 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int
125
125
int need_bounce_buf = 0 , total_up_scounts = 0 , * up_displs = NULL , * up_scounts = NULL ,
126
126
* up_peer_lb = NULL , * up_peer_ub = NULL ;
127
127
char * reorder_sbuf = (char * ) sbuf , * bounce_buf = NULL ;
128
- size_t sdsize ;
129
128
130
129
low_scounts = malloc (low_size * sizeof (int ));
131
130
low_displs = malloc (low_size * sizeof (int ));
@@ -144,8 +143,6 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int
144
143
low_scounts [low_peer ] = scounts [w_peer ];
145
144
}
146
145
147
- ompi_datatype_type_size (sdtype , & sdsize );
148
-
149
146
up_scounts = calloc (up_size , sizeof (int ));
150
147
up_displs = malloc (up_size * sizeof (int ));
151
148
up_peer_ub = calloc (up_size , sizeof (int ));
@@ -201,11 +198,14 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int
201
198
}
202
199
203
200
if (need_bounce_buf ) {
204
- bounce_buf = malloc (sdsize * total_up_scounts );
201
+ ptrdiff_t ssize , sgap ;
202
+ ssize = opal_datatype_span (& rdtype -> super , total_up_scounts , & sgap );
203
+ bounce_buf = malloc (ssize );
205
204
if (!bounce_buf ) {
206
205
err = OMPI_ERR_OUT_OF_RESOURCE ;
207
206
goto root_out ;
208
207
}
208
+ reorder_sbuf = bounce_buf - sgap ;
209
209
210
210
/* Calculate displacements for the inter-node scatterv */
211
211
for (up_peer = 0 ; up_peer < up_size ; ++ up_peer ) {
@@ -214,7 +214,8 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int
214
214
}
215
215
216
216
/* Use a temp buffer to reorder the send buffer if needed */
217
- ptrdiff_t offset = 0 ;
217
+ ptrdiff_t offset = 0 , sdext ;
218
+ ompi_datatype_type_extent (sdtype , & sdext );
218
219
219
220
for (int i = 0 ; i < w_size ; ++ i ) {
220
221
up_peer = topo [2 * i ];
@@ -225,13 +226,11 @@ int mca_coll_han_scatterv_intra(const void *sbuf, const int *scounts, const int
225
226
w_peer = topo [2 * i + 1 ];
226
227
227
228
ompi_datatype_copy_content_same_ddt (sdtype , (size_t ) scounts [w_peer ],
228
- bounce_buf + offset ,
229
+ reorder_sbuf + offset ,
229
230
(char * ) sbuf
230
- + (size_t ) displs [w_peer ] * sdsize );
231
- offset += sdsize * (size_t ) scounts [w_peer ];
231
+ + (size_t ) displs [w_peer ] * sdext );
232
+ offset += sdext * (size_t ) scounts [w_peer ];
232
233
}
233
-
234
- reorder_sbuf = bounce_buf ;
235
234
}
236
235
237
236
/* Up Iscatterv */
0 commit comments