Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the stateful model-checking from the archive. It's not working anymore
[simgrid.git] / src / mc / explo / CommunicationDeterminismChecker.cpp
index 031416a..639b28c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2022. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-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. */
 #include "src/mc/mc_private.hpp"
 #include "src/mc/transition/TransitionAny.hpp"
 #include "src/mc/transition/TransitionComm.hpp"
+#include "xbt/string.hpp"
 
 #include <cstdint>
+#include <inttypes.h>
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_comm_determinism, mc, "Logging specific to MC communication determinism detection");
 
@@ -99,7 +101,7 @@ public:
   std::vector<unsigned> communication_indices_;
 
   static simgrid::xbt::Extension<simgrid::mc::State, StateCommDet> EXTENSION_ID;
-  explicit StateCommDet(CommDetExtension& checker, RemoteApp const& remote_app)
+  explicit StateCommDet(CommDetExtension const& checker, RemoteApp const& remote_app)
   {
     const unsigned long maxpid = remote_app.get_maxpid();
     for (unsigned long i = 0; i < maxpid; i++) {
@@ -208,7 +210,7 @@ void CommDetExtension::enforce_deterministic_pattern(aid_t actor, const PatternC
       XBT_INFO("*********************************************************");
       XBT_INFO("%s", send_diff.c_str());
       exploration_.log_state();
-      mc_model_checker->exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
+      throw McError(ExitStatus::NON_DETERMINISM);
     } else if (_sg_mc_comms_determinism && (not send_deterministic && not recv_deterministic)) {
       XBT_INFO("****************************************************");
       XBT_INFO("***** Non-deterministic communications pattern *****");
@@ -218,7 +220,7 @@ void CommDetExtension::enforce_deterministic_pattern(aid_t actor, const PatternC
       if (not recv_diff.empty())
         XBT_INFO("%s", recv_diff.c_str());
       exploration_.log_state();
-      mc_model_checker->exit(SIMGRID_MC_EXIT_NON_DETERMINISM);
+      throw McError(ExitStatus::NON_DETERMINISM);
     }
   }
 }
@@ -234,7 +236,7 @@ void CommDetExtension::get_comm_pattern(const Transition* transition)
   pattern->index = initial_pattern.index_comm + incomplete_pattern.size();
 
   if (transition->type_ == Transition::Type::COMM_ASYNC_SEND) {
-    auto* send = static_cast<const CommSendTransition*>(transition);
+    const auto* send = static_cast<const CommSendTransition*>(transition);
 
     pattern->type      = PatternCommunicationType::send;
     pattern->comm_addr = send->get_comm();
@@ -243,7 +245,7 @@ void CommDetExtension::get_comm_pattern(const Transition* transition)
     // FIXME: Detached sends should be enforced when the receive is waited
 
   } else if (transition->type_ == Transition::Type::COMM_ASYNC_RECV) {
-    auto* recv = static_cast<const CommRecvTransition*>(transition);
+    const auto* recv = static_cast<const CommRecvTransition*>(transition);
 
     pattern->type      = PatternCommunicationType::receive;
     pattern->comm_addr = recv->get_comm();
@@ -319,15 +321,15 @@ void CommDetExtension::handle_comm_pattern(const Transition* transition)
       }
  */
 
-Exploration* create_communication_determinism_checker(const std::vector<char*>& args, bool with_dpor)
+Exploration* create_communication_determinism_checker(const std::vector<char*>& args, ReductionMode mode)
 {
   CommDetExtension::EXTENSION_ID = simgrid::mc::Exploration::extension_create<CommDetExtension>();
   StateCommDet::EXTENSION_ID     = simgrid::mc::State::extension_create<StateCommDet>();
 
   XBT_DEBUG("********* Start communication determinism verification *********");
 
-  auto base      = new DFSExplorer(args, with_dpor);
-  auto extension = new CommDetExtension(*base);
+  auto* base      = new DFSExplorer(args, mode);
+  auto* extension = new CommDetExtension(*base);
 
   DFSExplorer::on_exploration_start([extension](RemoteApp const&) {
     XBT_INFO("Check communication determinism");