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 <simgrid/s4u/Engine.hpp>
7 #include <xbt/module.h>
10 #include "simgrid/sg_config.hpp"
11 #include "src/kernel/resource/profile/FutureEvtSet.hpp"
12 #include "src/kernel/resource/profile/Profile.hpp"
13 #include "src/surf/HostImpl.hpp"
14 #include "src/surf/surf_interface.hpp"
19 XBT_LOG_NEW_CATEGORY(surf, "All SURF categories");
20 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_kernel, surf, "Logging specific to SURF (kernel)");
26 simgrid::kernel::profile::FutureEvtSet future_evt_set;
27 std::vector<std::string> surf_path;
29 const std::vector<surf_model_description_t> surf_network_model_description = {
31 "Realistic network analytic model (slow-start modeled by multiplying latency by 13.01, bandwidth by .97; "
32 "bottleneck sharing uses a payload of S=20537 for evaluating RTT). ",
33 &surf_network_model_init_LegrandVelho},
35 "Simplistic network model where all communication take a constant time (one second). This model "
36 "provides the lowest realism, but is (marginally) faster.",
37 &surf_network_model_init_Constant},
39 "Realistic network model specifically tailored for HPC settings (accurate modeling of slow start with "
40 "correction factors on three intervals: < 1KiB, < 64 KiB, >= 64 KiB)",
41 &surf_network_model_init_SMPI},
42 {"IB", "Realistic network model specifically tailored for HPC settings, with Infiniband contention model",
43 &surf_network_model_init_IB},
45 "Legacy network analytic model (Very similar to LV08, but without corrective factors. The timings of "
46 "small messages are thus poorly modeled).",
47 &surf_network_model_init_CM02},
48 {"ns-3", "Network pseudo-model using the ns-3 tcp model instead of an analytic model",
49 &surf_network_model_init_NS3},
53 void surf_network_model_init_IB()
55 xbt_die("Please activate SMPI support in cmake to use the IB network model.");
59 void surf_network_model_init_NS3()
61 xbt_die("Please activate ns-3 support in cmake and install the dependencies to use the NS3 network model.");
65 const std::vector<surf_model_description_t> surf_cpu_model_description = {
66 {"Cas01", "Simplistic CPU model (time=size/speed).", &surf_cpu_model_init_Cas01},
69 const std::vector<surf_model_description_t> surf_disk_model_description = {
70 {"S19", "Simplistic disk model.", &surf_disk_model_init_S19},
73 const std::vector<surf_model_description_t> surf_host_model_description = {
74 {"default", "Default host model. Currently, CPU:Cas01, network:LV08 (with cross traffic enabled), and disk:S19",
75 &surf_host_model_init_current_default},
76 {"compound", "Host model that is automatically chosen if you change the CPU, network, and disk models",
77 &surf_host_model_init_compound},
78 {"ptask_L07", "Host model somehow similar to Cas01+CM02+S19 but allowing parallel tasks",
79 &surf_host_model_init_ptask_L07},
82 const std::vector<surf_model_description_t> surf_optimization_mode_description = {
83 {"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr},
85 "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU "
88 {"Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr},
91 /** Displays the long description of all registered models, and quit */
92 void model_help(const char* category, const std::vector<surf_model_description_t>& table)
94 XBT_HELP("Long description of the %s models accepted by this simulator:", category);
95 for (auto const& item : table)
96 XBT_HELP(" %s: %s", item.name, item.description);
99 const surf_model_description_t* find_model_description(const std::vector<surf_model_description_t>& table,
100 const std::string& name)
102 if (auto pos = std::find_if(table.begin(), table.end(),
103 [&name](const surf_model_description_t& item) { return item.name == name; });
108 std::string name_list;
109 for (auto const& item : table) {
110 name_list += sep + item.name;
113 xbt_die("Model '%s' is invalid! Valid models are: %s.", name.c_str(), name_list.c_str());