Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use a linear sweep waitall when MC is enabled.
authorpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 24 Jan 2011 16:17:40 +0000 (16:17 +0000)
committerpini <pini@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 24 Jan 2011 16:17:40 +0000 (16:17 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9484 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/smpi/smpi_base.c

index 16eaeb9..6822762 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "private.h"
 #include "xbt/time.h"
 
 #include "private.h"
 #include "xbt/time.h"
+#include "mc/mc.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi,
                                 "Logging specific to SMPI (base)");
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi,
                                 "Logging specific to SMPI (base)");
@@ -313,16 +314,19 @@ void smpi_mpi_waitall(int count, MPI_Request requests[],
   MPI_Status stat;
   MPI_Status *pstat = status == MPI_STATUS_IGNORE ? MPI_STATUS_IGNORE : &stat;
 
   MPI_Status stat;
   MPI_Status *pstat = status == MPI_STATUS_IGNORE ? MPI_STATUS_IGNORE : &stat;
 
-  c = count;
-  while(c > 0) {
-    index = smpi_mpi_waitany(count, requests, pstat);
-    if(index == MPI_UNDEFINED) {
-      break;
+  for(c = 0; c < count; c++) {
+    if(MC_IS_ENABLED) {
+      smpi_mpi_wait(&requests[c], pstat);
+      index = c;
+    } else {
+      index = smpi_mpi_waitany(count, requests, pstat);
+      if(index == MPI_UNDEFINED) {
+        break;
+      }
     }
     if(status != MPI_STATUS_IGNORE) {
     }
     if(status != MPI_STATUS_IGNORE) {
-      memcpy(&status[index], pstat, sizeof *pstat);
+      memcpy(&status[index], pstat, sizeof(*pstat));
     }
     }
-    c--;
   }
 }
 
   }
 }