Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'add_missing_comm_python_bindings' into 'master'
[simgrid.git] / src / surf / ptask_L07.cpp
index 9039cff..a7030b9 100644 (file)
@@ -7,8 +7,11 @@
 #include <simgrid/s4u/Engine.hpp>
 #include <xbt/config.hpp>
 
+#include "simgrid/config.h"
 #include "src/kernel/EngineImpl.hpp"
+#if SIMGRID_HAVE_EIGEN3
 #include "src/kernel/lmm/bmf.hpp"
+#endif
 #include "src/kernel/resource/profile/Event.hpp"
 #include "src/surf/ptask_L07.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(res_host);
 XBT_LOG_EXTERNAL_CATEGORY(xbt_cfg);
 
+/***********
+ * Options *
+ ***********/
+static simgrid::config::Flag<std::string> cfg_ptask_solver("host/solver",
+                                                           "Set linear equations solver used by ptask model",
+                                                           "fairbottleneck",
+                                                           &simgrid::kernel::lmm::System::validate_solver);
+
 /**************************************/
 /*** Resource Creation & Destruction **/
 /**************************************/
 void surf_host_model_init_ptask_L07()
 {
   XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
+  xbt_assert(cfg_ptask_solver != "maxmin", "Invalid configuration. Cannot use maxmin solver with parallel tasks.");
 
-  auto* system    = new simgrid::kernel::lmm::FairBottleneck(true /* selective update */);
-  auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask", system);
-  auto* engine    = simgrid::kernel::EngineImpl::get_instance();
-  engine->add_model(host_model);
-  engine->get_netzone_root()->set_host_model(host_model);
-}
-
-void surf_host_model_init_ptask_BMF()
-{
-  XBT_CINFO(xbt_cfg, "Switching to the BMF model to handle parallel tasks.");
-
-  bool select     = simgrid::config::get_value<bool>("bmf/selective-update");
-  auto* system    = new simgrid::kernel::lmm::BmfSystem(select);
+  auto* system    = simgrid::kernel::lmm::System::build(cfg_ptask_solver, true /* selective update */);
   auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask", system);
   auto* engine    = simgrid::kernel::EngineImpl::get_instance();
   engine->add_model(host_model);
@@ -205,8 +205,8 @@ L07Action::L07Action(Model* model, const std::vector<s4u::Host*>& host_list, con
   /* Expand it for the CPUs even if there is nothing to compute, to make sure that it gets expended even if there is no
    * communication either */
   for (size_t i = 0; i < host_list.size(); i++) {
-    model->get_maxmin_system()->expand_add(host_list[i]->get_cpu()->get_constraint(), get_variable(),
-                                           (flops_amount == nullptr ? 0.0 : flops_amount[i]));
+    model->get_maxmin_system()->expand(host_list[i]->get_cpu()->get_constraint(), get_variable(),
+                                       (flops_amount == nullptr ? 0.0 : flops_amount[i]));
   }
 
   if (bytes_amount != nullptr) {
@@ -217,7 +217,7 @@ L07Action::L07Action(Model* model, const std::vector<s4u::Host*>& host_list, con
       hostList_[k / host_list.size()]->route_to(hostList_[k % host_list.size()], route, nullptr);
 
       for (auto const& link : route)
-        model->get_maxmin_system()->expand_add(link->get_constraint(), this->get_variable(), bytes_amount[k]);
+        model->get_maxmin_system()->expand(link->get_constraint(), this->get_variable(), bytes_amount[k]);
     }
   }