Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
e5bd9af6de52b50d0351eaf6d3d08d14afee2b30
[simgrid.git] / src / simgrid / sg_config.cpp
1 /* Copyright (c) 2009-2018. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 /* sg_config: configuration infrastructure for the simulation world         */
7
8 #include "simgrid/sg_config.hpp"
9 #include "instr/instr_interface.hpp"
10 #include "simgrid/instr.h"
11 #include "src/internal_config.h"
12 #include "src/kernel/lmm/maxmin.hpp"
13 #include "src/mc/mc_config.hpp"
14 #include "src/mc/mc_replay.hpp"
15 #include "src/surf/surf_interface.hpp"
16 #include "surf/surf.hpp"
17 #include "xbt/config.h"
18 #include "xbt/config.hpp"
19
20 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf, "About the configuration of SimGrid");
21
22
23 /* 0: beginning of time (config cannot be changed yet);
24  * 1: initialized: cfg_set created (config can now be changed);
25  * 2: configured: command line parsed and config part of platform file was
26  *    integrated also, platform construction ongoing or done.
27  *    (Config cannot be changed anymore!)
28  */
29 int _sg_cfg_init_status = 0;
30
31 /* instruct the upper layer (simix or simdag) to exit as soon as possible */
32 int _sg_cfg_exit_asap = 0;
33
34 #define sg_cfg_exit_early() do { _sg_cfg_exit_asap = 1; return; } while (0)
35
36 /* Parse the command line, looking for options */
37 static void sg_config_cmd_line(int *argc, char **argv)
38 {
39   int shall_exit = 0;
40   int i;
41   int j;
42
43   for (j = i = 1; i < *argc; i++) {
44     if (not strncmp(argv[i], "--cfg=", strlen("--cfg="))) {
45       char *opt = strchr(argv[i], '=');
46       opt++;
47
48       xbt_cfg_set_parse(opt);
49       XBT_DEBUG("Did apply '%s' as config setting", opt);
50     } else if (not strcmp(argv[i], "--version")) {
51       printf("%s\n", SIMGRID_VERSION_STRING);
52       shall_exit = 1;
53     } else if (not strcmp(argv[i], "--cfg-help") || not strcmp(argv[i], "--help")) {
54       printf("Description of the configuration accepted by this simulator:\n");
55       xbt_cfg_help();
56       printf(
57           "\n"
58           "Each of these configurations can be used by adding\n"
59           "    --cfg=<option name>:<option value>\n"
60           "to the command line.\n"
61           "\n"
62           "For more information, please refer to:\n"
63           "   --help-aliases for the list of all option aliases.\n"
64           "   --help-logs and --help-log-categories for the details of logging output.\n"
65           "   --help-models for a list of all models known by this simulator.\n"
66           "   --help-tracing for the details of all tracing options known by this simulator.\n"
67           "   --version to get SimGrid version information.\n"
68           "\n"
69         );
70       shall_exit = 1;
71     } else if (not strcmp(argv[i], "--help-aliases")) {
72       printf("Here is a list of all deprecated option names, with their replacement.\n");
73       xbt_cfg_aliases();
74       printf("Please consider using the recent names\n");
75       shall_exit = 1;
76     } else if (not strcmp(argv[i], "--help-models")) {
77       model_help("host", surf_host_model_description);
78       printf("\n");
79       model_help("CPU", surf_cpu_model_description);
80       printf("\n");
81       model_help("network", surf_network_model_description);
82       printf("\nLong description of all optimization levels accepted by the models of this simulator:\n");
83       for (int k = 0; surf_optimization_mode_description[k].name; k++)
84         printf("  %s: %s\n",
85                surf_optimization_mode_description[k].name,
86                surf_optimization_mode_description[k].description);
87       printf("Both network and CPU models have 'Lazy' as default optimization level\n\n");
88       shall_exit = 1;
89     } else if (not strcmp(argv[i], "--help-tracing")) {
90       TRACE_help (1);
91       shall_exit = 1;
92     } else {
93       argv[j++] = argv[i];
94     }
95   }
96   if (j < *argc) {
97     argv[j] = nullptr;
98     *argc = j;
99   }
100   if (shall_exit)
101     sg_cfg_exit_early();
102 }
103
104 /* callback of the plugin variable */
105 static void _sg_cfg_cb__plugin(const std::string& value)
106 {
107   xbt_assert(_sg_cfg_init_status < 2, "Cannot load a plugin after the initialization");
108
109   if (value.empty())
110     return;
111
112   if (value == "help") {
113     model_help("plugin", surf_plugin_description);
114     sg_cfg_exit_early();
115   }
116
117   int plugin_id = find_model_description(surf_plugin_description, value);
118   surf_plugin_description[plugin_id].model_init_preparse();
119 }
120
121 /* callback of the host/model variable */
122 static void _sg_cfg_cb__host_model(const std::string& value)
123 {
124   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
125
126   if (value == "help") {
127     model_help("host", surf_host_model_description);
128     sg_cfg_exit_early();
129   }
130
131   /* Make sure that the model exists */
132   find_model_description(surf_host_model_description, value);
133 }
134
135 /* callback of the cpu/model variable */
136 static void _sg_cfg_cb__cpu_model(const std::string& value)
137 {
138   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
139
140   if (value == "help") {
141     model_help("CPU", surf_cpu_model_description);
142     sg_cfg_exit_early();
143   }
144
145   /* New Module missing */
146   find_model_description(surf_cpu_model_description, value);
147 }
148
149 /* callback of the cpu/model variable */
150 static void _sg_cfg_cb__optimization_mode(const std::string& value)
151 {
152   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
153
154   if (value == "help") {
155     model_help("optimization", surf_optimization_mode_description);
156     sg_cfg_exit_early();
157   }
158
159   /* New Module missing */
160   find_model_description(surf_optimization_mode_description, value);
161 }
162
163 /* callback of the cpu/model variable */
164 static void _sg_cfg_cb__storage_mode(const std::string& value)
165 {
166   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
167
168   if (value == "help") {
169     model_help("storage", surf_storage_model_description);
170     sg_cfg_exit_early();
171   }
172
173   find_model_description(surf_storage_model_description, value);
174 }
175
176 /* callback of the network_model variable */
177 static void _sg_cfg_cb__network_model(const std::string& value)
178 {
179   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
180
181   if (value == "help") {
182     model_help("network", surf_network_model_description);
183     sg_cfg_exit_early();
184   }
185
186   /* New Module missing */
187   find_model_description(surf_network_model_description, value);
188 }
189
190 #if SIMGRID_HAVE_MC
191 extern int _sg_do_model_check_record;
192 static void _sg_cfg_cb_model_check_record(const char *name) {
193   _sg_do_model_check_record = xbt_cfg_get_boolean(name);
194 }
195 #endif
196
197 static void _sg_cfg_cb_contexts_parallel_mode(const std::string& mode_name)
198 {
199   if (mode_name == "posix") {
200     SIMIX_context_set_parallel_mode(XBT_PARMAP_POSIX);
201   } else if (mode_name == "futex") {
202     SIMIX_context_set_parallel_mode(XBT_PARMAP_FUTEX);
203   } else if (mode_name == "busy_wait") {
204     SIMIX_context_set_parallel_mode(XBT_PARMAP_BUSY_WAIT);
205   } else {
206     xbt_die("Command line setting of the parallel synchronization mode should "
207             "be one of \"posix\", \"futex\" or \"busy_wait\"");
208   }
209 }
210
211 /* build description line with possible values */
212 static void describe_model(char *result,int resultsize,
213                            const s_surf_model_description_t model_description[],
214                            const char *name,
215                            const char *description)
216 {
217   result[0] = '\0';
218   char *p = result;
219   p += snprintf(result,resultsize-1, "%s. Possible values: %s", description,
220             model_description[0].name ? model_description[0].name : "n/a");
221   for (int i = 1; model_description[i].name; i++)
222     p += snprintf(p,resultsize-(p-result)-1, ", %s", model_description[i].name);
223   p += snprintf(p,resultsize-(p-result)-1, ".\n       (use 'help' as a value to see the long description of each %s)", name);
224
225   xbt_assert(p<result+resultsize-1,"Buffer too small to display the model description of %s",name);
226 }
227
228 /* create the config set, register what should be and parse the command line*/
229 void sg_config_init(int *argc, char **argv)
230 {
231   const int descsize = 1024;
232   char description[descsize];
233
234   /* Create the configuration support */
235   if (_sg_cfg_init_status != 0) { /* Only create stuff if not already inited */
236     XBT_WARN("Call to sg_config_init() after initialization ignored");
237     return;
238   }
239
240   /* Plugins configuration */
241   describe_model(description, descsize, surf_plugin_description, "plugin", "The plugins");
242   simgrid::config::declareFlag<std::string>("plugin", description, "", &_sg_cfg_cb__plugin);
243
244   describe_model(description, descsize, surf_cpu_model_description, "model", "The model to use for the CPU");
245   simgrid::config::declareFlag<std::string>("cpu/model", description, "Cas01", &_sg_cfg_cb__cpu_model);
246
247   describe_model(description, descsize, surf_storage_model_description, "model", "The model to use for the storage");
248   simgrid::config::declareFlag<std::string>("storage/model", description, "default", &_sg_cfg_cb__storage_mode);
249
250   describe_model(description, descsize, surf_network_model_description, "model", "The model to use for the network");
251   simgrid::config::declareFlag<std::string>("network/model", description, "LV08", &_sg_cfg_cb__network_model);
252
253   describe_model(description, descsize, surf_optimization_mode_description, "optimization mode",
254                  "The optimization modes to use for the network");
255   simgrid::config::declareFlag<std::string>("network/optim", description, "Lazy", &_sg_cfg_cb__optimization_mode);
256
257   describe_model(description, descsize, surf_host_model_description, "model", "The model to use for the host");
258   simgrid::config::declareFlag<std::string>("host/model", description, "default", &_sg_cfg_cb__host_model);
259
260   simgrid::config::bindFlag(sg_surf_precision, "surf/precision",
261                             "Numerical precision used when updating simulation times (in seconds)");
262
263   simgrid::config::bindFlag(sg_maxmin_precision, "maxmin/precision",
264                             "Numerical precision used when computing resource sharing (in flops/sec or bytes/sec)");
265
266   simgrid::config::bindFlag(sg_concurrency_limit, "maxmin/concurrency-limit", {"maxmin/concurrency_limit"},
267                             "Maximum number of concurrent variables in the maxmim system. Also limits the number of "
268                             "processes on each host, at higher level. (default: -1 means no such limitation)");
269
270   /* The parameters of network models */
271
272   sg_latency_factor = 13.01; // comes from the default LV08 network model
273   simgrid::config::bindFlag(sg_latency_factor, "network/latency-factor", {"network/latency_factor"},
274                             "Correction factor to apply to the provided latency (default value set by network model)");
275
276   sg_bandwidth_factor = 0.97; // comes from the default LV08 network model
277   simgrid::config::bindFlag(
278       sg_bandwidth_factor, "network/bandwidth-factor", {"network/bandwidth_factor"},
279       "Correction factor to apply to the provided bandwidth (default value set by network model)");
280
281   sg_weight_S_parameter = 20537; // comes from the default LV08 network model
282   simgrid::config::bindFlag(
283       sg_weight_S_parameter, "network/weight-S", {"network/weight_S"},
284       "Correction factor to apply to the weight of competing streams (default value set by network model)");
285
286   /* Inclusion path */
287   simgrid::config::declareFlag<std::string>("path", "Lookup path for inclusions in platform and deployment XML files",
288                                             "", [](std::string const& path) {
289                                               if (not path.empty())
290                                                 surf_path.push_back(path);
291                                             });
292
293   simgrid::config::declareFlag<bool>("cpu/maxmin-selective-update", "Update the constraint set propagating recursively "
294                                                                     "to others constraints (off by default unless "
295                                                                     "optim is set to lazy)",
296                                      "no");
297   simgrid::config::alias("cpu/maxmin-selective-update", {"cpu/maxmin_selective_update"});
298   simgrid::config::declareFlag<bool>("network/maxmin-selective-update", "Update the constraint set propagating "
299                                                                         "recursively to others constraints (off by "
300                                                                         "default unless optim is set to lazy)",
301                                      "no");
302   simgrid::config::alias("network/maxmin-selective-update", {"network/maxmin_selective_update"});
303   /* Replay (this part is enabled even if MC it disabled) */
304   simgrid::config::bindFlag(MC_record_path, "model-check/replay",
305                             "Model-check path to replay (as reported by SimGrid when a violation is reported)");
306
307 #if SIMGRID_HAVE_MC
308   /* do model-checking-record */
309   xbt_cfg_register_boolean("model-check/record", "no", _sg_cfg_cb_model_check_record,
310                            "Record the model-checking paths");
311
312   xbt_cfg_register_int("model-check/checkpoint", 0, _mc_cfg_cb_checkpoint,
313                        "Specify the amount of steps between checkpoints during stateful model-checking (default: 0 => "
314                        "stateless verification). "
315                        "If value=1, one checkpoint is saved for each step => faster verification, but huge memory "
316                        "consumption; higher values are good compromises between speed and memory consumption.");
317
318   xbt_cfg_register_boolean("model-check/sparse-checkpoint", "no", _mc_cfg_cb_sparse_checkpoint,
319                            "Use sparse per-page snapshots.");
320   xbt_cfg_register_boolean("model-check/ksm", "no", _mc_cfg_cb_ksm, "Kernel same-page merging");
321
322   xbt_cfg_register_string("model-check/property", "", _mc_cfg_cb_property,
323                           "Name of the file containing the property, as formatted by the ltl2ba program.");
324   xbt_cfg_register_boolean("model-check/communications-determinism", "no", _mc_cfg_cb_comms_determinism,
325                            "Whether to enable the detection of communication determinism");
326   simgrid::config::alias("model-check/communications-determinism", {"model-check/communications_determinism"});
327
328   xbt_cfg_register_boolean("model-check/send-determinism", "no", _mc_cfg_cb_send_determinism,
329                            "Enable/disable the detection of send-determinism in the communications schemes");
330   simgrid::config::alias("model-check/send-determinism", {"model-check/send_determinism"});
331
332   /* Specify the kind of model-checking reduction */
333   xbt_cfg_register_string("model-check/reduction", "dpor", _mc_cfg_cb_reduce,
334                           "Specify the kind of exploration reduction (either none or DPOR)");
335   xbt_cfg_register_boolean("model-check/timeout", "no", _mc_cfg_cb_timeout,
336                            "Whether to enable timeouts for wait requests");
337
338   xbt_cfg_register_boolean("model-check/hash", "no", _mc_cfg_cb_hash,
339                            "Whether to enable state hash for state comparison (experimental)");
340   xbt_cfg_register_boolean("model-check/snapshot-fds", "no", _mc_cfg_cb_snapshot_fds,
341                            "Whether file descriptors must be snapshoted (currently unusable)");
342   simgrid::config::alias("model-check/snapshot-fds", {"model-check/snapshot_fds"});
343   xbt_cfg_register_int("model-check/max-depth", 1000, _mc_cfg_cb_max_depth,
344                        "Maximal exploration depth (default: 1000)");
345   simgrid::config::alias("model-check/max-depth", {"model-check/max_depth"});
346   xbt_cfg_register_int("model-check/visited", 0, _mc_cfg_cb_visited,
347                        "Specify the number of visited state stored for state comparison reduction. If value=5, the "
348                        "last 5 visited states are stored. If value=0 (the default), all states are stored.");
349
350   xbt_cfg_register_string("model-check/dot-output", "", _mc_cfg_cb_dot_output,
351                           "Name of dot output file corresponding to graph state");
352   simgrid::config::alias("model-check/dot-output", {"model-check/dot_output"});
353   xbt_cfg_register_boolean("model-check/termination", "no", _mc_cfg_cb_termination,
354                            "Whether to enable non progressive cycle detection");
355 #endif
356
357   extern bool _sg_do_verbose_exit;
358   simgrid::config::bindFlag(_sg_do_verbose_exit, "verbose-exit", "Activate the \"do nothing\" mode in Ctrl-C");
359
360   simgrid::config::declareFlag<int>("contexts/stack-size", "Stack size of contexts in KiB", 8 * 1024,
361                                     [](int value) { smx_context_stack_size = value * 1024; });
362   simgrid::config::alias("contexts/stack-size", {"contexts/stack_size"});
363
364   /* guard size for contexts stacks in memory pages */
365 #if defined(_WIN32) || (PTH_STACKGROWTH != -1)
366   int default_guard_size = 0;
367 #else
368   int default_guard_size = 1;
369 #endif
370   simgrid::config::declareFlag<int>("contexts/guard-size", "Guard size for contexts stacks in memory pages",
371                                     default_guard_size,
372                                     [](int value) { smx_context_guard_size = value * xbt_pagesize; });
373   simgrid::config::alias("contexts/guard-size", {"contexts/guard_size"});
374   simgrid::config::declareFlag<int>("contexts/nthreads", "Number of parallel threads used to execute user contexts", 1,
375                                     &SIMIX_context_set_nthreads);
376
377   simgrid::config::declareFlag<int>("contexts/parallel-threshold",
378                                     "Minimal number of user contexts to be run in parallel (raw contexts only)", 2,
379                                     &SIMIX_context_set_parallel_threshold);
380   simgrid::config::alias("contexts/parallel-threshold", {"contexts/parallel_threshold"});
381
382   /* synchronization mode for parallel user contexts */
383 #if HAVE_FUTEX_H
384   std::string default_synchro_mode = "futex";
385 #else //No futex on mac and posix is unimplememted yet
386   std::string default_synchro_mode = "busy_wait";
387 #endif
388   simgrid::config::declareFlag<std::string>("contexts/synchro", "Synchronization mode to use when running contexts in "
389                                                                 "parallel (either futex, posix or busy_wait)",
390                                             default_synchro_mode, &_sg_cfg_cb_contexts_parallel_mode);
391
392   // For smpi/bw-factor and smpi/lat-factor
393   // SMPI model can be used without enable_smpi, so keep this out of the ifdef.
394   simgrid::config::declareFlag<std::string>("smpi/bw-factor",
395                                             "Bandwidth factors for smpi. Format: "
396                                             "'threshold0:value0;threshold1:value1;...;thresholdN:valueN', "
397                                             "meaning if(size >=thresholdN ) return valueN.",
398                                             "65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;"
399                                             "1426:0.608902;732:0.341987;257:0.338112;0:0.812084");
400   simgrid::config::alias("smpi/bw-factor", {"smpi/bw_factor"});
401
402   simgrid::config::declareFlag<std::string>("smpi/lat-factor", "Latency factors for smpi.",
403                                             "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;"
404                                             "1426:1.61075;732:1.9503;257:1.95341;0:2.01467");
405   simgrid::config::alias("smpi/lat-factor", {"smpi/lat_factor"});
406   simgrid::config::declareFlag<std::string>("smpi/IB-penalty-factors",
407                                             "Correction factor to communications using Infiniband model with "
408                                             "contention (default value based on Stampede cluster profiling)",
409                                             "0.965;0.925;1.35");
410   simgrid::config::alias("smpi/IB-penalty-factors", {"smpi/IB_penalty_factors"});
411
412 #if HAVE_SMPI
413   simgrid::config::declareFlag<double>("smpi/host-speed", "Speed of the host running the simulation (in flop/s). "
414                                                           "Used to bench the operations.",
415                                        20000.0);
416   simgrid::config::alias("smpi/host-speed", {"smpi/running_power", "smpi/running-power"});
417
418   simgrid::config::declareFlag<bool>("smpi/keep-temps", "Whether we should keep the generated temporary files.", false);
419
420   simgrid::config::declareFlag<bool>("smpi/display-timing", "Whether we should display the timing after simulation.",
421                                      false);
422   simgrid::config::alias("smpi/display-timing", {"smpi/display_timing"});
423
424   simgrid::config::declareFlag<bool>("smpi/simulate-computation",
425                                      "Whether the computational part of the simulated application should be simulated.",
426                                      true);
427   simgrid::config::alias("smpi/simulate-computation", {"smpi/simulate_computation"});
428
429   simgrid::config::declareFlag<std::string>(
430       "smpi/shared-malloc", "Whether SMPI_SHARED_MALLOC is enabled. Disable it for debugging purposes.", "global");
431   simgrid::config::alias("smpi/shared-malloc", {"smpi/use_shared_malloc", "smpi/use-shared-malloc"});
432   simgrid::config::declareFlag<double>("smpi/shared-malloc-blocksize",
433                                        "Size of the bogus file which will be created for global shared allocations",
434                                        1UL << 20);
435   simgrid::config::declareFlag<std::string>("smpi/shared-malloc-hugepage",
436                                             "Path to a mounted hugetlbfs, to use huge pages with shared malloc.", "");
437
438   simgrid::config::declareFlag<double>(
439       "smpi/cpu-threshold", "Minimal computation time (in seconds) not discarded, or -1 for infinity.", 1e-6);
440   simgrid::config::alias("smpi/cpu-threshold", {"smpi/cpu_threshold"});
441
442   simgrid::config::declareFlag<int>(
443       "smpi/async-small-thresh",
444       "Maximal size of messages that are to be sent asynchronously, without waiting for the receiver", 0);
445   simgrid::config::alias("smpi/async-small-thresh", {"smpi/async_small_thres", "smpi/async_small_thresh"});
446
447   simgrid::config::declareFlag<bool>("smpi/trace-call-location",
448                                      "Should filename and linenumber of MPI calls be traced?", false);
449
450   simgrid::config::declareFlag<int>(
451       "smpi/send-is-detached-thresh",
452       "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend", 65536);
453   simgrid::config::alias("smpi/send-is-detached-thresh",
454                          {"smpi/send_is_detached_thres", "smpi/send_is_detached_thresh"});
455
456   const char* default_privatization = std::getenv("SMPI_PRIVATIZATION");
457   if (default_privatization == nullptr)
458     default_privatization = "no";
459
460   simgrid::config::declareFlag<std::string>(
461       "smpi/privatization", "How we should privatize global variable at runtime (no, yes, mmap, dlopen).",
462       default_privatization);
463   simgrid::config::alias("smpi/privatization", {"smpi/privatize_global_variables", "smpi/privatize-global-variables"});
464
465   simgrid::config::declareFlag<bool>("smpi/grow-injected-times",
466                                      "Whether we want to make the injected time in MPI_Iprobe and MPI_Test grow, to "
467                                      "allow faster simulation. This can make simulation less precise, though.",
468                                      true);
469
470 #if HAVE_PAPI
471   simgrid::config::declareFlag<std::string>("smpi/papi-events",
472                                             "This switch enables tracking the specified counters with PAPI", "");
473 #endif
474   simgrid::config::declareFlag<std::string>("smpi/comp-adjustment-file",
475                                             "A file containing speedups or slowdowns for some parts of the code.", "");
476   simgrid::config::declareFlag<std::string>(
477       "smpi/os", "Small messages timings (MPI_Send minimum time for small messages)", "0:0:0:0:0");
478   simgrid::config::declareFlag<std::string>(
479       "smpi/ois", "Small messages timings (MPI_Isend minimum time for small messages)", "0:0:0:0:0");
480   simgrid::config::declareFlag<std::string>(
481       "smpi/or", "Small messages timings (MPI_Recv minimum time for small messages)", "0:0:0:0:0");
482
483   simgrid::config::declareFlag<double>("smpi/iprobe-cpu-usage",
484                                        "Maximum usage of CPUs by MPI_Iprobe() calls. We've observed that MPI_Iprobes "
485                                        "consume significantly less power than the maximum of a specific application. "
486                                        "This value is then (Iprobe_Usage/Max_Application_Usage).",
487                                        1.0);
488
489   simgrid::config::declareFlag<std::string>("smpi/coll-selector", "Which collective selector to use", "default");
490   simgrid::config::alias("smpi/coll-selector", {"smpi/coll_selector"});
491   simgrid::config::declareFlag<std::string>("smpi/gather", "Which collective to use for gather", "");
492   simgrid::config::declareFlag<std::string>("smpi/allgather", "Which collective to use for allgather", "");
493   simgrid::config::declareFlag<std::string>("smpi/barrier", "Which collective to use for barrier", "");
494   simgrid::config::declareFlag<std::string>("smpi/reduce_scatter", "Which collective to use for reduce_scatter", "");
495   simgrid::config::alias("smpi/reduce_scatter", {"smpi/reduce-scatter"});
496   simgrid::config::declareFlag<std::string>("smpi/scatter", "Which collective to use for scatter", "");
497   simgrid::config::declareFlag<std::string>("smpi/allgatherv", "Which collective to use for allgatherv", "");
498   simgrid::config::declareFlag<std::string>("smpi/allreduce", "Which collective to use for allreduce", "");
499   simgrid::config::declareFlag<std::string>("smpi/alltoall", "Which collective to use for alltoall", "");
500   simgrid::config::declareFlag<std::string>("smpi/alltoallv", "Which collective to use for alltoallv", "");
501   simgrid::config::declareFlag<std::string>("smpi/bcast", "Which collective to use for bcast", "");
502   simgrid::config::declareFlag<std::string>("smpi/reduce", "Which collective to use for reduce", "");
503 #endif // HAVE_SMPI
504
505   /* Storage */
506
507   sg_storage_max_file_descriptors = 1024;
508   simgrid::config::bindFlag(sg_storage_max_file_descriptors, "storage/max_file_descriptors",
509                             "Maximum number of concurrently opened files per host. Default is 1024");
510
511   /* Others */
512
513   simgrid::config::declareFlag<bool>(
514       "exception/cutpath", "Whether to cut all path information from call traces, used e.g. in exceptions.", false);
515
516   extern bool _sg_do_clean_atexit;
517   simgrid::config::bindFlag(_sg_do_clean_atexit, "clean-atexit", {"clean_atexit"},
518                             "Whether to cleanup SimGrid at exit. Disable it if your code segfaults after its end.");
519
520   if (surf_path.empty())
521     xbt_cfg_setdefault_string("path", "./");
522
523   _sg_cfg_init_status = 1;
524
525   sg_config_cmd_line(argc, argv);
526
527   xbt_mallocator_initialization_is_done(SIMIX_context_is_parallel());
528 }
529
530 void sg_config_finalize()
531 {
532   if (not _sg_cfg_init_status)
533     return;                     /* Not initialized yet. Nothing to do */
534
535   xbt_cfg_free(&simgrid_config);
536   _sg_cfg_init_status = 0;
537 }