Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove bmf host model. Add it as an option.
authorBruno Donassolo <bruno.donassolo@inria.fr>
Fri, 18 Mar 2022 09:32:06 +0000 (10:32 +0100)
committerBruno Donassolo <bruno.donassolo@inria.fr>
Fri, 18 Mar 2022 09:32:06 +0000 (10:32 +0100)
Remove --cfg=host/model:ptask_BMF.
Use --cfg=host/model:ptask_L07 --cfg=host/solver:bmf instead.

More consistent with other models (CPU, disk, etc)

ChangeLog
docs/source/Configuring_SimGrid.rst
src/kernel/lmm/bmf.cpp
src/surf/ptask_L07.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
teshsuite/models/ptask-subflows/ptask-subflows.tesh

index 70839ce..c3c960c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -45,19 +45,19 @@ New plugin: the Chaos Monkey (killing actors at any time)
    but some users may find it interesting too.
 
 Models:
- - New model for parallel task: ptask_BMF.
-   - More realistic sharing of heterogeneous resources compared to ptask_L07.
+ - New solver for parallel task: BMF.
+   - More realistic sharing of heterogeneous resources compared to the fair
+   bottleneck solver used by ptask_L07.
    - Implement the BMF (Bottleneck max fairness) fairness.
    - Improved resource sharing for parallel tasks with sub-flows (parallel
      communications between same source and destination inside the ptask).
    - Parameters:
-     - "--cfg=host/model:ptask_BMF": enable the model.
+     - "--cfg=host/model:ptask_L07 --cfg=host/solver:bmf": enable the ptask
+        model with BMF solver.
      - "--cfg=bmf/max-iterations: <N>": maximum number of iterations performed
         by BMF solver (default: 1000).
-     - "--cfg=bmf/selective-update:<true/false>": enable/disable the
-      selective-update optimization. Only invalidates and recomputes modified
-      parts of inequations system. May speed up simulation if sparse resource
-      utilization (default: false).
+     - "--cfg=bmf/precision: <N>": numerical precision used when computing
+        resource sharing (default: 1e-12).
    - This model requires Eigen3 library. Make sure Eigen3 is installed to use BMF.
 
 General:
index fcd52dd..f8d9242 100644 (file)
@@ -251,9 +251,6 @@ models for all existing resources.
   - **ptask_L07:** Host model somehow similar to Cas01+CM02 but
     allowing "parallel tasks", that are intended to model the moldable
     tasks of the grid scheduling literature.
-  - **ptask_BMF:** More realistic model for heterogeneous resource sharing.
-    Implements BMF (Bottleneck max fairness) fairness. To be used with
-    parallel tasks instead of ptask_L07.
 
 - ``storage/model``: specify the used storage model. Only one model is
   provided so far.
@@ -262,12 +259,32 @@ models for all existing resources.
 
 .. todo: make 'compound' the default host model.
 
+.. _options_model_solver:
+
+Solver
+......
+
+The different models rely on a linear inequalities solver to share
+the underlying resources. SimGrid allows you to change the solver, but
+be cautious, **don't change it unless you are 100% sure**.
+  - items ``cpu/solver``, ``network/solver``, ``disk/solver`` and  ``host/solver``
+    allow you to change the solver for each model:
+
+    - **maxmin:** The default solver for all models except ptask. Provides a
+      max-min fairness allocation.
+    - **fairbottleneck:** The default solver for ptasks. Extends max-min to
+      allow heterogeneous resources.
+    - **bmf:** More realistic solver for heterogeneous resource sharing.
+      Implements BMF (Bottleneck max fairness) fairness. To be used with
+      parallel tasks instead of fair-bottleneck.
+
 .. _options_model_optim:
 
 Optimization Level
 ..................
 
-The network and CPU models that are based on lmm_solve (that
+The network and CPU models that are based on linear inequalities solver (that
 is, all our analytical models) accept specific optimization
 configurations.
 
index a5d7f53..e7ce968 100644 (file)
@@ -17,10 +17,6 @@ simgrid::config::Flag<int>
     cfg_bmf_max_iteration("bmf/max-iterations",
                           "Maximum number of steps to be performed while searching for a BMF allocation", 1000);
 
-simgrid::config::Flag<bool> cfg_bmf_selective_update{
-    "bmf/selective-update", "Update the constraint set propagating recursively to others constraints (off by default)",
-    false};
-
 simgrid::config::Flag<double> cfg_bmf_precision{"bmf/precision",
                                                 "Numerical precision used when computing resource sharing", 1E-12};
 
@@ -406,7 +402,7 @@ Eigen::VectorXd BmfSolver::solve()
     fprintf(stderr, "Unable to find a BMF allocation for your system.\n"
                     "You may try to increase the maximum number of iterations performed by BMF solver "
                     "(\"--cfg=bmf/max-iterations\").\n"
-                    "Additionally, you could decrease numerical precision (\"--cfg=bmf/precision\").\n");
+                    "Additionally, you could adjust numerical precision (\"--cfg=bmf/precision\").\n");
     fprintf(stderr, "Internal states (after %d iterations):\n", it);
     fprintf(stderr, "A:\n%s\n", debug_eigen(A_).c_str());
     fprintf(stderr, "maxA:\n%s\n", debug_eigen(maxA_).c_str());
