Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI] Replay: C++-ify TestAction.
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Tue, 27 Mar 2018 08:54:03 +0000 (10:54 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Wed, 28 Mar 2018 15:33:52 +0000 (17:33 +0200)
src/smpi/internals/smpi_replay.cpp

index 0657505..d38ce07 100644 (file)
@@ -228,6 +228,32 @@ public:
   }
 };
 
+class TestAction : public ReplayAction<ActionArgParser> {
+public:
+  TestAction() : ReplayAction("Test") {}
+  void kernel(simgrid::xbt::ReplayAction& action) override
+  {
+    MPI_Request request = get_reqq_self()->back();
+    get_reqq_self()->pop_back();
+    // if request is null here, this may mean that a previous test has succeeded
+    // Different times in traced application and replayed version may lead to this
+    // In this case, ignore the extra calls.
+    if (request != nullptr) {
+      TRACE_smpi_testing_in(my_proc_id);
+
+      MPI_Status status;
+      int flag = Request::test(&request, &status);
+
+      XBT_DEBUG("MPI_Test result: %d", flag);
+      /* push back request in vector to be caught by a subsequent wait. if the test did succeed, the request is now
+       * nullptr.*/
+      get_reqq_self()->push_back(request);
+
+      TRACE_smpi_testing_out(my_proc_id);
+    }
+  }
+};
+
 } // Replay Namespace
 
 static void action_init(simgrid::xbt::ReplayAction& action)