Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'udpor-phase7' into 'master'
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 18 Apr 2023 07:08:17 +0000 (07:08 +0000)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 18 Apr 2023 07:08:17 +0000 (07:08 +0000)
Phase 7 of UDPOR Integration: Add specialized `ex(C)` computation for `Comm*` transitions

See merge request simgrid/simgrid!144

1  2 
MANIFEST.in
src/mc/api/State.cpp
src/mc/api/State.hpp
tools/cmake/DefinePackages.cmake

diff --combined MANIFEST.in
@@@ -345,9 -345,8 +345,9 @@@ include examples/cpp/network-ns3/crosst
  include examples/cpp/network-ns3/dogbone_d.xml
  include examples/cpp/network-ns3/one_cluster_d.xml
  include examples/cpp/network-ns3/onelink_d.xml
 +include examples/cpp/network-ns3/s4u-network-ns3-notime.tesh
 +include examples/cpp/network-ns3/s4u-network-ns3-timed.tesh
  include examples/cpp/network-ns3/s4u-network-ns3.cpp
 -include examples/cpp/network-ns3/s4u-network-ns3.tesh
  include examples/cpp/network-wifi/s4u-network-wifi.cpp
  include examples/cpp/network-wifi/s4u-network-wifi.tesh
  include examples/cpp/platform-comm-serialize/s4u-platform-comm-serialize.cpp
@@@ -2189,6 -2188,8 +2189,8 @@@ include src/mc/explo/udpor/Configuratio
  include src/mc/explo/udpor/EventSet.cpp
  include src/mc/explo/udpor/EventSet.hpp
  include src/mc/explo/udpor/EventSet_test.cpp
+ include src/mc/explo/udpor/ExtensionSetCalculator.cpp
+ include src/mc/explo/udpor/ExtensionSetCalculator.hpp
  include src/mc/explo/udpor/History.cpp
  include src/mc/explo/udpor/History.hpp
  include src/mc/explo/udpor/History_test.cpp
@@@ -2226,7 -2227,6 +2228,7 @@@ include src/mc/mc_base.hp
  include src/mc/mc_client_api.cpp
  include src/mc/mc_config.cpp
  include src/mc/mc_config.hpp
 +include src/mc/mc_environ.h
  include src/mc/mc_exit.hpp
  include src/mc/mc_forward.hpp
  include src/mc/mc_global.cpp
@@@ -2629,7 -2629,6 +2631,7 @@@ include tools/cmake/scripts/my_valgrind
  include tools/cmake/scripts/update_tesh.pl
  include tools/cmake/test_prog/prog_asan.cpp
  include tools/cmake/test_prog/prog_makecontext.c
 +include tools/cmake/test_prog/prog_ns3.cpp
  include tools/cmake/test_prog/prog_stackgrowth.c
  include tools/cmake/test_prog/prog_stacksetup.c
  include tools/cmake/test_prog/prog_tsan.cpp
diff --combined src/mc/api/State.cpp
@@@ -22,10 -22,8 +22,10 @@@ State::State(RemoteApp& remote_app) : n
    XBT_VERB("Creating a guide for the state");
    if (_sg_mc_strategy == "none")
      strategy_ = std::make_shared<BasicStrategy>();
 -  if (_sg_mc_strategy == "nb_wait")
 +  else if (_sg_mc_strategy == "nb_wait")
      strategy_ = std::make_shared<WaitStrategy>();
 +  else
 +    THROW_IMPOSSIBLE;
  
    recipe_ = std::list<Transition*>();
  
  State::State(RemoteApp& remote_app, std::shared_ptr<State> parent_state)
      : num_(++expended_states_), parent_state_(parent_state)
  {
 -
    if (_sg_mc_strategy == "none")
      strategy_ = std::make_shared<BasicStrategy>();
 -  if (_sg_mc_strategy == "nb_wait")
 +  else if (_sg_mc_strategy == "nb_wait")
      strategy_ = std::make_shared<WaitStrategy>();
 +  else
 +    THROW_IMPOSSIBLE;
    *strategy_ = *(parent_state->strategy_);
  
    recipe_ = std::list(parent_state_->get_recipe());
@@@ -89,7 -86,7 +89,7 @@@ std::size_t State::count_todo() cons
  std::size_t State::count_todo_multiples() const
  {
    size_t count = 0;
 -  for (auto& [_, actor] : strategy_->actors_to_run_)
 +  for (auto const& [_, actor] : strategy_->actors_to_run_)
      if (actor.is_todo())
        count += actor.get_times_not_considered();
  
@@@ -130,7 -127,7 +130,7 @@@ std::pair<aid_t, int> State::next_trans
  }
  
  // This should be done in GuidedState, or at least interact with it
void State::execute_next(aid_t next, RemoteApp& app)
std::shared_ptr<Transition> State::execute_next(aid_t next, RemoteApp& app)
  {
    // First, warn the guide, so it knows how to build a proper child state
    strategy_->execute_next(next, app);
    // about a transition AFTER it has executed.
    transition_ = just_executed;
  
-   auto executed_transition = std::unique_ptr<Transition>(just_executed);
-   actor_state.set_transition(std::move(executed_transition), times_considered);
+   const auto executed_transition = std::shared_ptr<Transition>(just_executed);
+   actor_state.set_transition(executed_transition, times_considered);
    app.wait_for_requests();
+   return executed_transition;
  }
  } // namespace simgrid::mc
