Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add tracing for MPI_Start and MPI_Startall.
authordegomme <augustin.degomme@unibas.ch>
Thu, 19 Apr 2018 10:06:46 +0000 (12:06 +0200)
committerdegomme <augustin.degomme@unibas.ch>
Thu, 19 Apr 2018 10:06:46 +0000 (12:06 +0200)
Persistent requests were never traced before.
Thanks r. k. Tesser for the idea.

src/smpi/bindings/smpi_pmpi_request.cpp
src/smpi/include/smpi_request.hpp
src/smpi/mpi/smpi_request.cpp

index 99c0ec2..5f50bff 100644 (file)
@@ -97,8 +97,22 @@ int PMPI_Start(MPI_Request * request)
   if (request == nullptr || *request == MPI_REQUEST_NULL) {
     retval = MPI_ERR_REQUEST;
   } else {
   if (request == nullptr || *request == MPI_REQUEST_NULL) {
     retval = MPI_ERR_REQUEST;
   } else {
-    (*request)->start();
+    MPI_Request req = *request;
+    int my_proc_id = (req->comm() != MPI_COMM_NULL) ? simgrid::s4u::this_actor::get_pid() : -1;
+    TRACE_smpi_comm_in(my_proc_id, __func__,
+                       new simgrid::instr::Pt2PtTIData("Start", req->dst(),
+                                                       req->size(),
+                                                       req->tag(), 
+                                                       simgrid::smpi::Datatype::encode(req->type())));
+    if (not TRACE_smpi_view_internals() && req->flags() & SEND)
+      TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
+
+    req->start();
+
+    if (not TRACE_smpi_view_internals() && req->flags() & RECV)
+      TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
     retval = MPI_SUCCESS;
     retval = MPI_SUCCESS;
+    TRACE_smpi_comm_out(my_proc_id);
   }
   smpi_bench_begin();
   return retval;
   }
   smpi_bench_begin();
   return retval;
@@ -118,7 +132,25 @@ int PMPI_Startall(int count, MPI_Request * requests)
       }
     }
     if(retval != MPI_ERR_REQUEST) {
       }
     }
     if(retval != MPI_ERR_REQUEST) {
+      int my_proc_id = simgrid::s4u::this_actor::get_pid();
+      TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Startall"));
+      MPI_Request req = MPI_REQUEST_NULL;
+      if (not TRACE_smpi_view_internals())
+        for (int i = 0; i < count; i++) {
+          req = requests[i];
+          if (req->flags() & SEND)
+            TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
+        }
+
       simgrid::smpi::Request::startall(count, requests);
       simgrid::smpi::Request::startall(count, requests);
+
+      if (not TRACE_smpi_view_internals())
+        for (int i = 0; i < count; i++) {
+          req = requests[i];
+          if (req->flags() & RECV)
+            TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
+        }
+      TRACE_smpi_comm_out(my_proc_id);
     }
   }
   smpi_bench_begin();
     }
   }
   smpi_bench_begin();
index 7d80fe8..47c6e5c 100644 (file)
@@ -50,6 +50,7 @@ class Request : public F2C {
     int tag();
     int flags();
     int detached();
     int tag();
     int flags();
     int detached();
+    MPI_Datatype type();
     void print_request(const char *message);
     void start();
     void cancel();
     void print_request(const char *message);
     void start();
     void cancel();
index 180d9fd..7aa1dfd 100644 (file)
@@ -95,6 +95,10 @@ int Request::detached(){
   return detached_;
 }
 
   return detached_;
 }
 
+MPI_Datatype Request::type(){
+  return old_type_;
+}
+
 size_t Request::size(){
   return size_;
 }
 size_t Request::size(){
   return size_;
 }