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

Public GIT Repository
System: fix modified_set_ when selective_update is active
[simgrid.git] / src / surf / ptask_L07.cpp
index 063fe3170c50908e2ed46aca3ddc843f2c2a5c8e..a8deb27fffc20b7dcb3bdae054cb377fa26a18ee 100644 (file)
@@ -7,7 +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"
 
@@ -23,27 +27,43 @@ void surf_host_model_init_ptask_L07()
 {
   XBT_CINFO(xbt_cfg, "Switching to the L07 model to handle parallel tasks.");
 
-  auto host_model = std::make_shared<simgrid::kernel::resource::HostL07Model>("Host_Ptask");
+  auto* system    = simgrid::kernel::lmm::System::build("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()
+{
+#if SIMGRID_HAVE_EIGEN3
+  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    = simgrid::kernel::lmm::System::build("bmf", select);
+  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);
+#else
+  xbt_die("Cannot use the BMF ptask model without installing Eigen3.");
+#endif
+}
+
 namespace simgrid {
 namespace kernel {
 namespace resource {
 
-HostL07Model::HostL07Model(const std::string& name) : HostModel(name)
+HostL07Model::HostL07Model(const std::string& name, lmm::System* sys) : HostModel(name)
 {
-  auto* maxmin_system = new lmm::FairBottleneck(true /* selective update */);
-  set_maxmin_system(maxmin_system);
+  set_maxmin_system(sys);
 
-  auto net_model = std::make_shared<NetworkL07Model>("Network_Ptask", this, maxmin_system);
+  auto net_model = std::make_shared<NetworkL07Model>("Network_Ptask", this, sys);
   auto engine    = EngineImpl::get_instance();
   engine->add_model(net_model);
   engine->get_netzone_root()->set_network_model(net_model);
 
-  auto cpu_model = std::make_shared<CpuL07Model>("Cpu_Ptask", this, maxmin_system);
+  auto cpu_model = std::make_shared<CpuL07Model>("Cpu_Ptask", this, sys);
   engine->add_model(cpu_model);
   engine->get_netzone_root()->set_cpu_pm_model(cpu_model);
 }
@@ -192,8 +212,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(host_list[i]->get_cpu()->get_constraint(), get_variable(),
-                                       (flops_amount == nullptr ? 0.0 : flops_amount[i]));
+    model->get_maxmin_system()->expand_add(host_list[i]->get_cpu()->get_constraint(), get_variable(),
+                                           (flops_amount == nullptr ? 0.0 : flops_amount[i]));
   }
 
   if (bytes_amount != nullptr) {