Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 8b28d01

Browse files
authored
Merge pull request #1355 from ggouaillardet/topic/v2.x/libnbc_ireduce
v2.x: libnbc fixes
2 parents df9acc4 + 78f74e5 commit 8b28d01

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ompi/mca/coll/libnbc/nbc_internal.h

+3-7
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,6 @@ static inline int NBC_Type_intrinsic(MPI_Datatype type) {
483483
/* let's give a try to inline functions */
484484
static inline int NBC_Copy(const void *src, int srccount, MPI_Datatype srctype, void *tgt, int tgtcount, MPI_Datatype tgttype, MPI_Comm comm) {
485485
int size, pos, res;
486-
OPAL_PTRDIFF_TYPE ext, lb;
487486
void *packbuf;
488487

489488
#if OPAL_CUDA_SUPPORT
@@ -493,13 +492,10 @@ static inline int NBC_Copy(const void *src, int srccount, MPI_Datatype srctype,
493492
#endif /* OPAL_CUDA_SUPPORT */
494493
/* if we have the same types and they are contiguous (intrinsic
495494
* types are contiguous), we can just use a single memcpy */
496-
res = ompi_datatype_get_extent(srctype, &lb, &ext);
497-
if (OMPI_SUCCESS != res) {
498-
NBC_Error ("MPI Error in MPI_Type_extent() (%i)", res);
499-
return res;
500-
}
495+
ptrdiff_t gap, span;
496+
span = opal_datatype_span(&srctype->super, srccount, &gap);
501497

502-
memcpy(tgt, src, srccount*ext);
498+
memcpy(tgt, src, span);
503499
} else {
504500
/* we have to pack and unpack */
505501
res = PMPI_Pack_size(srccount, srctype, comm, &size);

ompi/mca/coll/libnbc/nbc_ireduce.c

+4
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ static inline int red_sched_binomial (int rank, int p, int root, const void *sen
309309
RANK2VRANK(rank, vrank, vroot);
310310
maxr = (int)ceil((log((double)p)/LOG2));
311311

312+
if (rank != root) {
313+
inplace = 0;
314+
}
315+
312316
/* ensure the result ends up in redbuf on vrank 0 */
313317
if (0 == (maxr%2)) {
314318
rbuf = (void *)(-gap);

0 commit comments

Comments
 (0)