23
23
24
24
static inline int a2av_sched_linear (int rank , int p , NBC_Schedule * schedule ,
25
25
const void * sendbuf , const int * sendcounts ,
26
- const int * sdispls , MPI_Aint sndext , MPI_Datatype sendtype ,
26
+ const int * sdispls , MPI_Aint sndext , MPI_Datatype sendtype , const size_t sdtype_size ,
27
27
void * recvbuf , const int * recvcounts ,
28
- const int * rdispls , MPI_Aint rcvext , MPI_Datatype recvtype );
28
+ const int * rdispls , MPI_Aint rcvext , MPI_Datatype recvtype , const size_t rdtype_size );
29
29
30
30
static inline int a2av_sched_pairwise (int rank , int p , NBC_Schedule * schedule ,
31
31
const void * sendbuf , const int * sendcounts , const int * sdispls ,
32
- MPI_Aint sndext , MPI_Datatype sendtype ,
32
+ MPI_Aint sndext , MPI_Datatype sendtype , const size_t sdtype_size ,
33
33
void * recvbuf , const int * recvcounts , const int * rdispls ,
34
- MPI_Aint rcvext , MPI_Datatype recvtype );
34
+ MPI_Aint rcvext , MPI_Datatype recvtype , const size_t rdtype_size );
35
35
36
36
static inline int a2av_sched_inplace (int rank , int p , NBC_Schedule * schedule ,
37
37
void * buf , const int * counts , const int * displs ,
38
- MPI_Aint ext , MPI_Datatype type , ptrdiff_t gap );
38
+ MPI_Aint ext , MPI_Datatype type , const size_t dtype_size , ptrdiff_t gap );
39
39
40
40
/* an alltoallv schedule can not be cached easily because the contents
41
41
* of the recvcounts array may change, so a comparison of the address
@@ -104,19 +104,13 @@ static int nbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const
104
104
}
105
105
}
106
106
107
- if (0 == sdtype_size || 0 == rdtype_size ) {
108
- /* Nothing to exchange */
109
- ompi_coll_base_nbc_reserve_tags (comm , 1 );
110
- return nbc_get_noop_request (persistent , request );
111
- }
112
-
113
107
schedule = OBJ_NEW (NBC_Schedule );
114
108
if (OPAL_UNLIKELY (NULL == schedule )) {
115
109
free (tmpbuf );
116
110
return OMPI_ERR_OUT_OF_RESOURCE ;
117
111
}
118
112
119
- if (!inplace && 0 < sendcounts [rank ]) {
113
+ if (!inplace && 0 < sendcounts [rank ] && 0 < sdtype_size ) {
120
114
rbuf = (char * ) recvbuf + rdispls [rank ] * rcvext ;
121
115
sbuf = (char * ) sendbuf + sdispls [rank ] * sndext ;
122
116
res = NBC_Sched_copy (sbuf , false, sendcounts [rank ], sendtype ,
@@ -128,12 +122,12 @@ static int nbc_alltoallv_init(const void* sendbuf, const int *sendcounts, const
128
122
}
129
123
130
124
if (inplace ) {
131
- res = a2av_sched_inplace (rank , p , schedule , recvbuf , recvcounts ,
132
- rdispls , rcvext , recvtype , gap );
125
+ res = a2av_sched_inplace (rank , p , schedule , recvbuf , recvcounts , rdispls , rcvext , recvtype ,
126
+ rdtype_size , gap );
133
127
} else {
134
128
res = a2av_sched_linear (rank , p , schedule ,
135
- sendbuf , sendcounts , sdispls , sndext , sendtype ,
136
- recvbuf , recvcounts , rdispls , rcvext , recvtype );
129
+ sendbuf , sendcounts , sdispls , sndext , sendtype , sdtype_size ,
130
+ recvbuf , recvcounts , rdispls , rcvext , recvtype , rdtype_size );
137
131
}
138
132
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
139
133
OBJ_RELEASE (schedule );
@@ -193,11 +187,6 @@ static int nbc_alltoallv_inter_init (const void* sendbuf, const int *sendcounts,
193
187
194
188
ompi_datatype_type_size (sendtype , & sdtype_size );
195
189
ompi_datatype_type_size (recvtype , & rdtype_size );
196
- if (0 == sdtype_size || 0 == rdtype_size ) {
197
- /* Nothing to exchange */
198
- ompi_coll_base_nbc_reserve_tags (comm , 1 );
199
- return nbc_get_noop_request (persistent , request );
200
- }
201
190
202
191
res = ompi_datatype_type_extent (sendtype , & sndext );
203
192
if (MPI_SUCCESS != res ) {
@@ -220,7 +209,7 @@ static int nbc_alltoallv_inter_init (const void* sendbuf, const int *sendcounts,
220
209
221
210
for (int i = 0 ; i < rsize ; i ++ ) {
222
211
/* post all sends */
223
- if (0 < sendcounts [i ]) {
212
+ if (0 < sendcounts [i ] && 0 < sdtype_size ) {
224
213
char * sbuf = (char * ) sendbuf + sdispls [i ] * sndext ;
225
214
res = NBC_Sched_send (sbuf , false, sendcounts [i ], sendtype , i , schedule , false);
226
215
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
@@ -229,7 +218,7 @@ static int nbc_alltoallv_inter_init (const void* sendbuf, const int *sendcounts,
229
218
}
230
219
}
231
220
/* post all receives */
232
- if (0 < recvcounts [i ]) {
221
+ if (0 < recvcounts [i ] && 0 < rdtype_size ) {
233
222
char * rbuf = (char * ) recvbuf + rdispls [i ] * rcvext ;
234
223
res = NBC_Sched_recv (rbuf , false, recvcounts [i ], recvtype , i , schedule , false);
235
224
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
@@ -278,9 +267,9 @@ int ompi_coll_libnbc_ialltoallv_inter (const void* sendbuf, const int *sendcount
278
267
__opal_attribute_unused__
279
268
static inline int a2av_sched_linear (int rank , int p , NBC_Schedule * schedule ,
280
269
const void * sendbuf , const int * sendcounts , const int * sdispls ,
281
- MPI_Aint sndext , MPI_Datatype sendtype ,
270
+ MPI_Aint sndext , MPI_Datatype sendtype , const size_t sdtype_size ,
282
271
void * recvbuf , const int * recvcounts , const int * rdispls ,
283
- MPI_Aint rcvext , MPI_Datatype recvtype ) {
272
+ MPI_Aint rcvext , MPI_Datatype recvtype , const size_t rdtype_size ) {
284
273
int res ;
285
274
286
275
for (int i = 0 ; i < p ; ++ i ) {
@@ -289,7 +278,7 @@ static inline int a2av_sched_linear(int rank, int p, NBC_Schedule *schedule,
289
278
}
290
279
291
280
/* post send */
292
- if (0 < sendcounts [i ]) {
281
+ if (0 < sendcounts [i ] && 0 < sdtype_size ) {
293
282
char * sbuf = ((char * ) sendbuf ) + (sdispls [i ] * sndext );
294
283
res = NBC_Sched_send (sbuf , false, sendcounts [i ], sendtype , i , schedule , false);
295
284
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
@@ -298,7 +287,7 @@ static inline int a2av_sched_linear(int rank, int p, NBC_Schedule *schedule,
298
287
}
299
288
300
289
/* post receive */
301
- if (0 < recvcounts [i ]) {
290
+ if (0 < recvcounts [i ] && 0 < rdtype_size ) {
302
291
char * rbuf = ((char * ) recvbuf ) + (rdispls [i ] * rcvext );
303
292
res = NBC_Sched_recv (rbuf , false, recvcounts [i ], recvtype , i , schedule , false);
304
293
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
@@ -313,17 +302,17 @@ static inline int a2av_sched_linear(int rank, int p, NBC_Schedule *schedule,
313
302
__opal_attribute_unused__
314
303
static inline int a2av_sched_pairwise (int rank , int p , NBC_Schedule * schedule ,
315
304
const void * sendbuf , const int * sendcounts , const int * sdispls ,
316
- MPI_Aint sndext , MPI_Datatype sendtype ,
305
+ MPI_Aint sndext , MPI_Datatype sendtype , const size_t sdtype_size ,
317
306
void * recvbuf , const int * recvcounts , const int * rdispls ,
318
- MPI_Aint rcvext , MPI_Datatype recvtype ) {
307
+ MPI_Aint rcvext , MPI_Datatype recvtype , const size_t rdtype_size ) {
319
308
int res ;
320
309
321
310
for (int i = 1 ; i < p ; ++ i ) {
322
311
int sndpeer = (rank + i ) % p ;
323
312
int rcvpeer = (rank + p - i ) %p ;
324
313
325
314
/* post send */
326
- if (0 < sendcounts [sndpeer ]) {
315
+ if (0 < sendcounts [sndpeer ] && 0 < sdtype_size ) {
327
316
char * sbuf = ((char * ) sendbuf ) + (sdispls [sndpeer ] * sndext );
328
317
res = NBC_Sched_send (sbuf , false, sendcounts [sndpeer ], sendtype , sndpeer , schedule , false);
329
318
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
@@ -332,7 +321,7 @@ static inline int a2av_sched_pairwise(int rank, int p, NBC_Schedule *schedule,
332
321
}
333
322
334
323
/* post receive */
335
- if (0 < recvcounts [rcvpeer ]) {
324
+ if (0 < recvcounts [rcvpeer ] && 0 < rdtype_size ) {
336
325
char * rbuf = ((char * ) recvbuf ) + (rdispls [rcvpeer ] * rcvext );
337
326
res = NBC_Sched_recv (rbuf , false, recvcounts [rcvpeer ], recvtype , rcvpeer , schedule , true);
338
327
if (OPAL_UNLIKELY (OMPI_SUCCESS != res )) {
@@ -346,7 +335,7 @@ static inline int a2av_sched_pairwise(int rank, int p, NBC_Schedule *schedule,
346
335
347
336
static inline int a2av_sched_inplace (int rank , int p , NBC_Schedule * schedule ,
348
337
void * buf , const int * counts , const int * displs ,
349
- MPI_Aint ext , MPI_Datatype type , ptrdiff_t gap ) {
338
+ MPI_Aint ext , MPI_Datatype type , const size_t dtype_size , ptrdiff_t gap ) {
350
339
int res ;
351
340
352
341
for (int i = 1 ; i < (p + 1 )/2 ; i ++ ) {
@@ -355,6 +344,11 @@ static inline int a2av_sched_inplace(int rank, int p, NBC_Schedule *schedule,
355
344
char * sbuf = (char * ) buf + displs [speer ] * ext ;
356
345
char * rbuf = (char * ) buf + displs [rpeer ] * ext ;
357
346
347
+ if (0 == dtype_size ) {
348
+ /* Nothing to exchange */
349
+ return OMPI_SUCCESS ;
350
+ }
351
+
358
352
if (0 < counts [rpeer ]) {
359
353
res = NBC_Sched_copy (rbuf , false, counts [rpeer ], type ,
360
354
(void * )(- gap ), true, counts [rpeer ], type ,
0 commit comments