diff --combined src/mc/api/State.hpp
@@@ -22,11 -22,19 +22,11 @@@ class XBT_PRIVATE State : public xbt::E
    static long expended_states_; /* Count total amount of states, for stats */
  
    /**
 -   * @brief An empty transition that leads to this state by default
 -   */
 -  const std::unique_ptr<Transition> default_transition_ = std::make_unique<Transition>();
 -
 -  /**
 -   * @brief The outgoing transition: what was the last transition that
 -   * we took to leave this state?
 +   * @brief The outgoing transition: what was the last transition that we took to leave this state?
     *
 -   * The owner of the transition is the `ActorState` instance which exists in this state,
 -   * or a reference to the internal default transition `Transition()` if no transition has been
 -   * set
 +   * The owner of the transition is the `ActorState` instance which exists in this state.
     */
 -  Transition* transition_ = default_transition_.get();
 +  Transition* transition_ = nullptr;
  
    /** @brief A list of transition to be replayed in order to get in this state. */
    std::list<Transition*> recipe_;
@@@ -58,9 -66,11 +58,11 @@@ public
     internal cost of the transition is returned */
    std::pair<aid_t, int> next_transition_guided() const;
  
-   /* Explore a new path on the remote app; the parameter 'next' must be the result of a previous call to
-    * next_transition() */
-   void execute_next(aid_t next, RemoteApp& app);
+   /**
+    * @brief Explore a new path on the remote app; the parameter 'next' must be the result of a previous call to
+    * next_transition()
+    */
+   std::shared_ptr<Transition> execute_next(aid_t next, RemoteApp& app);
  
    long get_num() const { return num_; }
    std::size_t count_todo() const;
     *  + consider_one mark aid actor (and assert it is possible)
     *  + consider_best ensure one actor is marked by eventually marking the best regarding its guiding methode
     *  + conside_all mark all enabled actor that are not done yet */
 -  void consider_one(aid_t aid) { strategy_->consider_one(aid); }
 -  void consider_best() { strategy_->consider_best(); }
 -  unsigned long consider_all() { return strategy_->consider_all(); }
 +  void consider_one(aid_t aid) const { strategy_->consider_one(aid); }
 +  void consider_best() const { strategy_->consider_best(); }
 +  unsigned long consider_all() const { return strategy_->consider_all(); }
  
    bool is_actor_done(aid_t actor) const { return strategy_->actors_to_run_.at(actor).is_done(); }
    Transition* get_transition() const;
    void set_transition(Transition* t) { transition_ = t; }
 -  std::shared_ptr<State> get_parent_state() { return parent_state_; }
 +  std::shared_ptr<State> get_parent_state() const { return parent_state_; }
    std::list<Transition*> get_recipe() const { return recipe_; }
  
    std::map<aid_t, ActorState> const& get_actors_list() const { return strategy_->actors_to_run_; }
  
    unsigned long get_actor_count() const { return strategy_->actors_to_run_.size(); }
 -  bool is_actor_enabled(aid_t actor) { return strategy_->actors_to_run_.at(actor).is_enabled(); }
 +  bool is_actor_enabled(aid_t actor) const { return strategy_->actors_to_run_.at(actor).is_enabled(); }
  
    Snapshot* get_system_state() const { return system_state_.get(); }
    void set_system_state(std::shared_ptr<Snapshot> state) { system_state_ = std::move(state); }
@@@ -568,6 -568,8 +568,8 @@@ set(MC_SRC_STATEFU
    src/mc/explo/udpor/Configuration.cpp
    src/mc/explo/udpor/EventSet.cpp
    src/mc/explo/udpor/EventSet.hpp
+   src/mc/explo/udpor/ExtensionSetCalculator.cpp
+   src/mc/explo/udpor/ExtensionSetCalculator.hpp
    src/mc/explo/udpor/History.cpp
    src/mc/explo/udpor/History.hpp
    src/mc/explo/udpor/maximal_subsets_iterator.cpp
    src/mc/VisitedState.cpp
    src/mc/VisitedState.hpp
    src/mc/compare.cpp
 +  src/mc/mc_environ.h
    src/mc/mc_exit.hpp
    src/mc/mc_forward.hpp
    src/mc/mc_private.hpp
@@@ -1066,7 -1067,6 +1068,7 @@@ set(CMAKE_SOURCE_FILE
    tools/cmake/scripts/update_tesh.pl
    tools/cmake/test_prog/prog_asan.cpp
    tools/cmake/test_prog/prog_makecontext.c
 +  tools/cmake/test_prog/prog_ns3.cpp
    tools/cmake/test_prog/prog_stackgrowth.c
    tools/cmake/test_prog/prog_stacksetup.c
    tools/cmake/test_prog/prog_tsan.cpp