Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
migrate wake_all_waiting_actors from simix::Global to kernel::EngineImpl
authorSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 17 May 2021 08:33:14 +0000 (10:33 +0200)
committerSUTER Frederic <frederic.suter@cc.in2p3.fr>
Mon, 17 May 2021 10:52:33 +0000 (12:52 +0200)
src/kernel/EngineImpl.cpp
src/kernel/EngineImpl.hpp
src/simix/smx_global.cpp
src/simix/smx_private.hpp

index b119614..257d84f 100644 (file)
@@ -76,6 +76,27 @@ void EngineImpl::add_model(std::shared_ptr<resource::Model> model, const std::ve
   models_prio_[model_name] = std::move(model);
 }
 
+/** Wake up all actors waiting for a Surf action to finish */
+void EngineImpl::wake_all_waiting_actors() const
+{
+  for (auto const& model : models_) {
+    XBT_DEBUG("Handling the failed actions (if any)");
+    while (auto* action = model->extract_failed_action()) {
+      XBT_DEBUG("   Handling Action %p", action);
+      if (action->get_activity() != nullptr)
+        activity::ActivityImplPtr(action->get_activity())->post();
+    }
+    XBT_DEBUG("Handling the terminated actions (if any)");
+    while (auto* action = model->extract_done_action()) {
+      XBT_DEBUG("   Handling Action %p", action);
+      if (action->get_activity() == nullptr)
+        XBT_DEBUG("probably vcpu's action %p, skip", action);
+      else
+        activity::ActivityImplPtr(action->get_activity())->post();
+    }
+  }
+}
+
 void EngineImpl::run()
 {
   if (MC_record_replay_is_active()) {
@@ -176,7 +197,7 @@ void EngineImpl::run()
 
       simix_global->execute_tasks();
       do {
-        simix_global->wake_all_waiting_actors();
+        wake_all_waiting_actors();
       } while (simix_global->execute_tasks());
 
       /* If only daemon processes remain, cancel their actions, mark them to die and reschedule them */
@@ -204,7 +225,7 @@ void EngineImpl::run()
       again = timer::Timer::execute_all();
       if (simix_global->execute_tasks())
         again = true;
-      simix_global->wake_all_waiting_actors();
+      wake_all_waiting_actors();
     } while (again);
 
     /* Clean actors to destroy */
index 151c9ae..dcce9a6 100644 (file)
@@ -63,6 +63,9 @@ public:
       return res->second;
   }
 
+  void wake_all_waiting_actors() const;
+  void display_all_actor_status() const;
+
   /** @brief Run the main simulation loop. */
   void run();
 };
index 618ee85..a45b862 100644 (file)
@@ -198,27 +198,6 @@ void Global::run_all_actors()
   actors_to_run.clear();
 }
 
-/** Wake up all actors waiting for a Surf action to finish */
-void Global::wake_all_waiting_actors() const
-{
-  for (auto const& model : simgrid::kernel::EngineImpl::get_instance()->get_all_models()) {
-    XBT_DEBUG("Handling the failed actions (if any)");
-    while (auto* action = model->extract_failed_action()) {
-      XBT_DEBUG("   Handling Action %p", action);
-      if (action->get_activity() != nullptr)
-        kernel::activity::ActivityImplPtr(action->get_activity())->post();
-    }
-    XBT_DEBUG("Handling the terminated actions (if any)");
-    while (auto* action = model->extract_done_action()) {
-      XBT_DEBUG("   Handling Action %p", action);
-      if (action->get_activity() == nullptr)
-        XBT_DEBUG("probably vcpu's action %p, skip", action);
-      else
-        kernel::activity::ActivityImplPtr(action->get_activity())->post();
-    }
-  }
-}
-
 void Global::display_all_actor_status() const
 {
   XBT_INFO("%zu actors are still running, waiting for something.", process_list.size());
index 25ef012..d50f70b 100644 (file)
@@ -30,7 +30,6 @@ public:
    */
   void empty_trash();
   void run_all_actors();
-  void wake_all_waiting_actors() const;
   void display_all_actor_status() const;
 
   kernel::context::ContextFactory* context_factory = nullptr;