X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/1d32796efe1be63d7a67b8718527fa03a32c4baa..d37b09424c4b4e8d5b59c575b5b1b3d1b7c252ee:/src/smpi/smpi_base.c diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 2bc6b976de..ff3b8554cb 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -9,6 +9,7 @@ #include "mc/mc.h" #include "xbt/replay.h" #include +#include "surf/surf.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi, "Logging specific to SMPI (base)"); @@ -143,7 +144,8 @@ void smpi_mpi_start(MPI_Request request) void *oldbuf = request->buf; detached = 1; request->buf = malloc(request->size); - memcpy(request->buf,oldbuf,request->size); + if (oldbuf) + memcpy(request->buf,oldbuf,request->size); XBT_DEBUG("Send request %p is detached; buf %p copied into %p",request,oldbuf,request->buf); }else{ XBT_DEBUG("Send request %p is not detached (buf: %p)",request,request->buf); @@ -689,7 +691,8 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, // FIXME: check for errors smpi_datatype_extent(datatype, &lb, &dataext); // Local copy from root - smpi_datatype_copy(sendbuf, count, datatype, recvbuf, count, datatype); + if (sendbuf && recvbuf) + smpi_datatype_copy(sendbuf, count, datatype, recvbuf, count, datatype); // Receive buffers from senders //TODO: make a MPI_barrier here ? requests = xbt_new(MPI_Request, size - 1); @@ -714,7 +717,8 @@ void smpi_mpi_reduce(void *sendbuf, void *recvbuf, int count, if(index == MPI_UNDEFINED) { break; } - smpi_op_apply(op, tmpbufs[index], recvbuf, &count, &datatype); + if(op) /* op can be MPI_OP_NULL that does nothing */ + smpi_op_apply(op, tmpbufs[index], recvbuf, &count, &datatype); } for(index = 0; index < size - 1; index++) { xbt_free(tmpbufs[index]);