Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Support MPI3 datatype MPI_Count
[simgrid.git] / src / smpi / mpi / smpi_datatype.cpp
index 8d7a457..1aa5908 100644 (file)
@@ -95,6 +95,8 @@ CREATE_MPI_DATATYPE_NULL(MPI_LB, 52);
 CREATE_MPI_DATATYPE(MPI_PACKED, 53, char);
 // Internal use only
 CREATE_MPI_DATATYPE(MPI_PTR, 54, void*);
+CREATE_MPI_DATATYPE(MPI_COUNT, 55, long long);
+
 
 namespace simgrid{
 namespace smpi{
@@ -250,7 +252,7 @@ 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<int>(size_))
-    return MPI_ERR_BUFFER;
+    return MPI_ERR_OTHER;
   Datatype::copy(inbuf, incount, this, static_cast<char*>(outbuf) + *position, outcount, MPI_CHAR);
   *position += incount * size_;
   return MPI_SUCCESS;
@@ -258,7 +260,7 @@ int Datatype::pack(void* inbuf, int incount, void* outbuf, int outcount, int* po
 
 int Datatype::unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount,MPI_Comm comm){
   if (outcount*static_cast<int>(size_)> insize)
-    return MPI_ERR_BUFFER;
+    return MPI_ERR_OTHER;
   Datatype::copy(static_cast<char*>(inbuf) + *position, insize, MPI_CHAR, outbuf, outcount, this);
   *position += outcount * size_;
   return MPI_SUCCESS;
@@ -277,7 +279,7 @@ int Datatype::copy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
     sendcount *= sendtype->size();
     recvcount *= recvtype->size();
     int count = sendcount < recvcount ? sendcount : recvcount;
-
+    XBT_DEBUG("Copying %d bytes from %p to %p", count, sendbuf, recvbuf);
     if (not(sendtype->flags() & DT_FLAG_DERIVED) && not(recvtype->flags() & DT_FLAG_DERIVED)) {
       if (not smpi_process()->replaying())
         memcpy(recvbuf, sendbuf, count);