X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d3a5b5e5113cf4438faf96f6dc442240c5b9d085..36c1b72b7fce07b7a1797808df3c8808c12694c1:/src/smpi/mpi/smpi_datatype.cpp diff --git a/src/smpi/mpi/smpi_datatype.cpp b/src/smpi/mpi/smpi_datatype.cpp index b738b7ba33..2457c8ffdd 100644 --- a/src/smpi/mpi/smpi_datatype.cpp +++ b/src/smpi/mpi/smpi_datatype.cpp @@ -193,6 +193,11 @@ bool Datatype::is_valid(){ return (flags_ & DT_FLAG_COMMITED); } +bool Datatype::is_basic() +{ + return (flags_ & DT_FLAG_BASIC); +} + size_t Datatype::size(){ return size_; } @@ -246,7 +251,8 @@ void Datatype::set_name(char* name){ int Datatype::pack(void* inbuf, int incount, void* outbuf, int outcount, int* position,MPI_Comm comm){ if (outcount - *position < incount*static_cast(size_)) return MPI_ERR_BUFFER; - Datatype::copy(inbuf, incount, this, static_cast(outbuf) + *position, outcount, MPI_CHAR); + Datatype::copy(inbuf == MPI_BOTTOM ? nullptr : inbuf, incount, this, static_cast(outbuf) + *position, outcount, + MPI_CHAR); *position += incount * size_; return MPI_SUCCESS; } @@ -278,9 +284,9 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype, if (not smpi_process()->replaying()) memcpy(recvbuf, sendbuf, count); } else if (not(sendtype->flags() & DT_FLAG_DERIVED)) { - recvtype->unserialize( sendbuf, recvbuf, recvcount/recvtype->size(), MPI_REPLACE); + recvtype->unserialize(sendbuf, recvbuf, count / recvtype->size(), MPI_REPLACE); } else if (not(recvtype->flags() & DT_FLAG_DERIVED)) { - sendtype->serialize(sendbuf, recvbuf, sendcount/sendtype->size()); + sendtype->serialize(sendbuf, recvbuf, count / sendtype->size()); }else{ void * buf_tmp = xbt_malloc(count);