Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rename ActivityImpl::surf_action_ to ActivityImpl::model_action_
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 18 Feb 2023 09:38:38 +0000 (10:38 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 18 Feb 2023 09:38:38 +0000 (10:38 +0100)
16 files changed:
src/kernel/activity/ActivityImpl.cpp
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/BarrierImpl.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/IoImpl.cpp
src/kernel/activity/MutexImpl.hpp
src/kernel/activity/SemaphoreImpl.cpp
src/kernel/activity/SleepImpl.cpp
src/kernel/activity/Synchro.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/resource/WifiLinkImpl.cpp
src/kernel/resource/models/network_ib.cpp
src/plugins/host_dvfs.cpp
src/plugins/host_load.cpp
src/s4u/s4u_Exec.cpp

index b16a24b..5d7c922 100644 (file)
@@ -44,15 +44,15 @@ void ActivityImpl::unregister_simcall(actor::Simcall* simcall)
 
 void ActivityImpl::clean_action()
 {
-  if (surf_action_) {
-    surf_action_->unref();
-    surf_action_ = nullptr;
+  if (model_action_) {
+    model_action_->unref();
+    model_action_ = nullptr;
   }
 }
 
 double ActivityImpl::get_remaining() const
 {
-  return surf_action_ ? surf_action_->get_remains() : 0;
+  return model_action_ ? model_action_->get_remains() : 0;
 }
 
 const char* ActivityImpl::get_state_str() const
@@ -176,27 +176,27 @@ void ActivityImpl::wait_any_for(actor::ActorImpl* issuer, const std::vector<Acti
 
 void ActivityImpl::suspend()
 {
-  if (surf_action_ == nullptr)
+  if (model_action_ == nullptr)
     return;
-  XBT_VERB("This activity is suspended (remain: %f)", surf_action_->get_remains());
-  surf_action_->suspend();
+  XBT_VERB("This activity is suspended (remain: %f)", model_action_->get_remains());
+  model_action_->suspend();
   s4u::Activity::on_suspended(*get_iface());
 }
 
 void ActivityImpl::resume()
 {
-  if (surf_action_ == nullptr)
+  if (model_action_ == nullptr)
     return;
-  XBT_VERB("This activity is resumed (remain: %f)", surf_action_->get_remains());
-  surf_action_->resume();
+  XBT_VERB("This activity is resumed (remain: %f)", model_action_->get_remains());
+  model_action_->resume();
   s4u::Activity::on_resumed(*get_iface());
 }
 
 void ActivityImpl::cancel()
 {
   XBT_VERB("Activity %p is canceled", this);
-  if (surf_action_ != nullptr)
-    surf_action_->cancel();
+  if (model_action_ != nullptr)
+    model_action_->cancel();
   state_ = State::CANCELED;
 }
 
index ceaea01..d974e29 100644 (file)
@@ -35,8 +35,8 @@ public:
   virtual ~ActivityImpl();
   ActivityImpl() = default;
   std::list<actor::Simcall*> simcalls_; /* List of simcalls waiting for this activity */
-  s4u::Activity* piface_         = nullptr;
-  resource::Action* surf_action_ = nullptr;
+  s4u::Activity* piface_          = nullptr;
+  resource::Action* model_action_ = nullptr; /* The resource consumption in the used model */
 
 protected:
   void inline set_name(std::string_view name)
index be2017b..dd59753 100644 (file)
@@ -33,7 +33,7 @@ public:
   bool test(actor::ActorImpl* issuer = nullptr) override;
   void wait_for(actor::ActorImpl* issuer, double timeout) override;
   void post() override
-  { /*no surf action*/
+  { /* no model action */
   }
   void finish() override;
   void set_exception(actor::ActorImpl* issuer) override
index 27055bc..96439ae 100644 (file)
@@ -121,21 +121,21 @@ CommImpl* CommImpl::start()
 
     /* Getting the network_model from the origin host
      * Valid while we have a single network model, otherwise we would need to change this function to first get the
-     * routes and later create the respective surf actions */
+     * routes and later create the respective model actions */
     auto net_model = from_->get_netpoint()->get_englobing_zone()->get_network_model();
 
-    surf_action_ = net_model->communicate(from_, to_, size_, rate_, false);
-    surf_action_->set_activity(this);
-    surf_action_->set_category(get_tracing_category());
-    set_start_time(surf_action_->get_start_time());
+    model_action_ = net_model->communicate(from_, to_, size_, rate_, false);
+    model_action_->set_activity(this);
+    model_action_->set_category(get_tracing_category());
+    set_start_time(model_action_->get_start_time());
     set_state(State::RUNNING);
     on_start(*this);
 
-    XBT_DEBUG("Starting communication %p from '%s' to '%s' (surf_action: %p; state: %s)", this, from_->get_cname(),
-              to_->get_cname(), surf_action_, get_state_str());
+    XBT_DEBUG("Starting communication %p from '%s' to '%s' (model action: %p; state: %s)", this, from_->get_cname(),
+              to_->get_cname(), model_action_, get_state_str());
 
     /* If a link is failed, detect it immediately */
-    if (surf_action_->get_state() == resource::Action::State::FAILED) {
+    if (model_action_->get_state() == resource::Action::State::FAILED) {
       XBT_DEBUG("Communication from '%s' to '%s' failed to start because of a link failure", from_->get_cname(),
                 to_->get_cname());
       set_state(State::LINK_FAILURE);
@@ -154,7 +154,7 @@ CommImpl* CommImpl::start()
                   "communication",
                   dst_actor_->get_cname(), dst_actor_->get_host()->get_cname());
 
-      surf_action_->suspend();
+      model_action_->suspend();
     }
   }
 
@@ -282,7 +282,7 @@ ActivityImplPtr CommImpl::irecv(actor::CommIrecvSimcall* observer)
     // find a match in the list of already received comms
     other_comm = mbox->find_matching_comm(CommImplType::SEND, observer->get_match_fun(), observer->get_payload(),
                                           this_synchro, /*done*/ true, /*remove_matching*/ true);
-    if (other_comm  && other_comm->surf_action_ && other_comm->get_remaining() < 1e-12) {
+    if (other_comm && other_comm->model_action_ && other_comm->get_remaining() < 1e-12) {
       XBT_DEBUG("comm %p has been already sent, and is finished, destroy it", other_comm.get());
       other_comm->set_state(State::DONE);
       other_comm->set_mailbox(nullptr);
@@ -370,16 +370,16 @@ void CommImpl::wait_any_for(actor::ActorImpl* issuer, const std::vector<CommImpl
 void CommImpl::suspend()
 {
   /* FIXME: shall we suspend also the timeout synchro? */
-  if (surf_action_)
-    surf_action_->suspend();
+  if (model_action_)
+    model_action_->suspend();
   /* if not created yet, the action will be suspended on creation, in CommImpl::start() */
 }
 
 void CommImpl::resume()
 {
   /*FIXME: check what happen with the timeouts */
-  if (surf_action_)
-    surf_action_->resume();
+  if (model_action_)
+    model_action_->resume();
   /* in the other case, the synchro were not really suspended yet, see CommImpl::suspend() and CommImpl::start() */
 }
 
@@ -391,9 +391,9 @@ void CommImpl::cancel()
       mbox_->remove(this);
       set_state(State::CANCELED);
     }
-  } else if (not MC_is_active() /* when running the MC there are no surf actions */
+  } else if (not MC_is_active() /* when running the MC there are no model actions */
              && not MC_record_replay_is_active() && (get_state() == State::READY || get_state() == State::RUNNING)) {
-    surf_action_->cancel();
+    model_action_->cancel();
   }
 }
 
@@ -426,7 +426,7 @@ void CommImpl::post()
     set_state(State::SRC_HOST_FAILURE);
   else if ((to_ && not to_->is_on()) || (dst_timeout_ && dst_timeout_->get_state() == resource::Action::State::FAILED))
     set_state(State::DST_HOST_FAILURE);
-  else if (surf_action_ && surf_action_->get_state() == resource::Action::State::FAILED) {
+  else if (model_action_ && model_action_->get_state() == resource::Action::State::FAILED) {
     set_state(State::LINK_FAILURE);
   } else if (get_state() == State::RUNNING) {
     xbt_assert(from_ && from_->is_on());
@@ -437,7 +437,7 @@ void CommImpl::post()
   XBT_DEBUG("CommImpl::post(): comm %p, state %s, src_proc %p, dst_proc %p, detached: %d", this, get_state_str(),
             src_actor_.get(), dst_actor_.get(), detached_);
 
-  /* destroy the surf actions associated with the Simix communication */
+  /* destroy the model actions associated with the communication activity */
   cleanup_surf();
 
   /* Answer all simcalls associated with the synchro */
index cbbeb72..88432f6 100644 (file)
@@ -81,20 +81,20 @@ ExecImpl* ExecImpl::start()
   if (not MC_is_active() && not MC_record_replay_is_active()) {
     if (get_hosts().size() == 1) {
       if (thread_count_ == 1) {
-        surf_action_ = get_host()->get_cpu()->execution_start(flops_amounts_.front(), bound_);
-        surf_action_->set_sharing_penalty(sharing_penalty_);
+        model_action_ = get_host()->get_cpu()->execution_start(flops_amounts_.front(), bound_);
+        model_action_->set_sharing_penalty(sharing_penalty_);
       } else {
         auto host_model = get_host()->get_netpoint()->get_englobing_zone()->get_host_model();
-        surf_action_    = host_model->execute_thread(get_host(), flops_amounts_.front(), thread_count_);
+        model_action_   = host_model->execute_thread(get_host(), flops_amounts_.front(), thread_count_);
       }
-      surf_action_->set_category(get_tracing_category());
+      model_action_->set_category(get_tracing_category());
     } else {
       // get the model from first host since we have only 1 by now
       auto host_model = get_host()->get_netpoint()->get_englobing_zone()->get_host_model();
-      surf_action_    = host_model->execute_parallel(get_hosts(), flops_amounts_.data(), bytes_amounts_.data(), -1);
+      model_action_   = host_model->execute_parallel(get_hosts(), flops_amounts_.data(), bytes_amounts_.data(), -1);
     }
-    surf_action_->set_activity(this);
-    set_start_time(surf_action_->get_start_time());
+    model_action_->set_activity(this);
+    set_start_time(model_action_->get_start_time());
   }
 
   XBT_DEBUG("Create execute synchro %p: %s", this, get_cname());
@@ -112,7 +112,7 @@ double ExecImpl::get_seq_remaining_ratio()
 {
   if (get_state() == State::WAITING)
     return 1;
-  return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains() / surf_action_->get_cost();
+  return (model_action_ == nullptr) ? 0 : model_action_->get_remains() / model_action_->get_cost();
 }
 
 double ExecImpl::get_par_remaining_ratio()
@@ -120,7 +120,7 @@ double ExecImpl::get_par_remaining_ratio()
   // parallel task: their remain is already between 0 and 1
   if (get_state() == State::WAITING)
     return 1;
-  return (surf_action_ == nullptr) ? 0 : surf_action_->get_remains();
+  return (model_action_ == nullptr) ? 0 : model_action_->get_remains();
 }
 
 ExecImpl& ExecImpl::set_bound(double bound)
@@ -138,24 +138,24 @@ ExecImpl& ExecImpl::set_sharing_penalty(double sharing_penalty)
 ExecImpl& ExecImpl::update_sharing_penalty(double sharing_penalty)
 {
   sharing_penalty_ = sharing_penalty;
-  surf_action_->set_sharing_penalty(sharing_penalty);
+  model_action_->set_sharing_penalty(sharing_penalty);
   return *this;
 }
 
 void ExecImpl::post()
 {
-  xbt_assert(surf_action_ != nullptr);
+  xbt_assert(model_action_ != nullptr);
   if (auto const& hosts = get_hosts();
       std::any_of(hosts.begin(), hosts.end(), [](const s4u::Host* host) { return not host->is_on(); })) {
     /* If one of the hosts running the synchro failed, notice it. This way, the asking
      * process can be killed if it runs on that host itself */
     set_state(State::FAILED);
-  } else if (surf_action_->get_state() == resource::Action::State::FAILED) {
+  } else if (model_action_->get_state() == resource::Action::State::FAILED) {
     /* If all the hosts are running the synchro didn't fail, then the synchro was canceled */
     set_state(State::CANCELED);
   } else if (timeout_detector_ && timeout_detector_->get_state() == resource::Action::State::FINISHED &&
-             surf_action_->get_remains() > 0.0) {
-    surf_action_->set_state(resource::Action::State::FAILED);
+             model_action_->get_remains() > 0.0) {
+    model_action_->set_state(resource::Action::State::FAILED);
     set_state(State::TIMEOUT);
   } else {
     set_state(State::DONE);
@@ -230,7 +230,7 @@ void ExecImpl::reset()
 ActivityImpl* ExecImpl::migrate(s4u::Host* to)
 {
   if (not MC_is_active() && not MC_record_replay_is_active()) {
-    resource::Action* old_action = this->surf_action_;
+    resource::Action* old_action = this->model_action_;
     resource::Action* new_action = to->get_cpu()->execution_start(old_action->get_cost(), old_action->get_user_bound());
     new_action->set_remains(old_action->get_remains());
     new_action->set_activity(this);
@@ -240,7 +240,7 @@ ActivityImpl* ExecImpl::migrate(s4u::Host* to)
     old_action->set_activity(nullptr);
     old_action->cancel();
     old_action->unref();
-    this->surf_action_ = new_action;
+    this->model_action_ = new_action;
   }
 
   on_migration(*this, to);
index 89bd70c..8601126 100644 (file)
@@ -40,7 +40,7 @@ IoImpl& IoImpl::set_sharing_penalty(double sharing_penalty)
 IoImpl& IoImpl::update_sharing_penalty(double sharing_penalty)
 {
   sharing_penalty_ = sharing_penalty;
-  surf_action_->set_sharing_penalty(sharing_penalty);
+  model_action_->set_sharing_penalty(sharing_penalty);
   return *this;
 }
 
@@ -93,16 +93,16 @@ IoImpl* IoImpl::start()
   set_state(State::RUNNING);
   if (dst_host_ == nullptr) {
     XBT_DEBUG("Starting regular I/O");
-    surf_action_ = disk_->io_start(size_, type_);
-    surf_action_->set_sharing_penalty(sharing_penalty_);
+    model_action_ = disk_->io_start(size_, type_);
+    model_action_->set_sharing_penalty(sharing_penalty_);
   } else {
     XBT_DEBUG("Starting streaming I/O");
     auto host_model = dst_host_->get_netpoint()->get_englobing_zone()->get_host_model();
-    surf_action_    = host_model->io_stream(host_, disk_, dst_host_, dst_disk_, size_);
+    model_action_   = host_model->io_stream(host_, disk_, dst_host_, dst_disk_, size_);
   }
 
-  surf_action_->set_activity(this);
-  set_start_time(surf_action_->get_start_time());
+  model_action_->set_activity(this);
+  set_start_time(model_action_->get_start_time());
 
   XBT_DEBUG("Create IO synchro %p %s", this, get_cname());
 
@@ -111,8 +111,8 @@ IoImpl* IoImpl::start()
 
 void IoImpl::post()
 {
-  performed_ioops_ = surf_action_->get_cost();
-  if (surf_action_->get_state() == resource::Action::State::FAILED) {
+  performed_ioops_ = model_action_->get_cost();
+  if (model_action_->get_state() == resource::Action::State::FAILED) {
     if (host_ && dst_host_) { // this is an I/O stream
       if (not host_->is_on())
        set_state(State::SRC_HOST_FAILURE);
@@ -123,8 +123,8 @@ void IoImpl::post()
     else
       set_state(State::CANCELED);
   } else if (timeout_detector_ && timeout_detector_->get_state() == resource::Action::State::FINISHED &&
-             surf_action_->get_remains() > 0.0) {
-    surf_action_->set_state(resource::Action::State::FAILED);
+             model_action_->get_remains() > 0.0) {
+    model_action_->set_state(resource::Action::State::FAILED);
     set_state(State::TIMEOUT);
   } else {
     set_state(State::DONE);
index c7ba205..a614a77 100644 (file)
@@ -51,7 +51,7 @@ public:
   bool test(actor::ActorImpl* issuer = nullptr) override;
   void wait_for(actor::ActorImpl* issuer, double timeout) override;
   void post() override
-  { /*no surf action*/
+  { /* no model action */
   }
   void finish() override;
   void set_exception(actor::ActorImpl* issuer) override
index 5e8016c..2bb6396 100644 (file)
@@ -31,8 +31,8 @@ void SemAcquisitionImpl::wait_for(actor::ActorImpl* issuer, double timeout)
   if (granted_) {
     post();
   } else if (timeout > 0) {
-    surf_action_ = get_issuer()->get_host()->get_cpu()->sleep(timeout);
-    surf_action_->set_activity(this);
+    model_action_ = get_issuer()->get_host()->get_cpu()->sleep(timeout);
+    model_action_->set_activity(this);
 
   } else {
     // Already in the queue
@@ -48,8 +48,8 @@ void SemAcquisitionImpl::finish()
   actor::Simcall* simcall = simcalls_.front();
   simcalls_.pop_front();
 
-  if (surf_action_ != nullptr) { // A timeout was declared
-    if (surf_action_->get_state() == resource::Action::State::FINISHED) { // The timeout elapsed
+  if (model_action_ != nullptr) {                                          // A timeout was declared
+    if (model_action_->get_state() == resource::Action::State::FINISHED) { // The timeout elapsed
       if (granted_) { // but we got the semaphore, just in time!
         set_state(State::DONE);
 
@@ -62,8 +62,8 @@ void SemAcquisitionImpl::finish()
         observer->set_result(true);
       }
     }
-    surf_action_->unref();
-    surf_action_ = nullptr;
+    model_action_->unref();
+    model_action_ = nullptr;
   }
 
   simcall->issuer_->waiting_synchro_ = nullptr;
index 0dac2a7..5c5b88b 100644 (file)
@@ -27,20 +27,20 @@ SleepImpl& SleepImpl::set_duration(double duration)
 
 SleepImpl* SleepImpl::start()
 {
-  surf_action_ = host_->get_cpu()->sleep(duration_);
-  surf_action_->set_activity(this);
+  model_action_ = host_->get_cpu()->sleep(duration_);
+  model_action_->set_activity(this);
   XBT_DEBUG("Create sleep synchronization %p", this);
   return this;
 }
 
 void SleepImpl::post()
 {
-  if (surf_action_->get_state() == resource::Action::State::FAILED) {
+  if (model_action_->get_state() == resource::Action::State::FAILED) {
     if (host_ && not host_->is_on())
       set_state(State::SRC_HOST_FAILURE);
     else
       set_state(State::CANCELED);
-  } else if (surf_action_->get_state() == resource::Action::State::FINISHED) {
+  } else if (model_action_->get_state() == resource::Action::State::FINISHED) {
     set_state(State::DONE);
   }
 
index c15f155..2067f07 100644 (file)
@@ -28,8 +28,8 @@ SynchroImpl& SynchroImpl::set_timeout(double timeout)
 
 SynchroImpl* SynchroImpl::start()
 {
-  surf_action_ = host_->get_cpu()->sleep(timeout_);
-  surf_action_->set_activity(this);
+  model_action_ = host_->get_cpu()->sleep(timeout_);
+  model_action_->set_activity(this);
   return this;
 }
 
@@ -51,9 +51,9 @@ void SynchroImpl::cancel()
 
 void SynchroImpl::post()
 {
-  if (surf_action_->get_state() == resource::Action::State::FAILED)
+  if (model_action_->get_state() == resource::Action::State::FAILED)
     set_state(State::FAILED);
-  else if (surf_action_->get_state() == resource::Action::State::FINISHED)
+  else if (model_action_->get_state() == resource::Action::State::FINISHED)
     set_state(State::SRC_TIMEOUT);
 
   clean_action();
index 8b0ccf7..c252e33 100644 (file)
@@ -357,12 +357,12 @@ activity::ActivityImplPtr ActorImpl::join(const ActorImpl* actor, double timeout
 {
   activity::ActivityImplPtr sleep_activity = this->sleep(timeout);
   if (actor->wannadie() || actor->to_be_freed()) {
-    if (sleep_activity->surf_action_)
-      sleep_activity->surf_action_->finish(resource::Action::State::FINISHED);
+    if (sleep_activity->model_action_)
+      sleep_activity->model_action_->finish(resource::Action::State::FINISHED);
   } else {
     actor->on_exit->emplace_back([sleep_activity](bool) {
-      if (sleep_activity->surf_action_)
-        sleep_activity->surf_action_->finish(resource::Action::State::FINISHED);
+      if (sleep_activity->model_action_)
+        sleep_activity->model_action_->finish(resource::Action::State::FINISHED);
     });
   }
   return sleep_activity;
index 7b85949..0d5ed17 100644 (file)
@@ -81,7 +81,7 @@ void WifiLinkImpl::dec_active_flux()
 
 void WifiLinkImpl::update_bw_comm_start(const kernel::activity::CommImpl& comm)
 {
-  auto const* actionWifi = dynamic_cast<const simgrid::kernel::resource::WifiLinkAction*>(comm.surf_action_);
+  auto const* actionWifi = dynamic_cast<const simgrid::kernel::resource::WifiLinkAction*>(comm.model_action_);
   if (actionWifi == nullptr)
     return;
 
index 75b454b..56dabbb 100644 (file)
@@ -72,7 +72,7 @@ void NetworkIBModel::IB_action_state_changed_callback(NetworkAction& action, Act
 
 void NetworkIBModel::IB_comm_start_callback(const activity::CommImpl& comm)
 {
-  auto* action  = static_cast<NetworkAction*>(comm.surf_action_);
+  auto* action  = static_cast<NetworkAction*>(comm.model_action_);
   auto* ibModel = static_cast<NetworkIBModel*>(action->get_model());
   auto* act_src = &ibModel->active_nodes.at(action->get_src().get_name());
   auto* act_dst = &ibModel->active_nodes.at(action->get_dst().get_name());
index 242aca2..c152cc5 100644 (file)
@@ -307,7 +307,7 @@ public:
     // FIXME I think that this fires at the same time for all hosts, so when the src sends something,
     // the dst will be notified even though it didn't even arrive at the recv yet
     kernel::activity::CommImpl::on_start.connect([this](const kernel::activity::CommImpl& comm) {
-      const auto* act = static_cast<kernel::resource::NetworkAction*>(comm.surf_action_);
+      const auto* act = static_cast<kernel::resource::NetworkAction*>(comm.model_action_);
       if ((get_host() == &act->get_src() || get_host() == &act->get_dst()) && iteration_running) {
         post_task();
       }
index 2ea7c47..6479b3a 100644 (file)
@@ -124,7 +124,7 @@ void HostLoad::update()
   while (iter != end(current_activities)) {
     auto& activity                         = iter->first;  // Just an alias
     auto& remaining_cost_after_last_update = iter->second; // Just an alias
-    auto& action                           = activity->surf_action_;
+    auto& action                           = activity->model_action_;
     auto current_iter                      = iter;
     ++iter;
 
index 597120e..9ea3b10 100644 (file)
@@ -221,7 +221,7 @@ ExecPtr Exec::unset_host()
 
 double Exec::get_cost() const
 {
-  return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_cost();
+  return (pimpl_->model_action_ == nullptr) ? -1 : pimpl_->model_action_->get_cost();
 }
 
 double Exec::get_remaining() const