From: degomme Date: Fri, 13 Apr 2018 11:52:49 +0000 (+0200) Subject: handle MPI_IN_PLACE for MPI_Scan X-Git-Tag: v3.20~432 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/e425b5ba392ffe2e3f786a9a8cb5486c463a4ff6 handle MPI_IN_PLACE for MPI_Scan --- diff --git a/src/smpi/bindings/smpi_pmpi_coll.cpp b/src/smpi/bindings/smpi_pmpi_coll.cpp index 48e31cf2be..8c246d8d09 100644 --- a/src/smpi/bindings/smpi_pmpi_coll.cpp +++ b/src/smpi/bindings/smpi_pmpi_coll.cpp @@ -415,14 +415,19 @@ int PMPI_Scan(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MP retval = MPI_ERR_OP; } else { int rank = simgrid::s4u::this_actor::get_pid(); - + if (sendbuf == MPI_IN_PLACE) { + sendtmpbuf = static_cast(xbt_malloc(count * datatype->size())); + memcpy(sendtmpbuf, recvbuf, count * datatype->size()); + } TRACE_smpi_comm_in(rank, __func__, new simgrid::instr::Pt2PtTIData( "scan", -1, datatype->is_replayable() ? count : count * datatype->size(), simgrid::smpi::Datatype::encode(datatype))); - retval = simgrid::smpi::Colls::scan(sendbuf, recvbuf, count, datatype, op, comm); + retval = simgrid::smpi::Colls::scan(sendtmpbuf, recvbuf, count, datatype, op, comm); TRACE_smpi_comm_out(rank); + if (sendbuf == MPI_IN_PLACE) + xbt_free(sendtmpbuf); } smpi_bench_begin();