]> AND Public Git Repository - simgrid.git/blobdiff - src/surf/network_cm02.cpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SMPI: add check for buffer size in windows creation (thx MBI)
[simgrid.git] / src / surf / network_cm02.cpp
index 3c24efa9617c9f469d147269f2770a663f9f3228..5f21418e23d9d520922cd6253822e6230863f764 100644 (file)
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_network);
 
+/***********
+ * Options *
+ ***********/
+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 */
@@ -88,7 +95,8 @@ NetworkCm02Model::NetworkCm02Model(const std::string& name) : NetworkModel(name)
     select = true;
   }
 
-  set_maxmin_system(new lmm::System(select));
+  set_maxmin_system(lmm::System::build(cfg_network_solver, select));
+
   loopback_ = create_link("__loopback__", {config::get_value<double>("network/loopback-bw")});
   loopback_->set_sharing_policy(s4u::Link::SharingPolicy::FATPIPE, {});
   loopback_->set_latency(config::get_value<double>("network/loopback-lat"));
@@ -221,12 +229,21 @@ void NetworkCm02Model::comm_action_expand_constraints(const s4u::Host* src, cons
   }
 
   /* WI-FI links needs special treatment, do it here */
-  if (src_wifi_link != nullptr)
-    get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(),
-                                1.0 / src_wifi_link->get_host_rate(src));
-  if (dst_wifi_link != nullptr)
-    get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(),
-                                1.0 / dst_wifi_link->get_host_rate(dst));
+  if (src_wifi_link != nullptr) {
+    /* In case of 0Mbps data rate, don't consider it in the LMM */
+    if (src_wifi_link->get_host_rate(src) > 0)
+      get_maxmin_system()->expand(src_wifi_link->get_constraint(), action->get_variable(),
+                                  1.0 / src_wifi_link->get_host_rate(src));
+    else
+      get_maxmin_system()->update_variable_penalty(action->get_variable(), 0);
+  }
+  if (dst_wifi_link != nullptr) {
+    if (dst_wifi_link->get_host_rate(dst) > 0)
+      get_maxmin_system()->expand(dst_wifi_link->get_constraint(), action->get_variable(),
+                                  1.0 / dst_wifi_link->get_host_rate(dst));
+    else
+      get_maxmin_system()->update_variable_penalty(action->get_variable(), 0);
+  }
 
   for (auto const* link : route) {
     if (link->get_sharing_policy() != s4u::Link::SharingPolicy::WIFI)