Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add new entry in Release_Notes.
[simgrid.git] / src / smpi / include / smpi_replay.hpp
index d17d5fb..10fbc85 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2023. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -25,7 +25,7 @@
       for (const auto& elem : (action)) {                                                                              \
         ss << elem << " ";                                                                                             \
       }                                                                                                                \
-      ss << "\nPlease contact the Simgrid team if support is needed";                                                  \
+      ss << "\nPlease contact the SimGrid team if support is needed";                                                  \
       throw std::invalid_argument(ss.str());                                                                           \
     }                                                                                                                  \
   }
@@ -35,9 +35,7 @@ XBT_PRIVATE unsigned char* smpi_get_tmp_recvbuffer(size_t size);
 
 XBT_PRIVATE void log_timed_action(const simgrid::xbt::ReplayAction& action, double clock);
 
-namespace simgrid {
-namespace smpi {
-namespace replay {
+namespace simgrid::smpi::replay {
 extern MPI_Datatype MPI_DEFAULT_TYPE;
 
 class RequestStorage; // Forward decl
@@ -60,11 +58,11 @@ public:
   void parse(xbt::ReplayAction& action, const std::string& name) override;
 };
 
-class SendRecvParser : public ActionArgParser {
+class SendOrRecvParser : public ActionArgParser {
 public:
   /* communication partner; if we send, this is the receiver and vice versa */
   int partner;
-  size_t size;
+  ssize_t size;
   int tag;
   MPI_Datatype datatype1;
 
@@ -105,6 +103,18 @@ public:
   MPI_Datatype datatype2;
 };
 
+class SendRecvParser : public ActionArgParser {
+public:
+  int dst;
+  int src;
+  int sendcount;
+  int recvcount;
+  MPI_Datatype datatype1;
+  MPI_Datatype datatype2;
+
+  void parse(xbt::ReplayAction& action, const std::string& name) override;
+};
+
 class BcastArgParser : public CollCommParser {
 public:
   void parse(xbt::ReplayAction& action, const std::string& name) override;
@@ -187,7 +197,7 @@ public:
 template <class T> class ReplayAction {
   const std::string name_;
   const aid_t my_proc_id_ = s4u::this_actor::get_pid();
-  T args_;
+  T args_{};
 
 protected:
   const std::string& get_name() const { return name_; }
@@ -221,7 +231,7 @@ public:
   void kernel(xbt::ReplayAction& action) override;
 };
 
-class SendAction : public ReplayAction<SendRecvParser> {
+class SendAction : public ReplayAction<SendOrRecvParser> {
   RequestStorage& req_storage;
 
 public:
@@ -229,7 +239,7 @@ public:
   void kernel(xbt::ReplayAction& action) override;
 };
 
-class RecvAction : public ReplayAction<SendRecvParser> {
+class RecvAction : public ReplayAction<SendOrRecvParser> {
   RequestStorage& req_storage;
 
 public:
@@ -284,6 +294,12 @@ public:
   void kernel(xbt::ReplayAction& action) override;
 };
 
+class SendRecvAction : public ReplayAction<SendRecvParser> {
+public:
+  explicit SendRecvAction() : ReplayAction("sendrecv") {}
+  void kernel(xbt::ReplayAction& action) override;
+};
+
 class BarrierAction : public ReplayAction<ActionArgParser> {
 public:
   explicit BarrierAction() : ReplayAction("barrier") {}
@@ -356,8 +372,6 @@ public:
   void kernel(xbt::ReplayAction& action) override;
 };
 
-} // namespace replay
-} // namespace smpi
-} // namespace simgrid
+} // namespace simgrid::smpi::replay
 
 #endif