Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill trailing whitespaces in source code files.
[simgrid.git] / src / smpi / mpi / smpi_request.cpp
index d6abc90..132d3a7 100644 (file)
@@ -161,7 +161,8 @@ bool Request::match_common(MPI_Request req, MPI_Request sender, MPI_Request rece
 void Request::init_buffer(int count){
 // FIXME Handle the case of a partial shared malloc.
   // This part handles the problem of non-contiguous memory (for the unserialization at the reception)
-  if ((((flags_ & MPI_REQ_RECV) != 0) && ((flags_ & MPI_REQ_ACCUMULATE) != 0)) || (type_->flags() & DT_FLAG_DERIVED)) {
+  if (not smpi_process()->replaying() &&
+     ((((flags_ & MPI_REQ_RECV) != 0) && ((flags_ & MPI_REQ_ACCUMULATE) != 0)) || (type_->flags() & DT_FLAG_DERIVED))) {
     // This part handles the problem of non-contiguous memory
     old_buf_ = buf_;
     if (count==0){
@@ -711,7 +712,7 @@ int Request::testany(int count, MPI_Request requests[], int *index, int* flag, M
       XBT_DEBUG("Exception in testany");
       return 0;
     }
-    
+
     if (i != -1) { // -1 is not MPI_UNDEFINED but a SIMIX return code. (nothing matches)
       *index = map[i];
       if (requests[*index] != MPI_REQUEST_NULL && (requests[*index]->flags_ & MPI_REQ_GENERALIZED) &&
@@ -770,7 +771,7 @@ int Request::testall(int count, MPI_Request requests[], int* outflag, MPI_Status
       }else{
         *outflag=0;
       }
-      if (ret != MPI_SUCCESS) 
+      if (ret != MPI_SUCCESS)
         error = 1;
     }else{
       Status::empty(pstat);
@@ -779,9 +780,9 @@ int Request::testall(int count, MPI_Request requests[], int* outflag, MPI_Status
       status[i] = *pstat;
     }
   }
-  if(error==1) 
+  if (error == 1)
     return MPI_ERR_IN_STATUS;
-  else 
+  else
     return MPI_SUCCESS;
 }
 
@@ -812,11 +813,11 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
                                /*(seconds * flop/s -> total flops)*/ smpi_iprobe_sleep * speed * maxrate)
         ->set_name("iprobe")
         /* Not the entire CPU can be used when iprobing: This is important for
-         * the energy consumption caused by polling with iprobes. 
+         * the energy consumption caused by polling with iprobes.
          * Note also that the number of flops that was
          * computed above contains a maxrate factor and is hence reduced (maxrate < 1)
          */
-        ->set_bound(maxrate*speed)
+        ->set_bound(maxrate * speed)
         ->start()
         ->wait();
   }
@@ -924,9 +925,9 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status)
       MPI_Datatype datatype = req->type_;
 
       // FIXME Handle the case of a partial shared malloc.
-      if (((req->flags_ & MPI_REQ_ACCUMULATE) != 0) ||
-          (datatype->flags() & DT_FLAG_DERIVED)) { // && (not smpi_is_shared(req->old_buf_))){
-        if (not smpi_process()->replaying() && smpi_switch_data_segment(simgrid::s4u::Actor::self(), req->old_buf_))
+      if (not smpi_process()->replaying() &&
+        (((req->flags_ & MPI_REQ_ACCUMULATE) != 0) || (datatype->flags() & DT_FLAG_DERIVED))) {
+        if (smpi_switch_data_segment(simgrid::s4u::Actor::self(), req->old_buf_))
           XBT_VERB("Privatization : We are unserializing to a zone in global memory  Switch data segment ");
 
         if(datatype->flags() & DT_FLAG_DERIVED){
@@ -1070,7 +1071,7 @@ int Request::waitany(int count, MPI_Request requests[], MPI_Status * status)
           // This is a finished detached request, let's return this one
           comms.clear(); // don't do the waitany call afterwards
           index = i;
-          if (requests[index] != MPI_REQUEST_NULL && (requests[index])->flags_ & MPI_REQ_NBC)
+          if (requests[index]->flags_ & MPI_REQ_NBC)
             finish_nbc_requests(&requests[index], 0);
           finish_wait(&requests[i], status); // cleanup if refcount = 0
           if (requests[i] != MPI_REQUEST_NULL && (requests[i]->flags_ & MPI_REQ_NON_PERSISTENT))
@@ -1179,8 +1180,7 @@ int Request::waitsome(int incount, MPI_Request requests[], int *indices, MPI_Sta
   indices[count] = index;
   count++;
   for (int i = 0; i < incount; i++) {
-    if (i!=index && requests[i] != MPI_REQUEST_NULL 
-        && not(requests[i]->flags_ & MPI_REQ_FINISHED)) {
+    if (i != index && requests[i] != MPI_REQUEST_NULL && not(requests[i]->flags_ & MPI_REQ_FINISHED)) {
       test(&requests[i], pstat,&flag);
       if (flag==1){
         indices[count] = i;