Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Objectify the model containers
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 14 Feb 2023 20:12:10 +0000 (21:12 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Tue, 14 Feb 2023 21:29:41 +0000 (22:29 +0100)
This should allow further cleanups in the near future, where models
are handled as the plugins already are: no shotgun design anymore with
the registration, and everything about a given model contained in a
single file.

src/kernel/routing/NetZoneImpl.cpp
src/plugins/chaos_monkey.cpp
src/plugins/host_load.cpp
src/plugins/link_load.cpp
src/simgrid/module.cpp [new file with mode: 0644]
src/simgrid/module.hpp [new file with mode: 0644]
src/simgrid/sg_config.cpp
src/surf/surf_interface.cpp
src/surf/surf_interface.hpp
tools/cmake/DefinePackages.cmake

index b40e8e2..7e872a4 100644 (file)
@@ -45,24 +45,16 @@ static void surf_config_models_setup()
     xbt_enforce(not disk_model_name.empty(), "Set a disk model to use with the 'compound' host model");
     xbt_enforce(not network_model_name.empty(), "Set a network model to use with the 'compound' host model");
 
-    const auto* cpu_model = find_model_description(surf_cpu_model_description, cpu_model_name);
-    cpu_model->model_init_preparse();
-
-    const auto* disk_model = find_model_description(surf_disk_model_description, disk_model_name);
-    disk_model->model_init_preparse();
-
-    const auto* network_model = find_model_description(surf_network_model_description, network_model_name);
-    network_model->model_init_preparse();
+    surf_cpu_model_description.by_name(cpu_model_name).init();
+    surf_disk_model_description.by_name(disk_model_name).init();
+    surf_network_model_description.by_name(network_model_name).init();
   }
 
-  XBT_DEBUG("Call host_model_init");
-  const auto* host_model = find_model_description(surf_host_model_description, host_model_name);
-  host_model->model_init_preparse();
+  surf_host_model_description.by_name(host_model_name).init();
 
   XBT_DEBUG("Call vm_model_init");
-  /* ideally we should get back the pointer to CpuModel from model_init_preparse(), but this
-   * requires changing the declaration of surf_cpu_model_description.
-   * To be reviewed in the future */
+  /* TODO: ideally we should get back the pointer to CpuModel from init(), but this
+   * requires changing the declaration of surf_cpu_model_description. */
   surf_vm_model_init_HL13(
       simgrid::s4u::Engine::get_instance()->get_netzone_root()->get_impl()->get_cpu_pm_model().get());
 }
index 0e0938f..45f4df6 100644 (file)
@@ -10,7 +10,7 @@
 #include <simgrid/s4u/Host.hpp>
 #include <xbt/config.hpp>
 
