Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
mv NetworkAction::rate_ to Action::user_bound_
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 9 Mar 2021 13:46:24 +0000 (14:46 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 9 Mar 2021 13:46:24 +0000 (14:46 +0100)
include/simgrid/kernel/resource/Action.hpp
src/surf/network_cm02.cpp
src/surf/network_interface.hpp

index aad45aa..b6dfc79 100644 (file)
@@ -58,14 +58,36 @@ public:
 class XBT_PUBLIC Action {
   friend ActionHeap;
 
+  int refcount_           = 1;
+  double sharing_penalty_ = 1.0;             /**< priority (1.0 by default) */
+  double max_duration_    = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
+  double remains_;          /**< How much of that cost remains to be done in the currently running task */
+  double start_time_;       /**< start time  */
+  double finish_time_ = -1; /**< finish time (may fluctuate until the task is completed) */
+  std::string category_;    /**< tracing category for categorized resource utilization monitoring */
+
+  double cost_;
+  Model* model_;
+  void* data_                       = nullptr; /**< for your convenience */
+  activity::ActivityImpl* activity_ = nullptr;
+
+  /* LMM */
+  double last_update_      = 0;
+  double last_value_       = 0;
+  lmm::Variable* variable_ = nullptr;
+  double user_bound_       = -1;
+
+  ActionHeap::Type type_                              = ActionHeap::Type::unset;
+  boost::optional<ActionHeap::handle_type> heap_hook_ = boost::none;
+  boost::intrusive::list_member_hook<> modified_set_hook_;
+  boost::intrusive::list_member_hook<> state_set_hook_;
+
 public:
   /* Lazy update needs this Set hook to maintain a list of the tracked actions */
-  boost::intrusive::list_member_hook<> modified_set_hook_;
   bool is_within_modified_set() const { return modified_set_hook_.is_linked(); }
   using ModifiedSet = boost::intrusive::list<
       Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::modified_set_hook_>>;
 
-  boost::intrusive::list_member_hook<> state_set_hook_;
   using StateSet = boost::intrusive::list<
       Action, boost::intrusive::member_hook<Action, boost::intrusive::list_member_hook<>, &Action::state_set_hook_>>;
 
@@ -84,6 +106,11 @@ public:
     SLEEPING
   };
 
+private:
+  StateSet* state_set_;
+  Action::SuspendStates suspended_ = Action::SuspendStates::RUNNING;
+
+public:
   /**
    * @brief Action constructor
    *
@@ -206,36 +233,14 @@ public:
 
   Model* get_model() const { return model_; }
 
-private:
-  StateSet* state_set_;
-  Action::SuspendStates suspended_ = Action::SuspendStates::RUNNING;
-  int refcount_            = 1;
-  double sharing_penalty_          = 1.0;             /**< priority (1.0 by default) */
-  double max_duration_   = NO_MAX_DURATION; /*< max_duration (may fluctuate until the task is completed) */
-  double remains_;           /**< How much of that cost remains to be done in the currently running task */
-  double start_time_;        /**< start time  */
-  double finish_time_ = -1;  /**< finish time (may fluctuate until the task is completed) */
-  std::string category_;     /**< tracing category for categorized resource utilization monitoring */
-
-  double cost_;
-  Model* model_;
-  void* data_                       = nullptr; /**< for your convenience */
-  activity::ActivityImpl* activity_ = nullptr;
-
-  /* LMM */
-  double last_update_      = 0;
-  double last_value_       = 0;
-  lmm::Variable* variable_ = nullptr;
-
-  ActionHeap::Type type_                              = ActionHeap::Type::unset;
-  boost::optional<ActionHeap::handle_type> heap_hook_ = boost::none;
-
-public:
   ActionHeap::Type get_type() const { return type_; }
 
   lmm::Variable* get_variable() const { return variable_; }
   void set_variable(lmm::Variable* var) { variable_ = var; }
 
+  double get_user_bound() const { return user_bound_; }
+  void set_user_bound(double bound) { user_bound_ = bound; }
+
   double get_last_update() const { return last_update_; }
   void set_last_update();
 
index 6ade12e..cc15742 100644 (file)
@@ -218,7 +218,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
     action = new NetworkWifiAction(this, *src, *dst, size, failed, src_wifi_link, dst_wifi_link);
   action->sharing_penalty_  = latency;
   action->latency_ = latency;
-  action->rate_ = rate;
+  action->set_user_bound(rate);
 
   if (is_update_lazy()) {
     action->set_last_update();
@@ -238,7 +238,7 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
 
   action->lat_current_ = action->latency_;
   action->latency_ *= get_latency_factor(size);
-  action->rate_ = get_bandwidth_constraint(action->rate_, bandwidth_bound, size);
+  action->set_user_bound(get_bandwidth_constraint(action->get_user_bound(), bandwidth_bound, size));
 
   size_t constraints_per_variable = route.size();
   constraints_per_variable += back_route.size();
@@ -257,14 +257,14 @@ Action* NetworkCm02Model::communicate(s4u::Host* src, s4u::Host* dst, double siz
   } else
     action->set_variable(get_maxmin_system()->variable_new(action, 1.0, -1.0, constraints_per_variable));
 
-  if (action->rate_ < 0) {
+  if (action->get_user_bound() < 0) {
     get_maxmin_system()->update_variable_bound(
         action->get_variable(), (action->lat_current_ > 0) ? cfg_tcp_gamma / (2.0 * action->lat_current_) : -1.0);
   } else {
     get_maxmin_system()->update_variable_bound(
         action->get_variable(), (action->lat_current_ > 0)
-                                    ? std::min(action->rate_, cfg_tcp_gamma / (2.0 * action->lat_current_))
-                                    : action->rate_);
+                                    ? std::min(action->get_user_bound(), cfg_tcp_gamma / (2.0 * action->lat_current_))
+                                    : action->get_user_bound());
   }
 
   if (src_wifi_link != nullptr)
@@ -388,14 +388,15 @@ LinkImpl* NetworkCm02Link::set_latency(double value)
     auto* action = static_cast<NetworkCm02Action*>(var->get_id());
     action->lat_current_ += delta;
     action->sharing_penalty_ += delta;
-    if (action->rate_ < 0)
+    if (action->get_user_bound() < 0)
       get_model()->get_maxmin_system()->update_variable_bound(action->get_variable(), NetworkModel::cfg_tcp_gamma /
                                                                                           (2.0 * action->lat_current_));
     else {
       get_model()->get_maxmin_system()->update_variable_bound(
-          action->get_variable(), std::min(action->rate_, NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)));
+          action->get_variable(),
+          std::min(action->get_user_bound(), NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)));
 
-      if (action->rate_ < NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)) {
+      if (action->get_user_bound() < NetworkModel::cfg_tcp_gamma / (2.0 * action->lat_current_)) {
         XBT_INFO("Flow is limited BYBANDWIDTH");
       } else {
         XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->lat_current_);
index 0ff7b13..a109c14 100644 (file)
@@ -202,7 +202,7 @@ public:
   double latency_         = 0.; // Delay before the action starts
   double lat_current_     = 0.; // Used to compute the communication RTT, and accordingly limit the communication rate
   double sharing_penalty_ = {};
-  double rate_       = {};
+
   s4u::Host& get_src() const { return src_; }
   s4u::Host& get_dst() const { return dst_; }
 };