Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Don't use local structure in PMPI_Waitany
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 15 Jan 2018 12:47:45 +0000 (13:47 +0100)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Mon, 15 Jan 2018 16:15:36 +0000 (17:15 +0100)
The datastructure savedvalstype serves no real purpose
and can be removed.

src/smpi/bindings/smpi_pmpi_request.cpp

index 4b113d6..d6268ca 100644 (file)
@@ -617,15 +617,17 @@ int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * sta
   *index = simgrid::smpi::Request::waitany(count, requests, status);
 
   if(*index!=MPI_UNDEFINED){
-    int src_traced = savedvals[*index].src;
-    //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
-    int dst_traced = savedvals[*index].dst;
-    int is_wait_for_receive = savedvals[*index].recv;
-    if (is_wait_for_receive) {
-      if(savedvals[*index].src==MPI_ANY_SOURCE)
-        src_traced = (status != MPI_STATUSES_IGNORE) ? savedvals[*index].comm->group()->rank(status->MPI_SOURCE)
-                                                     : savedvals[*index].src;
-      TRACE_smpi_recv(src_traced, dst_traced, savedvals[*index].tag);
+    MPI_Request req = requests[*index];
+    if (req != nullptr) { // Requests that were already received will be a nullptr
+      int src_traced = req->src();
+      // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
+      int dst_traced          = req->dst();
+      int is_wait_for_receive = req->flags() & RECV;
+      if (is_wait_for_receive) {
+        if (req->src() == MPI_ANY_SOURCE)
+          src_traced = (status != MPI_STATUSES_IGNORE) ? req->comm()->group()->rank(status->MPI_SOURCE) : req->src();
+        TRACE_smpi_recv(src_traced, dst_traced, req->tag());
+      }
     }
     TRACE_smpi_comm_out(rank_traced);
   }