1 /* Copyright (c) 2004-2023. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #include <xbt/asserts.h>
9 #include "src/simgrid/module.hpp"
10 #include "src/surf/surf_interface.hpp"
14 XBT_LOG_NEW_CATEGORY(plugin, "Common category for the logging of all plugins");
15 XBT_LOG_EXTERNAL_CATEGORY(xbt_help);
17 using namespace simgrid;
19 ModuleGroup& ModuleGroup::add(const char* id, const char* desc, std::function<void()> init)
21 table_.emplace_back(Module(id, desc, init));
25 Module const& ModuleGroup::by_name(const std::string& name) const
27 if (auto pos = std::find_if(table_.begin(), table_.end(), [&name](const Module& item) { return item.name_ == name; });
31 xbt_die("Unable to find %s '%s'. Valid values are: %s.", kind_.c_str(), name.c_str(), existing_values().c_str());
33 /** Displays the long description of all registered models, and quit */
34 void ModuleGroup::help() const
36 XBT_HELP("Long description of the %s accepted by this simulator:", kind_.c_str());
37 for (auto const& item : table_)
38 XBT_HELP(" %s: %s", item.name_, item.description_);
40 std::string ModuleGroup::existing_values() const
44 for (auto const& item : table_) {
45 ss << sep + item.name_;
51 /* -------------------------------------------------------------------------------------------------------------- */
52 simgrid::ModuleGroup surf_optimization_mode_description("optimization mode");
53 simgrid::ModuleGroup surf_cpu_model_description("CPU model");
54 simgrid::ModuleGroup surf_network_model_description("network model");
55 simgrid::ModuleGroup surf_disk_model_description("disk model");
56 simgrid::ModuleGroup surf_host_model_description("host model");
58 void simgrid_create_models()
60 surf_network_model_description
62 "Realistic network analytic model (slow-start modeled by multiplying latency by 13.01, bandwidth by .97; "
63 "bottleneck sharing uses a payload of S=20537 for evaluating RTT). ",
64 &surf_network_model_init_LegrandVelho)
66 "Simplistic network model where all communication take a constant time (one second). This model "
67 "provides the lowest realism, but is (marginally) faster.",
68 &surf_network_model_init_Constant)
70 "Realistic network model specifically tailored for HPC settings (accurate modeling of slow start with "
71 "correction factors on three intervals: < 1KiB, < 64 KiB, >= 64 KiB)",
72 &surf_network_model_init_SMPI)
75 "Realistic network model specifically tailored for HPC settings, with Infiniband contention model",
77 "(Infiniband model is only enabled when SMPI is)",
79 &surf_network_model_init_IB)
81 "Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of "
82 "small messages are thus poorly modeled).",
83 &surf_network_model_init_CM02)
86 "Network pseudo-model using the ns-3 tcp model instead of an analytic model",
88 "(ns-3 pseudo-model is only activated when ns-3 support was compiled it)",
90 &surf_network_model_init_NS3);
92 surf_cpu_model_description.add("Cas01", "Simplistic CPU model (time=size/speed).", &surf_cpu_model_init_Cas01);
93 surf_disk_model_description.add("S19", "Simplistic disk model.", &surf_disk_model_init_S19);
95 surf_host_model_description
97 "Default host model. Currently, CPU:Cas01, network:LV08 (with cross traffic enabled), and disk:S19",
98 &surf_host_model_init_current_default)
99 .add("compound", "Host model that is automatically chosen if you change the CPU, network, and disk models",
100 &surf_host_model_init_compound)
101 .add("ptask_L07", "Host model somehow similar to Cas01+CM02+S19 but allowing parallel tasks",
102 &surf_host_model_init_ptask_L07);
104 surf_optimization_mode_description
105 .add("Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr)
107 "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU "
110 .add("Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr);
114 void surf_network_model_init_IB()
116 xbt_die("Please activate SMPI support in cmake to use the IB network model.");
119 #if !SIMGRID_HAVE_NS3
120 void surf_network_model_init_NS3()
122 xbt_die("Please activate ns-3 support in cmake and install the dependencies to use the NS3 network model.");