-#include "src/surf/surf_interface.hpp" // SIMGRID_REGISTER_PLUGIN
+#include "src/simgrid/module.hpp" // SIMGRID_REGISTER_PLUGIN
 
 namespace sg4 = simgrid::s4u;
 static simgrid::config::Flag<bool> cfg_tell{"cmonkey/tell", "Request the Chaos Monkey to display all timestamps",
index 6c926ad..2ea7c47 100644 (file)
@@ -10,7 +10,7 @@
 #include <simgrid/s4u/VirtualMachine.hpp>
 
 #include "src/kernel/activity/ExecImpl.hpp"
-#include "src/surf/surf_interface.hpp"
+#include "src/simgrid/module.hpp" // SIMGRID_REGISTER_PLUGIN
 
 // Makes sure that this plugin can be activated from the command line with ``--cfg=plugin:host_load``
 SIMGRID_REGISTER_PLUGIN(host_load, "Cpu load", &sg_host_load_plugin_init)
@@ -32,7 +32,7 @@ It attaches an extension to each host to store some data, and places callbacks i
   @endrst
 */
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(host_load, kernel, "Logging specific to the HostLoad plugin");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(host_load, plugin, "Logging specific to the HostLoad plugin");
 
 namespace simgrid::plugin {
 
index 025c83f..1afdd6e 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/kernel/resource/NetworkModel.hpp"
+#include "src/simgrid/module.hpp" // SIMGRID_REGISTER_PLUGIN
 
 #include <limits>
 
diff --git a/src/simgrid/module.cpp b/src/simgrid/module.cpp
new file mode 100644 (file)
index 0000000..2489171
--- /dev/null
@@ -0,0 +1,124 @@
+/* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#include <xbt/asserts.h>
+#include <xbt/log.h>
+
+#include "src/simgrid/module.hpp"
+#include "src/surf/surf_interface.hpp"
+
+#include <sstream>
+
+XBT_LOG_NEW_CATEGORY(plugin, "Common category for the logging of all plugins");
+XBT_LOG_EXTERNAL_CATEGORY(xbt_help);
+
+using namespace simgrid;
+
+ModuleGroup& ModuleGroup::add(const char* id, const char* desc, std::function<void()> init)
+{
+  table_.emplace_back(Module(id, desc, init));
+  return *this;
+}
+
+Module const& ModuleGroup::by_name(const std::string& name) const
+{
+  if (auto pos = std::find_if(table_.begin(), table_.end(), [&name](const Module& item) { return item.name_ == name; });
+      pos != table_.end())
+    return *pos;
+
+  xbt_die("Unable to find %s '%s'. Valid values are: %s.", kind_.c_str(), name.c_str(), existing_values().c_str());
+}
+/** Displays the long description of all registered models, and quit */
+void ModuleGroup::help() const
+{
+  XBT_HELP("Long description of the %s accepted by this simulator:", kind_.c_str());
+  for (auto const& item : table_)
+    XBT_HELP("  %s: %s", item.name_, item.description_);
+}
+std::string ModuleGroup::existing_values() const
+{
+  std::stringstream ss;
+  std::string sep;
+  for (auto const& item : table_) {
+    ss << sep + item.name_;
+    sep = ", ";
+  }
+  return ss.str();
+}
+
+/* -------------------------------------------------------------------------------------------------------------- */
+simgrid::ModuleGroup surf_optimization_mode_description("optimization mode");
+simgrid::ModuleGroup surf_cpu_model_description("CPU model");
+simgrid::ModuleGroup surf_network_model_description("network model");
+simgrid::ModuleGroup surf_disk_model_description("disk model");
+simgrid::ModuleGroup surf_host_model_description("host model");
+
+void simgrid_create_models()
+{
+  surf_network_model_description
+      .add("LV08",
+           "Realistic network analytic model (slow-start modeled by multiplying latency by 13.01, bandwidth by .97; "
+           "bottleneck sharing uses a payload of S=20537 for evaluating RTT). ",
+           &surf_network_model_init_LegrandVelho)
+      .add("Constant",
+           "Simplistic network model where all communication take a constant time (one second). This model "
+           "provides the lowest realism, but is (marginally) faster.",
+           &surf_network_model_init_Constant)
+      .add("SMPI",
+           "Realistic network model specifically tailored for HPC settings (accurate modeling of slow start with "
+           "correction factors on three intervals: < 1KiB, < 64 KiB, >= 64 KiB)",
+           &surf_network_model_init_SMPI)
+      .add("IB",
+#if HAVE_SMPI
+           "Realistic network model specifically tailored for HPC settings, with Infiniband contention model",
+#else
+           "(Infiniband model is only enabled when SMPI is)",
+#endif
+           &surf_network_model_init_IB)
+      .add("CM02",
+           "Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of "
+           "small messages are thus poorly modeled).",
+           &surf_network_model_init_CM02)
+      .add("ns-3",
+#if SIMGRID_HAVE_NS3
+           "Network pseudo-model using the ns-3 tcp model instead of an analytic model",
+#else
+           "(ns-3 pseudo-model is only activated when ns-3 support was compiled it)",
+#endif
+           &surf_network_model_init_NS3);
+
+  surf_cpu_model_description.add("Cas01", "Simplistic CPU model (time=size/speed).", &surf_cpu_model_init_Cas01);
+  surf_disk_model_description.add("S19", "Simplistic disk model.", &surf_disk_model_init_S19);
+
+  surf_host_model_description
+      .add("default",
+           "Default host model. Currently, CPU:Cas01, network:LV08 (with cross traffic enabled), and disk:S19",
+           &surf_host_model_init_current_default)
+      .add("compound", "Host model that is automatically chosen if you change the CPU, network, and disk models",
+           &surf_host_model_init_compound)
+      .add("ptask_L07", "Host model somehow similar to Cas01+CM02+S19 but allowing parallel tasks",
+           &surf_host_model_init_ptask_L07);
+
+  surf_optimization_mode_description
+      .add("Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr)
+      .add("TI",
+           "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU "
+           "model for now).",
+           nullptr)
+      .add("Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr);
+}
+
+#if !HAVE_SMPI
+void surf_network_model_init_IB()
+{
+  xbt_die("Please activate SMPI support in cmake to use the IB network model.");
+}
+#endif
+#if !SIMGRID_HAVE_NS3
+void surf_network_model_init_NS3()
+{
+  xbt_die("Please activate ns-3 support in cmake and install the dependencies to use the NS3 network model.");
+}
+#endif
diff --git a/src/simgrid/module.hpp b/src/simgrid/module.hpp
new file mode 100644 (file)
index 0000000..8d077e1
--- /dev/null
@@ -0,0 +1,54 @@
+/* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved.          */
+
+/* This program is free software; you can redistribute it and/or modify it
+ * under the terms of the license (GNU LGPL) which comes with this package. */
+
+#ifndef SIMGRID_MODULE_HPP
+#define SIMGRID_MODULE_HPP
+
+#include <xbt/base.h>
+
+#include <functional>
+#include <string>
+#include <vector>
+
+namespace simgrid {
+
+struct Module {
+  const char* name_;
+  const char* description_;
+  std::function<void()> init;
+  Module(const char* id, const char* desc, std::function<void()> init_fun)
+      : name_(id), description_(desc), init(init_fun)
+  {
+  }
+};
+
+class ModuleGroup {
+  std::vector<Module> table_;
+  std::string kind_; // either 'plugin' or 'CPU model' or whatever. Used in error messages only
+public:
+  ModuleGroup(std::string kind) : kind_(kind) {}
+
+  ModuleGroup& add(const char* id, const char* desc, std::function<void()> init);
+  Module const& by_name(const std::string& name) const;
+  void help() const;
+  std::string existing_values() const;
+};
+
+}; // namespace simgrid
+
+#define SIMGRID_REGISTER_PLUGIN(id, desc, init)                                                                        \
+  static void XBT_ATTRIB_CONSTRUCTOR(800) _XBT_CONCAT3(simgrid_, id, _plugin_register)()                               \
+  {                                                                                                                    \
+    simgrid_plugins().add(_XBT_STRINGIFY(id), (desc), (init));                                                         \
+  }
+
+/** @brief The list of all available plugins */
+inline auto& simgrid_plugins() // Function to avoid static initialization order fiasco
+{
+  static simgrid::ModuleGroup plugins("plugin");
+  return plugins;
+}
+
+#endif
\ No newline at end of file
index e74eca3..3763aa8 100644 (file)
@@ -19,6 +19,7 @@
 #include "src/kernel/resource/NetworkModel.hpp"
 #include "src/mc/mc_config.hpp"
 #include "src/mc/mc_replay.hpp"
+#include "src/simgrid/module.hpp"
 #include "src/smpi/include/smpi_config.hpp"
 #include "src/surf/surf_interface.hpp"
 
@@ -94,14 +95,13 @@ static void sg_config_cmd_line(int *argc, char **argv)
       XBT_HELP("Please consider using the recent names");
       shall_exit = true;
     } else if (parse_args && not strcmp(argv[i], "--help-models")) {
-      model_help("host", surf_host_model_description);
+      surf_host_model_description.help();
       XBT_HELP("%s", "");
-      model_help("CPU", surf_cpu_model_description);
+      surf_cpu_model_description.help();
       XBT_HELP("%s", "");
-      model_help("network", surf_network_model_description);
+      surf_network_model_description.help();
       XBT_HELP("\nLong description of all optimization levels accepted by the models of this simulator:");
-      for (auto const& item : surf_optimization_mode_description)
-        XBT_HELP("  %s: %s", item.name, item.description);
+      surf_optimization_mode_description.help();
       XBT_HELP("Both network and CPU models have 'Lazy' as default optimization level\n");
       shall_exit = true;
     } else if (parse_args && not strcmp(argv[i], "--help-tracing")) {
@@ -128,12 +128,11 @@ static void _sg_cfg_cb__plugin(const std::string& value)
     return;
 
   if (value == "help") {
-    model_help("plugin", surf_plugin_description());
+    simgrid_plugins().help();
     exit(0);
   }
 
-  const auto* plugin = find_model_description(surf_plugin_description(), value);
-  plugin->model_init_preparse();
+  simgrid_plugins().by_name(value).init();
 }
 
 /* callback of the host/model variable */
@@ -142,12 +141,12 @@ static void _sg_cfg_cb__host_model(const std::string& value)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   if (value == "help") {
-    model_help("host", surf_host_model_description);
+    surf_host_model_description.help();
     exit(0);
   }
 
   /* Make sure that the model exists */
-  find_model_description(surf_host_model_description, value);
+  surf_host_model_description.by_name(value);
 }
 
 /* callback of the cpu/model variable */
@@ -156,12 +155,12 @@ static void _sg_cfg_cb__cpu_model(const std::string& value)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   if (value == "help") {
-    model_help("CPU", surf_cpu_model_description);
+    surf_cpu_model_description.help();
     exit(0);
   }
 
-  /* New Module missing */
-  find_model_description(surf_cpu_model_description, value);
+  /* Make sure that the model exists */
+  surf_cpu_model_description.by_name(value);
 }
 
 /* callback of the cpu/model variable */
@@ -170,12 +169,12 @@ static void _sg_cfg_cb__optimization_mode(const std::string& value)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   if (value == "help") {
-    model_help("optimization", surf_optimization_mode_description);
+    surf_optimization_mode_description.help();
     exit(0);
   }
 
-  /* New Module missing */
-  find_model_description(surf_optimization_mode_description, value);
+  /* Make sure that the model exists */
+  surf_optimization_mode_description.by_name(value);
 }
 
 static void _sg_cfg_cb__disk_model(const std::string& value)
