From 8b7999469bff4854d7dff3d03da8463cdd05fa84 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Thu, 1 Dec 2016 11:11:30 +0900 Subject: [PATCH] coll/base: fix MPI_IN_PLACE in ompi_coll_base_reduce_generic() avoid copying data to itself when MPI_IN_PLACE is used Signed-off-by: Gilles Gouaillardet --- ompi/mca/coll/base/coll_base_reduce.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ompi/mca/coll/base/coll_base_reduce.c b/ompi/mca/coll/base/coll_base_reduce.c index 37585dd0b6..5c5585141f 100644 --- a/ompi/mca/coll/base/coll_base_reduce.c +++ b/ompi/mca/coll/base/coll_base_reduce.c @@ -99,7 +99,8 @@ int ompi_coll_base_reduce_generic( const void* sendbuf, void* recvbuf, int origi /* If this is a non-commutative operation we must copy sendbuf to the accumbuf, in order to simplfy the loops */ - if (!ompi_op_is_commute(op)) { + + if (!ompi_op_is_commute(op) && MPI_IN_PLACE != sendbuf) { ompi_datatype_copy_content_same_ddt(datatype, original_count, (char*)accumbuf, (char*)sendtmpbuf);