index a8deb27..88e2fff 100644 (file)
 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    = simgrid::kernel::lmm::System::build("fairbottleneck", true /* selective update */);
+  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);
   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 {
index f7be890..766f547 100644 (file)
@@ -81,8 +81,6 @@ const std::vector<surf_model_description_t> surf_host_model_description = {
      &surf_host_model_init_compound},
     {"ptask_L07", "Host model somehow similar to Cas01+CM02 but allowing parallel tasks",
      &surf_host_model_init_ptask_L07},
-    {"ptask_BMF", "Host model which implements BMF resource allocation and allows parallel tasks",
-     &surf_host_model_init_ptask_BMF},
 };
 
 const std::vector<surf_model_description_t> surf_optimization_mode_description = {
index 95d9ace..2cdc8f4 100644 (file)
@@ -182,14 +182,6 @@ XBT_PUBLIC void surf_host_model_init_current_default();
  */
 XBT_PUBLIC void surf_host_model_init_ptask_L07();
 
-/** @ingroup SURF_models
- *  @brief Initializes the platform with the model BMF
- *
- *  With this model, only parallel tasks can be used.
- *  Resource sharing is done by calculating a BMF (bottleneck max fairness) allocation
- */
-XBT_PUBLIC void surf_host_model_init_ptask_BMF();
-
 XBT_PUBLIC void surf_disk_model_init_default();
 
 /* --------------------
index de5fe7f..f5e5094 100644 (file)
@@ -1,7 +1,8 @@
 p Test subflows with new BMF model
-$ ${bindir:=.}/ptask-subflows --cfg=host/model:ptask_BMF
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'host/model' to 'ptask_BMF'
-> [0.000000] [xbt_cfg/INFO] Switching to the BMF model to handle parallel tasks.
+$ ${bindir:=.}/ptask-subflows --cfg=host/model:ptask_L07 --cfg=host/solver:bmf
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'host/model' to 'ptask_L07'
+> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'host/solver' to 'bmf'
+> [0.000000] [xbt_cfg/INFO] Switching to the L07 model to handle parallel tasks.
 > [hostA:ptask:(1) 0.000000] [ptask_subflows_test/INFO] TEST: 1 parallel task with 2 flows
 > [hostA:ptask:(1) 0.000000] [ptask_subflows_test/INFO] Parallel task sends 1.5B to other host.
 > [hostA:ptask:(1) 0.000000] [ptask_subflows_test/INFO] Same result for L07 and BMF since the ptask is alone.
@@ -30,20 +31,3 @@ $ ${bindir:=.}/ptask-subflows --cfg=host/model:ptask_L07
 > [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] With L07: Should be done in 4 seconds: 1s latency and 3 second for transfer.
 > [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] With BMF, ptask gets 50% more bandwidth than the noisy flow (because of the sub).
 > [hostA:ptask:(1) 6.500000] [ptask_subflows_test/INFO] Parallel task finished after 4.000000 seconds
-
-p Test selective_update enable
-$ ${bindir:=.}/ptask-subflows --cfg=host/model:ptask_BMF --cfg=bmf/selective-update:true
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'host/model' to 'ptask_BMF'
-> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'bmf/selective-update' to 'true'
-> [0.000000] [xbt_cfg/INFO] Switching to the BMF model to handle parallel tasks.
-> [hostA:ptask:(1) 0.000000] [ptask_subflows_test/INFO] TEST: 1 parallel task with 2 flows
-> [hostA:ptask:(1) 0.000000] [ptask_subflows_test/INFO] Parallel task sends 1.5B to other host.
-> [hostA:ptask:(1) 0.000000] [ptask_subflows_test/INFO] Same result for L07 and BMF since the ptask is alone.
-> [hostA:ptask:(1) 0.000000] [ptask_subflows_test/INFO] Should be done in 2.5 seconds: 1s latency and 1.5 second for transfer
-> [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] Parallel task finished after 2.500000 seconds
-> [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] TEST: Same parallel task but with a noisy communication at the side
-> [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] Parallel task sends 1.5B to other host.
-> [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] With BMF: Should be done in 3.5 seconds: 1s latency and 2 second for transfer.
-> [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] With L07: Should be done in 4 seconds: 1s latency and 3 second for transfer.
-> [hostA:ptask:(1) 2.500000] [ptask_subflows_test/INFO] With BMF, ptask gets 50% more bandwidth than the noisy flow (because of the sub).
-> [hostA:ptask:(1) 6.000000] [ptask_subflows_test/INFO] Parallel task finished after 3.500000 seconds