From 0f6dd8f2a58a72b09b015ae4c31b0025464f9a31 Mon Sep 17 00:00:00 2001 From: Mikhail Brinskii Date: Sat, 12 Sep 2020 16:43:30 +0300 Subject: [PATCH] SHMEM/SCOLL: Fix inplace reductions Signed-off-by: Mikhail Brinskii (cherry picked from commit dfe20e0472dff1f1911d72ede2b20913be6bd2e3) --- oshmem/mca/scoll/mpi/scoll_mpi_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c index 2aa87a0222..d40bb76a4c 100644 --- a/oshmem/mca/scoll/mpi/scoll_mpi_ops.c +++ b/oshmem/mca/scoll/mpi/scoll_mpi_ops.c @@ -226,11 +226,11 @@ int mca_scoll_mpi_reduce(struct oshmem_group_t *group, MPI_COLL_VERBOSE(20,"RUNNING MPI REDUCE"); void *sbuf, *rbuf; mpi_module = (mca_scoll_mpi_module_t *) group->g_scoll.scoll_reduce_module; - sbuf = (void *) source; - rbuf = target; dtype = shmem_dtype_to_ompi_dtype(op); h_op = shmem_op_to_ompi_op(op->op); count = nlong/op->dt_size; + rbuf = target; + sbuf = (source == target) ? MPI_IN_PLACE : (void*)source; /* Do nothing on zero-length request */ if (OPAL_UNLIKELY(!nlong)) {