@@ -183,11 +182,11 @@ static void _sg_cfg_cb__disk_model(const std::string& value)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   if (value == "help") {
-    model_help("disk", surf_disk_model_description);
+    surf_disk_model_description.help();
     exit(0);
   }
 
-  find_model_description(surf_disk_model_description, value);
+  surf_disk_model_description.by_name(value);
 }
 
 /* callback of the network_model variable */
@@ -196,12 +195,11 @@ static void _sg_cfg_cb__network_model(const std::string& value)
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
   if (value == "help") {
-    model_help("network", surf_network_model_description);
+    surf_network_model_description.help();
     exit(0);
   }
 
-  /* New Module missing */
-  find_model_description(surf_network_model_description, value);
+  surf_network_model_description.by_name(value);
 }
 
 static void _sg_cfg_cb_contexts_parallel_mode(std::string_view mode_name)
@@ -221,15 +219,10 @@ static void _sg_cfg_cb_contexts_parallel_mode(std::string_view mode_name)
 /* build description line with possible values */
 static void declare_model_flag(const std::string& name, const std::string& value,
                                const std::function<void(std::string const&)>& callback,
-                               const std::vector<surf_model_description_t>& model_description, const std::string& type,
+                               const simgrid::ModuleGroup& model_description, const std::string& type,
                                const std::string& descr)
 {
-  std::string description = descr + ". Possible values: ";
-  std::string sep         = "";
-  for (auto const& item : model_description) {
-    description += sep + item.name;
-    sep = ", ";
-  }
+  std::string description = descr + ". Possible values: " + model_description.existing_values();
   description += ".\n       (use 'help' as a value to see the long description of each " + type + ")";
   simgrid::config::declare_flag<std::string>(name, description, value, callback);
 }
