Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Also set MPI_ERROR in smpi_empty_status.
[simgrid.git] / src / smpi / smpi_base.c
index b3a438c..823a5eb 100644 (file)
@@ -234,11 +234,13 @@ static MPI_Request build_request(void *buf, int count,
 }
 
 
-void smpi_empty_status(MPI_Status * status) {
+void smpi_empty_status(MPI_Status * status)
+{
   if(status != MPI_STATUS_IGNORE) {
-      status->MPI_SOURCE=MPI_ANY_SOURCE;
-      status->MPI_TAG=MPI_ANY_TAG;
-      status->count=0;
+    status->MPI_SOURCE = MPI_ANY_SOURCE;
+    status->MPI_TAG = MPI_ANY_TAG;
+    status->MPI_ERROR = MPI_SUCCESS;
+    status->count=0;
   }
 }
 
@@ -365,7 +367,7 @@ void smpi_mpi_start(MPI_Request request)
 
     //if we are giving back the control to the user without waiting for completion, we have to inject timings
     double sleeptime =0.0;
-    if(request->detached){
+    if(request->detached || (request->flags & (ISEND|SSEND))){// issend should be treated as isend
       //isend and send timings may be different
       sleeptime = (request->flags & ISEND)? smpi_ois(request->size) : smpi_os(request->size);
     }
@@ -517,7 +519,7 @@ void smpi_mpi_sendrecv(void *sendbuf, int sendcount, MPI_Datatype sendtype,
   smpi_mpi_waitall(2, requests, stats);
   if(status != MPI_STATUS_IGNORE) {
     // Copy receive status
-    memcpy(status, &stats[1], sizeof(MPI_Status));
+    *status = stats[1];
   }
 }
 
@@ -642,7 +644,7 @@ int smpi_mpi_testall(int count, MPI_Request requests[],
       smpi_empty_status(pstat);
     }
     if(status != MPI_STATUSES_IGNORE) {
-      memcpy(&status[i], pstat, sizeof(*pstat));
+      status[i] = *pstat;
     }
   }
   return flag;
@@ -786,10 +788,10 @@ int smpi_mpi_waitall(int count, MPI_Request requests[],
         if(index == MPI_UNDEFINED) {
           break;
        }
-      if(status != MPI_STATUSES_IGNORE) {
-        memcpy(&status[index], pstat, sizeof(*pstat));
-        if(status[index].MPI_ERROR==MPI_ERR_TRUNCATE)retvalue=MPI_ERR_IN_STATUS;
-
+      if (status != MPI_STATUSES_IGNORE) {
+        status[index] = *pstat;
+        if (status[index].MPI_ERROR == MPI_ERR_TRUNCATE)
+          retvalue = MPI_ERR_IN_STATUS;
       }
     }
   }
@@ -812,7 +814,7 @@ int smpi_mpi_waitsome(int incount, MPI_Request requests[], int *indices,
       indices[count] = index;
       count++;
       if(status != MPI_STATUSES_IGNORE) {
-        memcpy(&status[index], pstat, sizeof(*pstat));
+        status[index] = *pstat;
       }
     }else{
       return MPI_UNDEFINED;
@@ -836,7 +838,7 @@ int smpi_mpi_testsome(int incount, MPI_Request requests[], int *indices,
          indices[count] = i;
          count++;
          if(status != MPI_STATUSES_IGNORE) {
-            memcpy(&status[i], pstat, sizeof(*pstat));
+           status[i] = *pstat;
          }
       }
     }else{