Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / src / mc / mc_comm_pattern.hpp
index cc189d7..ea8eb31 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007-2017. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2007-2022. 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. */
@@ -7,76 +7,56 @@
 #define SIMGRID_MC_COMM_PATTERN_H
 
 #include <vector>
-
-#include "smpi/smpi.h"
-#include "xbt/dynar.h"
-
-#include "src/mc/mc_state.hpp"
+#include "src/mc/mc_pattern.hpp"
 
 namespace simgrid {
 namespace mc {
 
-struct PatternCommunicationList {
-  unsigned int index_comm = 0;
-  std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
+enum class CallType {
+  NONE,
+  SEND,
+  RECV,
+  WAIT,
+  WAITANY,
 };
-}
-}
-
-extern "C" {
-
-/**
- *  Type: `xbt_dynar_t<mc_list_comm_pattern_t>`
- */
-extern XBT_PRIVATE xbt_dynar_t initial_communications_pattern;
 
-/**
- *  Type: `xbt_dynar_t<xbt_dynar_t<simgrid::mc::PatternCommunication*>>`
- */
-extern XBT_PRIVATE xbt_dynar_t incomplete_communications_pattern;
-
-enum e_mc_call_type_t {
-  MC_CALL_TYPE_NONE,
-  MC_CALL_TYPE_SEND,
-  MC_CALL_TYPE_RECV,
-  MC_CALL_TYPE_WAIT,
-  MC_CALL_TYPE_WAITANY,
+enum class CommPatternDifference {
+  NONE,
+  TYPE,
+  RDV,
+  TAG,
+  SRC_PROC,
+  DST_PROC,
+  DATA_SIZE,
+  DATA,
 };
 
-enum e_mc_comm_pattern_difference_t {
-  NONE_DIFF,
-  TYPE_DIFF,
-  RDV_DIFF,
-  TAG_DIFF,
-  SRC_PROC_DIFF,
-  DST_PROC_DIFF,
-  DATA_SIZE_DIFF,
-  DATA_DIFF,
+struct PatternCommunicationList {
+  unsigned int index_comm = 0;
+  std::vector<std::unique_ptr<simgrid::mc::PatternCommunication>> list;
 };
+} // namespace mc
+} // namespace simgrid
+
+extern XBT_PRIVATE std::vector<simgrid::mc::PatternCommunicationList> initial_communications_pattern;
+extern XBT_PRIVATE std::vector<std::vector<simgrid::mc::PatternCommunication*>> incomplete_communications_pattern;
 
-static inline e_mc_call_type_t MC_get_call_type(smx_simcall_t req)
+static inline simgrid::mc::CallType MC_get_call_type(const s_smx_simcall* req)
 {
-  switch (req->call) {
-    case SIMCALL_COMM_ISEND:
-      return MC_CALL_TYPE_SEND;
-    case SIMCALL_COMM_IRECV:
-      return MC_CALL_TYPE_RECV;
-    case SIMCALL_COMM_WAIT:
-      return MC_CALL_TYPE_WAIT;
-    case SIMCALL_COMM_WAITANY:
-      return MC_CALL_TYPE_WAITANY;
+  using simgrid::mc::CallType;
+  using simgrid::simix::Simcall;
+  switch (req->call_) {
+    case Simcall::COMM_ISEND:
+      return CallType::SEND;
+    case Simcall::COMM_IRECV:
+      return CallType::RECV;
+    case Simcall::COMM_WAIT:
+      return CallType::WAIT;
+    case Simcall::COMM_WAITANY:
+      return CallType::WAITANY;
     default:
-      return MC_CALL_TYPE_NONE;
+      return CallType::NONE;
   }
 }
 
-XBT_PRIVATE void MC_handle_comm_pattern(e_mc_call_type_t call_type, smx_simcall_t request, int value,
-                                        xbt_dynar_t current_pattern, int backtracking);
-
-XBT_PRIVATE void MC_restore_communications_pattern(simgrid::mc::State* state);
-
-XBT_PRIVATE void MC_state_copy_incomplete_communications_pattern(simgrid::mc::State* state);
-XBT_PRIVATE void MC_state_copy_index_communications_pattern(simgrid::mc::State* state);
-}
-
 #endif