@@ -242,9 +235,9 @@ void sg_config_init(int *argc, char **argv)
     XBT_WARN("Call to sg_config_init() after initialization ignored");
     return;
   }
-
+  simgrid_create_models();
   /* Plugins configuration */
-  declare_model_flag("plugin", "", &_sg_cfg_cb__plugin, surf_plugin_description(), "plugin", "The plugins");
+  declare_model_flag("plugin", "", &_sg_cfg_cb__plugin, simgrid_plugins(), "plugin", "The plugins");
 
   declare_model_flag("cpu/model", "Cas01", &_sg_cfg_cb__cpu_model, surf_cpu_model_description, "model",
                      "The model to use for the CPU");
index eba9887..b22836e 100644 (file)
  *********/
 
 std::vector<std::string> surf_path;
-
-const std::vector<surf_model_description_t> surf_network_model_description = {
-    {"LV08",
-     "Realistic network analytic model (slow-start modeled by multiplying latency by 13.01, bandwidth by .97; "
-     "bottleneck sharing uses a payload of S=20537 for evaluating RTT). ",
-     &surf_network_model_init_LegrandVelho},
-    {"Constant",
-     "Simplistic network model where all communication take a constant time (one second). This model "
-     "provides the lowest realism, but is (marginally) faster.",
-     &surf_network_model_init_Constant},
-    {"SMPI",
-     "Realistic network model specifically tailored for HPC settings (accurate modeling of slow start with "
-     "correction factors on three intervals: < 1KiB, < 64 KiB, >= 64 KiB)",
-     &surf_network_model_init_SMPI},
-    {"IB", "Realistic network model specifically tailored for HPC settings, with Infiniband contention model",
-     &surf_network_model_init_IB},
-    {"CM02",
-     "Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of "
-     "small messages are thus poorly modeled).",
-     &surf_network_model_init_CM02},
-    {"ns-3", "Network pseudo-model using the ns-3 tcp model instead of an analytic model",
-     &surf_network_model_init_NS3},
-};
-
-#if !HAVE_SMPI
-void surf_network_model_init_IB()
-{
-  xbt_die("Please activate SMPI support in cmake to use the IB network model.");
-}
-#endif
-#if !SIMGRID_HAVE_NS3
-void surf_network_model_init_NS3()
-{
-  xbt_die("Please activate ns-3 support in cmake and install the dependencies to use the NS3 network model.");
-}
-#endif
-
-const std::vector<surf_model_description_t> surf_cpu_model_description = {
-    {"Cas01", "Simplistic CPU model (time=size/speed).", &surf_cpu_model_init_Cas01},
-};
-
-const std::vector<surf_model_description_t> surf_disk_model_description = {
-    {"S19", "Simplistic disk model.", &surf_disk_model_init_S19},
-};
-
-const std::vector<surf_model_description_t> surf_host_model_description = {
-    {"default", "Default host model. Currently, CPU:Cas01, network:LV08 (with cross traffic enabled), and disk:S19",
-     &surf_host_model_init_current_default},
-    {"compound", "Host model that is automatically chosen if you change the CPU, network, and disk models",
-     &surf_host_model_init_compound},
-    {"ptask_L07", "Host model somehow similar to Cas01+CM02+S19 but allowing parallel tasks",
-     &surf_host_model_init_ptask_L07},
-};
-
-const std::vector<surf_model_description_t> surf_optimization_mode_description = {
-    {"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr},
-    {"TI",
-     "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU "
-     "model for now).",
-     nullptr},
-    {"Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr},
-};
-
-/** Displays the long description of all registered models, and quit */
-void model_help(const char* category, const std::vector<surf_model_description_t>& table)
-{
-  XBT_HELP("Long description of the %s models accepted by this simulator:", category);
-  for (auto const& item : table)
-    XBT_HELP("  %s: %s", item.name, item.description);
-}
-
-const surf_model_description_t* find_model_description(const std::vector<surf_model_description_t>& table,
-                                                       const std::string& name)
-{
-  if (auto pos = std::find_if(table.begin(), table.end(),
-                              [&name](const surf_model_description_t& item) { return item.name == name; });
-      pos != table.end())
-    return &*pos;
-
-  std::string sep;
-  std::string name_list;
-  for (auto const& item : table) {
-    name_list += sep + item.name;
-    sep = ", ";
-  }
-  xbt_die("Model '%s' is invalid! Valid models are: %s.", name.c_str(), name_list.c_str());
-}
index 7907a68..d0d921c 100644 (file)
@@ -6,10 +6,12 @@
 #ifndef SURF_MODEL_H_
 #define SURF_MODEL_H_
 
+#include "src/simgrid/module.hpp"
 #include <xbt/asserts.h>
 #include <xbt/function_types.h>
 
 #include "src/internal_config.h"
+#include "src/kernel/resource/profile/Profile.hpp"
 
 #include <cfloat>
 #include <cmath>
@@ -146,7 +148,6 @@ XBT_PUBLIC void surf_network_model_init_NS3();
  *  A VM model depends on the physical CPU model to share the resources inside the VM
  *  It will also creates the CPU model for actions running inside the VM
  *
- *  Such model is subject to modification with warning in the ChangeLog so monitor it!
  */
 XBT_PUBLIC void surf_vm_model_init_HL13(simgrid::kernel::resource::CpuModel* cpu_pm_model);
 
@@ -178,39 +179,19 @@ XBT_PUBLIC void surf_host_model_init_ptask_L07();
 /* --------------------
  *  Model Descriptions
  * -------------------- */
-/** @brief Resource model description */
-struct surf_model_description_t {
-  const char* name;
-  const char* description;
-  std::function<void()> model_init_preparse;
-};
-
-XBT_PUBLIC const surf_model_description_t* find_model_description(const std::vector<surf_model_description_t>& table,
-                                                                  const std::string& name);
-XBT_PUBLIC void model_help(const char* category, const std::vector<surf_model_description_t>& table);
-
-#define SIMGRID_REGISTER_PLUGIN(id, desc, init)                                                                        \
-  static void XBT_ATTRIB_CONSTRUCTOR(800) _XBT_CONCAT3(simgrid_, id, _plugin_register)()                               \
-  {                                                                                                                    \
-    surf_plugin_description().emplace_back(surf_model_description_t{_XBT_STRINGIFY(id), (desc), (init)});              \
-  }
 
-/** @brief The list of all available plugins */
-inline auto& surf_plugin_description() // Function to avoid static initialization order fiasco
-{
-  static std::vector<surf_model_description_t> plugin_description_table;
-  return plugin_description_table;
-}
 /** @brief The list of all available optimization modes (both for cpu and networks).
  *  These optimization modes can be set using --cfg=cpu/optim:... and --cfg=network/optim:... */
-XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_optimization_mode_description;
+XBT_PUBLIC_DATA simgrid::ModuleGroup surf_optimization_mode_description;
 /** @brief The list of all cpu models (pick one with --cfg=cpu/model) */
-XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_cpu_model_description;
+XBT_PUBLIC_DATA simgrid::ModuleGroup surf_cpu_model_description;
 /** @brief The list of all network models (pick one with --cfg=network/model) */
-XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_network_model_description;
+XBT_PUBLIC_DATA simgrid::ModuleGroup surf_network_model_description;
 /** @brief The list of all disk models (pick one with --cfg=disk/model) */
-XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_disk_model_description;
+XBT_PUBLIC_DATA simgrid::ModuleGroup surf_disk_model_description;
 /** @brief The list of all host models (pick one with --cfg=host/model:) */
-XBT_PUBLIC_DATA const std::vector<surf_model_description_t> surf_host_model_description;
+XBT_PUBLIC_DATA simgrid::ModuleGroup surf_host_model_description;
+
+void simgrid_create_models();
 
 #endif /* SURF_MODEL_H_ */
index 3711fbd..4310792 100644 (file)
@@ -469,6 +469,8 @@ set(S4U_SRC
 
 set(SIMGRID_SRC
   src/simgrid/Exception.cpp
+  src/simgrid/module.cpp
+  src/simgrid/module.hpp
   src/simgrid/sg_config.cpp
   src/simgrid/sg_version.cpp
   src/simgrid/util.hpp