Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Cleanups around network/latency-factor. Default latency of Cste model is 1 again
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 22 Oct 2022 19:56:37 +0000 (21:56 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 22 Oct 2022 19:56:42 +0000 (21:56 +0200)
Default latency was accidentally the latency factor of LV_08

examples/c/comm-pingpong/comm-pingpong.tesh
examples/cpp/comm-pingpong/s4u-comm-pingpong.tesh
src/instr/instr_platform.cpp
src/kernel/resource/NetworkModel.cpp
src/kernel/resource/NetworkModel.hpp
src/simgrid/sg_config.cpp
src/surf/network_cm02.cpp
src/surf/network_constant.cpp
src/surf/surf_interface.hpp

index b12b9ed..4040d9b 100644 (file)
@@ -47,9 +47,9 @@ $ ${bindir:=.}/c-comm-pingpong ${platfdir}/small_platform_routing_none.xml comm-
 > [  0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Constant'
 > [  0.000000] (1:pinger@Tremblay) Ping from mailbox Mailbox 1 to mailbox Mailbox 2
 > [  0.000000] (2:ponger@Jupiter) Pong from mailbox Mailbox 2 to mailbox Mailbox 1
-> [ 13.010000] (2:ponger@Jupiter) Task received : small communication (latency bound)
-> [ 13.010000] (2:ponger@Jupiter)  Ping time (latency bound) 13.010000
-> [ 13.010000] (2:ponger@Jupiter) task_bw->data = 13.010
-> [ 26.020000] (1:pinger@Tremblay) Task received : large communication (bandwidth bound)
-> [ 26.020000] (1:pinger@Tremblay) Pong time (bandwidth bound): 13.010
-> [ 26.020000] (0:maestro@) Total simulation time: 26.020
+> [  1.000000] (2:ponger@Jupiter) Task received : small communication (latency bound)
+> [  1.000000] (2:ponger@Jupiter)  Ping time (latency bound) 1.000000
+> [  1.000000] (2:ponger@Jupiter) task_bw->data = 1.000
+> [  2.000000] (1:pinger@Tremblay) Task received : large communication (bandwidth bound)
+> [  2.000000] (1:pinger@Tremblay) Pong time (bandwidth bound): 1.000
+> [  2.000000] (0:maestro@) Total simulation time: 2.000
index f4ced5d..05bcfe2 100644 (file)
@@ -47,9 +47,9 @@ $ ${bindir:=.}/s4u-comm-pingpong ${platfdir}/small_platform_routing_none.xml "--
 > [  0.000000] (0:maestro@) Configuration change: Set 'network/model' to 'Constant'
 > [  0.000000] (1:pinger@Tremblay) Ping from mailbox Mailbox 1 to mailbox Mailbox 2
 > [  0.000000] (2:ponger@Jupiter) Pong from mailbox Mailbox 2 to mailbox Mailbox 1
-> [ 13.010000] (2:ponger@Jupiter) Payload received : small communication (latency bound)
-> [ 13.010000] (2:ponger@Jupiter) Ping time (latency bound) 13.010000
-> [ 13.010000] (2:ponger@Jupiter) payload = 13.010
-> [ 26.020000] (1:pinger@Tremblay) Payload received : large communication (bandwidth bound)
-> [ 26.020000] (1:pinger@Tremblay) Pong time (bandwidth bound): 13.010
-> [ 26.020000] (0:maestro@) Total simulation time: 26.020
+> [  1.000000] (2:ponger@Jupiter) Payload received : small communication (latency bound)
+> [  1.000000] (2:ponger@Jupiter) Ping time (latency bound) 1.000000
+> [  1.000000] (2:ponger@Jupiter) payload = 1.000
+> [  2.000000] (1:pinger@Tremblay) Payload received : large communication (bandwidth bound)
+> [  2.000000] (1:pinger@Tremblay) Pong time (bandwidth bound): 1.000
+> [  2.000000] (0:maestro@) Total simulation time: 2.000
index 0db7a14..fc0117d 100644 (file)
@@ -450,7 +450,7 @@ void define_callbacks()
     s4u::Link::on_bandwidth_change_cb([](s4u::Link const& link) {
       Container::by_name(link.get_name())
           ->get_variable("bandwidth")
-          ->set_event(simgrid_get_clock(), sg_bandwidth_factor * link.get_bandwidth());
+          ->set_event(simgrid_get_clock(), kernel::resource::NetworkModel::cfg_bandwidth_factor * link.get_bandwidth());
     });
     s4u::NetZone::on_seal_cb([](s4u::NetZone const& /*netzone*/) { currentContainer.pop_back(); });
     kernel::routing::NetPoint::on_creation.connect([](kernel::routing::NetPoint const& netpoint) {
index 01ded58..dd3da13 100644 (file)
@@ -22,6 +22,8 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(res_network, ker_resource, "Network resources, t
  *********/
 
 namespace simgrid::kernel::resource {
+double NetworkModel::cfg_latency_factor   = 1.0; // default value
+double NetworkModel::cfg_bandwidth_factor = 1.0; // default value
 
 /** @brief Command-line option 'network/TCP-gamma' -- see @ref options_model_network_gamma */
 config::Flag<double> NetworkModel::cfg_tcp_gamma(
index 833cc1e..cbfa9b1 100644 (file)
@@ -26,6 +26,8 @@ class NetworkModel : public Model, public NetworkModelIntf {
 public:
   static config::Flag<double> cfg_tcp_gamma;
   static config::Flag<bool> cfg_crosstraffic;
+  static double cfg_latency_factor;
+  static double cfg_bandwidth_factor;
 
   using Model::Model;
   NetworkModel(const NetworkModel&) = delete;
@@ -63,7 +65,7 @@ public:
    * @param size The size of the message.
    * @return The latency factor.
    */
-  virtual double get_latency_factor(double /* size */) { return sg_latency_factor; }
+  virtual double get_latency_factor(double /* size */) { return cfg_latency_factor; }
 
   /**
    * @brief Get the right multiplicative factor for the bandwidth.
@@ -74,7 +76,7 @@ public:
    * @param size The size of the message.
    * @return The bandwidth factor.
    */
-  virtual double get_bandwidth_factor(double /* size*/) { return sg_bandwidth_factor; }
+  virtual double get_bandwidth_factor(double /* size*/) { return cfg_bandwidth_factor; }
 
   double next_occurring_event_full(double now) override;
 
index 415f267..23d1edd 100644 (file)
@@ -15,6 +15,7 @@
 #include "src/internal_config.h"
 #include "src/kernel/context/Context.hpp"
 #include "src/kernel/lmm/maxmin.hpp"
+#include "src/kernel/resource/NetworkModel.hpp"
 #include "src/mc/mc_config.hpp"
 #include "src/mc/mc_replay.hpp"
 #include "src/smpi/include/smpi_config.hpp"
@@ -271,13 +272,11 @@ void sg_config_init(int *argc, char **argv)
 
   /* The parameters of network models */
 
-  sg_latency_factor = 13.01; // comes from the default LV08 network model
-  simgrid::config::bind_flag(sg_latency_factor, "network/latency-factor",
+  simgrid::config::bind_flag(simgrid::kernel::resource::NetworkModel::cfg_latency_factor, "network/latency-factor",
                              "Correction factor to apply to the provided latency (default value set by network model)");
 
-  sg_bandwidth_factor = 0.97; // comes from the default LV08 network model
   simgrid::config::bind_flag(
-      sg_bandwidth_factor, "network/bandwidth-factor",
+      simgrid::kernel::resource::NetworkModel::cfg_bandwidth_factor, "network/bandwidth-factor",
       "Correction factor to apply to the provided bandwidth (default value set by network model)");
 
   sg_weight_S_parameter = 20537; // comes from the default LV08 network model
index 73e4ba8..159d606 100644 (file)
@@ -26,8 +26,6 @@ static simgrid::config::Flag<std::string> cfg_network_solver("network/solver",
                                                              "Set linear equations solver used by network model",
                                                              "maxmin", &simgrid::kernel::lmm::System::validate_solver);
 
-double sg_latency_factor     = 1.0; /* default value; can be set by model or from command line */
-double sg_bandwidth_factor   = 1.0; /* default value; can be set by model or from command line */
 double sg_weight_S_parameter = 0.0; /* default value; can be set by model or from command line */
 
 /************************************************************************/
index c811874..4e2371c 100644 (file)
@@ -61,7 +61,7 @@ void NetworkConstantModel::update_actions_state(double /*now*/, double delta)
         action.latency_ = 0.0;
       }
     }
-    action.update_remains(action.get_cost() * delta / sg_latency_factor);
+    action.update_remains(action.get_cost() * delta / cfg_latency_factor);
     action.update_max_duration(delta);
 
     if ((action.get_remains_no_update() <= 0) ||
@@ -82,7 +82,7 @@ Action* NetworkConstantModel::communicate(s4u::Host* src, s4u::Host* dst, double
 NetworkConstantAction::NetworkConstantAction(NetworkConstantModel* model_, s4u::Host& src, s4u::Host& dst, double size)
     : NetworkAction(model_, src, dst, size, false)
 {
-  latency_ = sg_latency_factor;
+  latency_ = NetworkModel::cfg_latency_factor;
   if (latency_ <= 0.0)
     set_state(Action::State::FINISHED);
 }
index 2cdc8f4..c7cd906 100644 (file)
@@ -30,8 +30,6 @@ XBT_PUBLIC_DATA double sg_maxmin_precision;
 XBT_PUBLIC_DATA double sg_surf_precision;
 XBT_PUBLIC_DATA int sg_concurrency_limit;
 
-extern XBT_PRIVATE double sg_latency_factor;
-extern XBT_PRIVATE double sg_bandwidth_factor;
 extern XBT_PRIVATE double sg_weight_S_parameter;
 extern XBT_PRIVATE std::vector<std::string> surf_path;
 extern XBT_PRIVATE std::unordered_map<std::string, simgrid::kernel::profile::Profile*> traces_set_list;