1 /* Copyright (c) 2009-2010, 2012-2014. The SimGrid Team.
2 * All rights reserved. */
4 /* This program is free software; you can redistribute it and/or modify it
5 * under the terms of the license (GNU LGPL) which comes with this package. */
7 /* sg_config: configuration infrastructure for the simulation world */
10 #include "xbt/config.h"
12 #include "xbt/mallocator.h"
15 #include "xbt/sysdep.h"
16 #include "surf/surf.h"
17 #include "surf/maxmin.h"
18 #include "instr/instr_interface.h"
19 #include "simgrid/simix.h"
20 #include "simgrid/sg_config.h"
21 #include "smpi/smpi_interface.h"
23 #include "mc/mc_record.h"
24 #include "simgrid/instr.h"
26 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf,
27 "About the configuration of simgrid");
29 xbt_cfg_t _sg_cfg_set = NULL;
31 /* 0: beginning of time (config cannot be changed yet);
32 * 1: initialized: cfg_set created (config can now be changed);
33 * 2: configured: command line parsed and config part of platform file was
34 * integrated also, platform construction ongoing or done.
35 * (Config cannot be changed anymore!)
37 int _sg_cfg_init_status = 0;
39 /* instruct the upper layer (simix or simdag) to exit as soon as possible
41 int _sg_cfg_exit_asap = 0;
43 #define sg_cfg_exit_early() do { _sg_cfg_exit_asap = 1; return; } while (0)
45 /* Parse the command line, looking for options */
46 static void sg_config_cmd_line(int *argc, char **argv)
52 for (j = i = 1; i < *argc; i++) {
53 if (!strncmp(argv[i], "--cfg=", strlen("--cfg="))) {
54 opt = strchr(argv[i], '=');
57 xbt_cfg_set_parse(_sg_cfg_set, opt);
58 XBT_DEBUG("Did apply '%s' as config setting", opt);
59 } else if (!strcmp(argv[i], "--version")) {
60 printf("%s\n", SIMGRID_VERSION_STRING);
62 } else if (!strcmp(argv[i], "--cfg-help") || !strcmp(argv[i], "--help")) {
64 ("Description of the configuration accepted by this simulator:\n");
65 xbt_cfg_help(_sg_cfg_set);
68 "Each of these configurations can be used by adding\n"
69 " --cfg=<option name>:<option value>\n"
70 "to the command line.\n"
72 "You can also use --help-models to see the details of all models known by this simulator.\n"
74 "You can also use --help-tracing to see the details of all tracing options known by this simulator.\n"
76 "You can also use --help-logs and --help-log-categories to see the details of logging output.\n"
78 "You can also use --version to get SimGrid version information.\n"
82 } else if (!strcmp(argv[i], "--help-models")) {
85 model_help("workstation", surf_workstation_model_description);
87 model_help("CPU", surf_cpu_model_description);
89 model_help("network", surf_network_model_description);
90 printf("\nLong description of all optimization levels accepted by the models of this simulator:\n");
91 for (k = 0; surf_optimization_mode_description[k].name; k++)
93 surf_optimization_mode_description[k].name,
94 surf_optimization_mode_description[k].description);
95 printf("Both network and CPU models have 'Lazy' as default optimization level\n\n");
97 } else if (!strcmp(argv[i], "--help-tracing")) {
112 /* callback of the plugin variable */
113 static void _sg_cfg_cb__plugin(const char *name, int pos)
118 xbt_assert(_sg_cfg_init_status < 2,
119 "Cannot load a plugin after the initialization");
121 val = xbt_cfg_get_string(_sg_cfg_set, name);
123 if (!strcmp(val, "help")) {
124 model_help("plugin", surf_plugin_description);
128 /* New Module missing */
129 int plugin_id = find_model_description(surf_plugin_description, val);
130 surf_plugin_description[plugin_id].model_init_preparse();
133 /* callback of the workstation/model variable */
134 static void _sg_cfg_cb__workstation_model(const char *name, int pos)
138 xbt_assert(_sg_cfg_init_status < 2,
139 "Cannot change the model after the initialization");
141 val = xbt_cfg_get_string(_sg_cfg_set, name);
143 if (!strcmp(val, "help")) {
144 model_help("workstation", surf_workstation_model_description);
148 /* Make sure that the model exists */
149 find_model_description(surf_workstation_model_description, val);
152 /* callback of the vm_workstation/model variable */
153 static void _sg_cfg_cb__vm_workstation_model(const char *name, int pos)
157 xbt_assert(_sg_cfg_init_status < 2,
158 "Cannot change the model after the initialization");
160 val = xbt_cfg_get_string(_sg_cfg_set, name);
162 if (!strcmp(val, "help")) {
163 model_help("vm_workstation", surf_vm_workstation_model_description);
167 /* Make sure that the model exists */
168 find_model_description(surf_vm_workstation_model_description, val);
171 /* callback of the cpu/model variable */
172 static void _sg_cfg_cb__cpu_model(const char *name, int pos)
176 xbt_assert(_sg_cfg_init_status < 2,
177 "Cannot change the model after the initialization");
179 val = xbt_cfg_get_string(_sg_cfg_set, name);
181 if (!strcmp(val, "help")) {
182 model_help("CPU", surf_cpu_model_description);
186 /* New Module missing */
187 find_model_description(surf_cpu_model_description, val);
190 /* callback of the cpu/model variable */
191 static void _sg_cfg_cb__optimization_mode(const char *name, int pos)
195 xbt_assert(_sg_cfg_init_status < 2,
196 "Cannot change the model after the initialization");
198 val = xbt_cfg_get_string(_sg_cfg_set, name);
200 if (!strcmp(val, "help")) {
201 model_help("optimization", surf_optimization_mode_description);
205 /* New Module missing */
206 find_model_description(surf_optimization_mode_description, val);
209 /* callback of the cpu/model variable */
210 static void _sg_cfg_cb__storage_mode(const char *name, int pos)
214 xbt_assert(_sg_cfg_init_status < 2,
215 "Cannot change the model after the initialization");
217 val = xbt_cfg_get_string(_sg_cfg_set, name);
219 if (!strcmp(val, "help")) {
220 model_help("storage", surf_storage_model_description);
224 /* New Module missing */
225 find_model_description(surf_storage_model_description, val);
228 /* callback of the workstation_model variable */
229 static void _sg_cfg_cb__network_model(const char *name, int pos)
233 xbt_assert(_sg_cfg_init_status < 2,
234 "Cannot change the model after the initialization");
236 val = xbt_cfg_get_string(_sg_cfg_set, name);
238 if (!strcmp(val, "help")) {
239 model_help("network", surf_network_model_description);
243 /* New Module missing */
244 find_model_description(surf_network_model_description, val);
247 /* callbacks of the network models values */
248 static void _sg_cfg_cb__tcp_gamma(const char *name, int pos)
250 sg_tcp_gamma = xbt_cfg_get_double(_sg_cfg_set, name);
253 static void _sg_cfg_cb__maxmin_precision(const char* name, int pos)
255 sg_maxmin_precision = xbt_cfg_get_double(_sg_cfg_set, name);
258 static void _sg_cfg_cb__surf_precision(const char* name, int pos)
260 sg_surf_precision = xbt_cfg_get_double(_sg_cfg_set, name);
263 static void _sg_cfg_cb__sender_gap(const char* name, int pos)
265 sg_sender_gap = xbt_cfg_get_double(_sg_cfg_set, name);
268 static void _sg_cfg_cb__latency_factor(const char *name, int pos)
270 sg_latency_factor = xbt_cfg_get_double(_sg_cfg_set, name);
273 static void _sg_cfg_cb__bandwidth_factor(const char *name, int pos)
275 sg_bandwidth_factor = xbt_cfg_get_double(_sg_cfg_set, name);
278 static void _sg_cfg_cb__weight_S(const char *name, int pos)
280 sg_weight_S_parameter = xbt_cfg_get_double(_sg_cfg_set, name);
284 /* callback of the mpi collectives */
285 static void _sg_cfg_cb__coll(const char *category,
286 s_mpi_coll_description_t * table,
287 const char *name, int pos)
291 xbt_assert(_sg_cfg_init_status < 2,
292 "Cannot change the model after the initialization");
294 val = xbt_cfg_get_string(_sg_cfg_set, name);
296 if (!strcmp(val, "help")) {
297 coll_help(category, table);
301 /* New Module missing */
302 find_coll_description(table, val, category);
304 static void _sg_cfg_cb__coll_gather(const char *name, int pos){
305 _sg_cfg_cb__coll("gather", mpi_coll_gather_description, name, pos);
307 static void _sg_cfg_cb__coll_allgather(const char *name, int pos){
308 _sg_cfg_cb__coll("allgather", mpi_coll_allgather_description, name, pos);
310 static void _sg_cfg_cb__coll_allgatherv(const char *name, int pos){
311 _sg_cfg_cb__coll("allgatherv", mpi_coll_allgatherv_description, name, pos);
313 static void _sg_cfg_cb__coll_allreduce(const char *name, int pos)
315 _sg_cfg_cb__coll("allreduce", mpi_coll_allreduce_description, name, pos);
317 static void _sg_cfg_cb__coll_alltoall(const char *name, int pos)
319 _sg_cfg_cb__coll("alltoall", mpi_coll_alltoall_description, name, pos);
321 static void _sg_cfg_cb__coll_alltoallv(const char *name, int pos)
323 _sg_cfg_cb__coll("alltoallv", mpi_coll_alltoallv_description, name, pos);
325 static void _sg_cfg_cb__coll_bcast(const char *name, int pos)
327 _sg_cfg_cb__coll("bcast", mpi_coll_bcast_description, name, pos);
329 static void _sg_cfg_cb__coll_reduce(const char *name, int pos)
331 _sg_cfg_cb__coll("reduce", mpi_coll_reduce_description, name, pos);
333 static void _sg_cfg_cb__coll_reduce_scatter(const char *name, int pos){
334 _sg_cfg_cb__coll("reduce_scatter", mpi_coll_reduce_scatter_description, name, pos);
336 static void _sg_cfg_cb__coll_scatter(const char *name, int pos){
337 _sg_cfg_cb__coll("scatter", mpi_coll_scatter_description, name, pos);
339 static void _sg_cfg_cb__coll_barrier(const char *name, int pos){
340 _sg_cfg_cb__coll("barrier", mpi_coll_barrier_description, name, pos);
343 static void _sg_cfg_cb__wtime_sleep(const char *name, int pos){
344 smpi_wtime_sleep = xbt_cfg_get_double(_sg_cfg_set, name);
347 static void _sg_cfg_cb__iprobe_sleep(const char *name, int pos){
348 smpi_iprobe_sleep = xbt_cfg_get_double(_sg_cfg_set, name);
351 static void _sg_cfg_cb__test_sleep(const char *name, int pos){
352 smpi_test_sleep = xbt_cfg_get_double(_sg_cfg_set, name);
359 /* callback of the inclusion path */
360 static void _sg_cfg_cb__surf_path(const char *name, int pos)
362 char *path = xbt_cfg_get_string_at(_sg_cfg_set, name, pos);
363 xbt_dynar_push(surf_path, &path);
366 /* callback to decide if we want to use the model-checking */
367 #include "xbt_modinter.h"
370 extern int _sg_do_model_check; /* this variable lives in xbt_main until I find a right location for it */
371 extern int _sg_do_model_check_record;
374 static void _sg_cfg_cb_model_check_replay(const char *name, int pos)
376 MC_record_path = xbt_cfg_get_string(_sg_cfg_set, name);
379 static void _sg_cfg_cb_model_check(const char *name, int pos)
382 _sg_do_model_check = xbt_cfg_get_boolean(_sg_cfg_set, name);
384 if (xbt_cfg_get_boolean(_sg_cfg_set, name)) {
385 xbt_die("You tried to activate the model-checking from the command line, but it was not compiled in. Change your settings in cmake, recompile and try again");
390 static void _sg_cfg_cb_model_check_record(const char *name, int pos)
393 _sg_do_model_check_record = xbt_cfg_get_boolean(_sg_cfg_set, name);
395 if (xbt_cfg_get_boolean(_sg_cfg_set, name)) {
396 xbt_die("You tried to activate the model-checking record from the command line, but it was not compiled in. Change your settings in cmake, recompile and try again");
401 extern int _sg_do_verbose_exit;
403 static void _sg_cfg_cb_verbose_exit(const char *name, int pos)
405 _sg_do_verbose_exit = xbt_cfg_get_boolean(_sg_cfg_set, name);
408 extern int _sg_do_clean_atexit;
410 static void _sg_cfg_cb_clean_atexit(const char *name, int pos)
412 _sg_do_clean_atexit = xbt_cfg_get_boolean(_sg_cfg_set, name);
415 static void _sg_cfg_cb_context_factory(const char *name, int pos)
417 smx_context_factory_name = xbt_cfg_get_string(_sg_cfg_set, name);
420 static void _sg_cfg_cb_context_stack_size(const char *name, int pos)
422 smx_context_stack_size_was_set = 1;
423 smx_context_stack_size = xbt_cfg_get_int(_sg_cfg_set, name) * 1024;
426 static void _sg_cfg_cb_context_guard_size(const char *name, int pos)
428 smx_context_guard_size_was_set = 1;
429 smx_context_guard_size = xbt_cfg_get_int(_sg_cfg_set, name) * xbt_pagesize;
432 static void _sg_cfg_cb_contexts_nthreads(const char *name, int pos)
434 SIMIX_context_set_nthreads(xbt_cfg_get_int(_sg_cfg_set, name));
437 static void _sg_cfg_cb_contexts_parallel_threshold(const char *name, int pos)
439 SIMIX_context_set_parallel_threshold(xbt_cfg_get_int(_sg_cfg_set, name));
442 static void _sg_cfg_cb_contexts_parallel_mode(const char *name, int pos)
444 const char* mode_name = xbt_cfg_get_string(_sg_cfg_set, name);
445 if (!strcmp(mode_name, "posix")) {
446 SIMIX_context_set_parallel_mode(XBT_PARMAP_POSIX);
448 else if (!strcmp(mode_name, "futex")) {
449 SIMIX_context_set_parallel_mode(XBT_PARMAP_FUTEX);
451 else if (!strcmp(mode_name, "busy_wait")) {
452 SIMIX_context_set_parallel_mode(XBT_PARMAP_BUSY_WAIT);
455 xbt_die("Command line setting of the parallel synchronization mode should "
456 "be one of \"posix\", \"futex\" or \"busy_wait\"");
460 static void _sg_cfg_cb__surf_network_coordinates(const char *name,
463 int val = xbt_cfg_get_boolean(_sg_cfg_set, name);
465 if (!COORD_HOST_LEVEL) {
466 COORD_HOST_LEVEL = xbt_lib_add_level(host_lib,xbt_dynar_free_voidp);
467 COORD_ASR_LEVEL = xbt_lib_add_level(as_router_lib,xbt_dynar_free_voidp);
470 if (COORD_HOST_LEVEL)
471 xbt_die("Setting of whether to use coordinate cannot be disabled once set.");
474 static void _sg_cfg_cb__surf_network_crosstraffic(const char *name,
477 sg_network_crosstraffic = xbt_cfg_get_boolean(_sg_cfg_set, name);
481 static void _sg_cfg_cb__gtnets_jitter(const char *name, int pos)
483 sg_gtnets_jitter = xbt_cfg_get_double(_sg_cfg_set, name);
486 static void _sg_cfg_cb__gtnets_jitter_seed(const char *name, int pos)
488 sg_gtnets_jitter_seed = xbt_cfg_get_int(_sg_cfg_set, name);
492 /* build description line with possible values */
493 static void describe_model(char *result,
494 const s_surf_model_description_t model_description[],
496 const char *description)
499 sprintf(result, "%s. Possible values: %s", description,
500 model_description[0].name ? model_description[0].name : "n/a");
502 for (i = 1; model_description[i].name; i++)
503 p += sprintf(p, ", %s", model_description[i].name);
505 ".\n (use 'help' as a value to see the long description of each %s)",
509 /* create the config set, register what should be and parse the command line*/
510 void sg_config_init(int *argc, char **argv)
512 char description[1024];
514 /* Create the configuration support */
515 if (_sg_cfg_init_status == 0) { /* Only create stuff if not already inited */
517 /* Plugins configuration */
518 describe_model(description, surf_plugin_description,
519 "plugin", "The plugins");
520 xbt_cfg_register(&_sg_cfg_set, "plugin", description,
521 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__plugin, NULL);
523 describe_model(description, surf_cpu_model_description,
524 "model", "The model to use for the CPU");
525 xbt_cfg_register(&_sg_cfg_set, "cpu/model", description,
526 xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__cpu_model, NULL);
527 xbt_cfg_setdefault_string(_sg_cfg_set, "cpu/model", "Cas01");
529 describe_model(description, surf_optimization_mode_description,
531 "The optimization modes to use for the CPU");
532 xbt_cfg_register(&_sg_cfg_set, "cpu/optim", description,
533 xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__optimization_mode, NULL);
534 xbt_cfg_setdefault_string(_sg_cfg_set, "cpu/optim", "Lazy");
536 describe_model(description, surf_storage_model_description,
537 "model", "The model to use for the storage");
538 xbt_cfg_register(&_sg_cfg_set, "storage/model", description,
539 xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__storage_mode, NULL);
540 xbt_cfg_setdefault_string(_sg_cfg_set, "storage/model", "default");
542 describe_model(description, surf_network_model_description,
543 "model", "The model to use for the network");
544 xbt_cfg_register(&_sg_cfg_set, "network/model", description,
545 xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__network_model, NULL);
546 xbt_cfg_setdefault_string(_sg_cfg_set, "network/model", "LV08");
548 describe_model(description, surf_optimization_mode_description,
550 "The optimization modes to use for the network");
551 xbt_cfg_register(&_sg_cfg_set, "network/optim", description,
552 xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__optimization_mode, NULL);
553 xbt_cfg_setdefault_string(_sg_cfg_set, "network/optim", "Lazy");
555 describe_model(description, surf_workstation_model_description,
556 "model", "The model to use for the workstation");
557 xbt_cfg_register(&_sg_cfg_set, "workstation/model", description,
558 xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__workstation_model, NULL);
559 xbt_cfg_setdefault_string(_sg_cfg_set, "workstation/model", "default");
561 describe_model(description, surf_vm_workstation_model_description,
562 "model", "The model to use for the vm workstation");
563 xbt_cfg_register(&_sg_cfg_set, "vm_workstation/model", description,
564 xbt_cfgelm_string, 1, 1, &_sg_cfg_cb__vm_workstation_model, NULL);
565 xbt_cfg_setdefault_string(_sg_cfg_set, "vm_workstation/model", "default");
567 xbt_cfg_register(&_sg_cfg_set, "network/TCP_gamma",
568 "Size of the biggest TCP window (cat /proc/sys/net/ipv4/tcp_[rw]mem for recv/send window; Use the last given value, which is the max window size)",
569 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__tcp_gamma, NULL);
570 xbt_cfg_setdefault_double(_sg_cfg_set, "network/TCP_gamma", 4194304.0);
572 xbt_cfg_register(&_sg_cfg_set, "surf/precision",
573 "Numerical precision used when updating simulation times (hence this value is expressed in seconds)",
574 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__surf_precision, NULL);
575 xbt_cfg_setdefault_double(_sg_cfg_set, "surf/precision", 0.00001);
577 xbt_cfg_register(&_sg_cfg_set, "maxmin/precision",
578 "Numerical precision used when computing resource sharing (hence this value is expressed in ops/sec or bytes/sec)",
579 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__maxmin_precision, NULL);
580 xbt_cfg_setdefault_double(_sg_cfg_set, "maxmin/precision", 0.00001);
582 /* The parameters of network models */
584 xbt_cfg_register(&_sg_cfg_set, "network/sender_gap",
585 "Minimum gap between two overlapping sends",
586 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__sender_gap, NULL);
587 /* real default for "network/sender_gap" is set in network_smpi.cpp */
588 xbt_cfg_setdefault_double(_sg_cfg_set, "network/sender_gap", NAN);
590 xbt_cfg_register(&_sg_cfg_set, "network/latency_factor",
591 "Correction factor to apply to the provided latency (default value set by network model)",
592 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__latency_factor, NULL);
593 xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0);
595 xbt_cfg_register(&_sg_cfg_set, "network/bandwidth_factor",
596 "Correction factor to apply to the provided bandwidth (default value set by network model)",
597 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__bandwidth_factor, NULL);
598 xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 1.0);
600 xbt_cfg_register(&_sg_cfg_set, "network/weight_S",
601 "Correction factor to apply to the weight of competing streams (default value set by network model)",
602 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__weight_S, NULL);
603 /* real default for "network/weight_S" is set in network_*.cpp */
604 xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", NAN);
607 xbt_cfg_register(&_sg_cfg_set, "path",
608 "Lookup path for inclusions in platform and deployment XML files",
609 xbt_cfgelm_string, 1, 0, _sg_cfg_cb__surf_path, NULL);
611 xbt_cfg_register(&_sg_cfg_set, "cpu/maxmin_selective_update",
612 "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)",
613 xbt_cfgelm_boolean, 1, 1, NULL, NULL);
614 xbt_cfg_setdefault_boolean(_sg_cfg_set, "cpu/maxmin_selective_update", "no");
616 xbt_cfg_register(&_sg_cfg_set, "network/maxmin_selective_update",
617 "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)",
618 xbt_cfgelm_boolean, 1, 1, NULL, NULL);
619 xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/maxmin_selective_update", "no");
621 /* Replay (this part is enabled event if MC it disabled) */
622 xbt_cfg_register(&_sg_cfg_set, "model-check/replay",
623 "Uenable replay mode with the given path",
624 xbt_cfgelm_string, 0, 1, _sg_cfg_cb_model_check_replay, NULL);
627 /* do model-checking */
628 xbt_cfg_register(&_sg_cfg_set, "model-check",
629 "Verify the system through model-checking instead of simulating it (EXPERIMENTAL)",
630 xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_model_check, NULL);
631 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check", "no");
633 /* do model-checking-record */
634 xbt_cfg_register(&_sg_cfg_set, "model-check/record",
635 "Record the model-checking paths",
636 xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_model_check_record, NULL);
637 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/record", "no");
639 /* do stateful model-checking */
640 xbt_cfg_register(&_sg_cfg_set, "model-check/checkpoint",
641 "Specify the amount of steps between checkpoints during stateful model-checking (default: 0 => stateless verification). "
642 "If value=1, one checkpoint is saved for each step => faster verification, but huge memory consumption; higher values are good compromises between speed and memory consumption.",
643 xbt_cfgelm_int, 1, 1, _mc_cfg_cb_checkpoint, NULL);
644 xbt_cfg_setdefault_int(_sg_cfg_set, "model-check/checkpoint", 0);
646 /* do stateful model-checking */
647 xbt_cfg_register(&_sg_cfg_set, "model-check/sparse-checkpoint",
648 "Use sparse per-page snapshots.",
649 xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_sparse_checkpoint, NULL);
650 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/sparse-checkpoint", "no");
652 /* do stateful model-checking */
653 xbt_cfg_register(&_sg_cfg_set, "model-check/soft-dirty",
654 "Use sparse per-page snapshots.",
655 xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_soft_dirty, NULL);
656 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/soft-dirty", "no");
658 /* do liveness model-checking */
659 xbt_cfg_register(&_sg_cfg_set, "model-check/property",
660 "Specify the name of the file containing the property. It must be the result of the ltl2ba program.",
661 xbt_cfgelm_string, 1, 1, _mc_cfg_cb_property, NULL);
662 xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/property", "");
664 /* do communications determinism model-checking */
665 xbt_cfg_register(&_sg_cfg_set, "model-check/communications_determinism",
666 "Enable/disable the detection of determinism in the communications schemes",
667 xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_comms_determinism, NULL);
668 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/communications_determinism", "no");
670 /* do send determinism model-checking */
671 xbt_cfg_register(&_sg_cfg_set, "model-check/send_determinism",
672 "Enable/disable the detection of send-determinism in the communications schemes",
673 xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_send_determinism, NULL);
674 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/send_determinism", "no");
676 /* Specify the kind of model-checking reduction */
677 xbt_cfg_register(&_sg_cfg_set, "model-check/reduction",
678 "Specify the kind of exploration reduction (either none or DPOR)",
679 xbt_cfgelm_string, 1, 1, _mc_cfg_cb_reduce, NULL);
680 xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/reduction", "dpor");
682 /* Enable/disable timeout for wait requests with model-checking */
683 xbt_cfg_register(&_sg_cfg_set, "model-check/timeout",
684 "Enable/Disable timeout for wait requests",
685 xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_timeout, NULL);
686 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/timeout", "no");
688 /* Enable/disable global hash computation with model-checking */
689 xbt_cfg_register(&_sg_cfg_set, "model-check/hash",
690 "Enable/Disable state hash for state comparison (exprimental)",
691 xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_hash, NULL);
692 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/hash", "no");
694 /* Set max depth exploration */
695 xbt_cfg_register(&_sg_cfg_set, "model-check/max_depth",
696 "Specify the max depth of exploration (default : 1000)",
697 xbt_cfgelm_int, 1, 1, _mc_cfg_cb_max_depth, NULL);
698 xbt_cfg_setdefault_int(_sg_cfg_set, "model-check/max_depth", 1000);
700 /* Set number of visited state stored for state comparison reduction*/
701 xbt_cfg_register(&_sg_cfg_set, "model-check/visited",
702 "Specify the number of visited state stored for state comparison reduction. If value=5, the last 5 visited states are stored",
703 xbt_cfgelm_int, 1, 1, _mc_cfg_cb_visited, NULL);
704 xbt_cfg_setdefault_int(_sg_cfg_set, "model-check/visited", 0);
706 /* Set file name for dot output of graph state */
707 xbt_cfg_register(&_sg_cfg_set, "model-check/dot_output",
708 "Specify the name of dot file corresponding to graph state",
709 xbt_cfgelm_string, 1, 1, _mc_cfg_cb_dot_output, NULL);
710 xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/dot_output", "");
712 /* Enable/disable non progressive cycles detection with model-checking */
713 xbt_cfg_register(&_sg_cfg_set, "model-check/termination",
714 "Enable/Disable non progressive cycle detection",
715 xbt_cfgelm_boolean, 1, 1, _mc_cfg_cb_termination, NULL);
716 xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check/termination", "no");
719 /* do verbose-exit */
720 xbt_cfg_register(&_sg_cfg_set, "verbose-exit",
721 "Activate the \"do nothing\" mode in Ctrl-C",
722 xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_verbose_exit, NULL);
723 xbt_cfg_setdefault_boolean(_sg_cfg_set, "verbose-exit", "yes");
725 /* context factory */
726 const char *dflt_ctx_fact = "thread";
728 char *p = description +
730 "Context factory to use in SIMIX. Possible values: %s",
732 #ifdef CONTEXT_UCONTEXT
733 dflt_ctx_fact = "ucontext";
734 p += sprintf(p, ", %s", dflt_ctx_fact);
737 dflt_ctx_fact = "raw";
738 p += sprintf(p, ", %s", dflt_ctx_fact);
742 xbt_cfg_register(&_sg_cfg_set, "contexts/factory", description,
743 xbt_cfgelm_string, 1, 1, _sg_cfg_cb_context_factory, NULL);
744 xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/factory", dflt_ctx_fact);
746 /* stack size of contexts in KiB */
747 xbt_cfg_register(&_sg_cfg_set, "contexts/stack_size",
748 "Stack size of contexts in KiB",
749 xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_stack_size, NULL);
750 xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/stack_size", 8*1024);
751 /* No, it was not set yet (the above setdefault() changed this to 1). */
752 smx_context_stack_size_was_set = 0;
754 /* guard size for contexts stacks in memory pages */
755 xbt_cfg_register(&_sg_cfg_set, "contexts/guard_size",
756 "Guard size for contexts stacks in memory pages",
757 xbt_cfgelm_int, 1, 1, _sg_cfg_cb_context_guard_size, NULL);
758 #if defined(_XBT_WIN32) || (PTH_STACKGROWTH != -1)
759 xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 0);
761 xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/guard_size", 1);
763 /* No, it was not set yet (the above setdefault() changed this to 1). */
764 smx_context_guard_size_was_set = 0;
766 /* number of parallel threads for user processes */
767 xbt_cfg_register(&_sg_cfg_set, "contexts/nthreads",
768 "Number of parallel threads used to execute user contexts",
769 xbt_cfgelm_int, 1, 1, _sg_cfg_cb_contexts_nthreads, NULL);
770 xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/nthreads", 1);
772 /* minimal number of user contexts to be run in parallel */
773 xbt_cfg_register(&_sg_cfg_set, "contexts/parallel_threshold",
774 "Minimal number of user contexts to be run in parallel (raw contexts only)",
775 xbt_cfgelm_int, 1, 1, _sg_cfg_cb_contexts_parallel_threshold, NULL);
776 xbt_cfg_setdefault_int(_sg_cfg_set, "contexts/parallel_threshold", 2);
778 /* synchronization mode for parallel user contexts */
779 xbt_cfg_register(&_sg_cfg_set, "contexts/synchro",
780 "Synchronization mode to use when running contexts in parallel (either futex, posix or busy_wait)",
781 xbt_cfgelm_string, 1, 1, _sg_cfg_cb_contexts_parallel_mode, NULL);
783 xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "futex");
784 #else //No futex on mac and posix is unimplememted yet
785 xbt_cfg_setdefault_string(_sg_cfg_set, "contexts/synchro", "busy_wait");
788 xbt_cfg_register(&_sg_cfg_set, "network/coordinates",
789 "\"yes\" or \"no\", specifying whether we use a coordinate-based routing (as Vivaldi)",
790 xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb__surf_network_coordinates, NULL);
791 xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/coordinates", "no");
793 xbt_cfg_register(&_sg_cfg_set, "network/crosstraffic",
794 "Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)",
795 xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb__surf_network_crosstraffic, NULL);
796 xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "no");
799 xbt_cfg_register(&_sg_cfg_set, "gtnets/jitter",
800 "Double value to oscillate the link latency, uniformly in random interval [-latency*gtnets_jitter,latency*gtnets_jitter)",
801 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__gtnets_jitter, NULL);
802 xbt_cfg_setdefault_double(_sg_cfg_set, "gtnets/jitter", 0.0);
804 xbt_cfg_register(&_sg_cfg_set, "gtnets/jitter_seed",
805 "Use a positive seed to reproduce jitted results, value must be in [1,1e8], default is 10",
806 xbt_cfgelm_int, 0, 1, _sg_cfg_cb__gtnets_jitter_seed, NULL);
807 xbt_cfg_setdefault_int(_sg_cfg_set, "gtnets/jitter_seed", 10);
810 xbt_cfg_register(&_sg_cfg_set, "ns3/TcpModel",
811 "The ns3 tcp model can be : NewReno or Reno or Tahoe",
812 xbt_cfgelm_string, 1, 1, NULL, NULL);
813 xbt_cfg_setdefault_string(_sg_cfg_set, "ns3/TcpModel", "default");
816 //For smpi/bw_factor and smpi/lat_factor
817 //Default value have to be "threshold0:value0;threshold1:value1;...;thresholdN:valueN"
818 //test is if( size >= thresholdN ) return valueN;
819 //Values can be modified with command line --cfg=smpi/bw_factor:"threshold0:value0;threshold1:value1;...;thresholdN:valueN"
820 // or with tag config put line <prop id="smpi/bw_factor" value="threshold0:value0;threshold1:value1;...;thresholdN:valueN"></prop>
821 // SMPI model can be used without enable_smpi, so keep this the ifdef.
822 xbt_cfg_register(&_sg_cfg_set, "smpi/bw_factor",
823 "Bandwidth factors for smpi.",
824 xbt_cfgelm_string, 1, 1, NULL, NULL);
825 xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/bw_factor", "65472:0.940694;15424:0.697866;9376:0.58729;5776:1.08739;3484:0.77493;1426:0.608902;732:0.341987;257:0.338112;0:0.812084");
827 xbt_cfg_register(&_sg_cfg_set, "smpi/lat_factor",
828 "Latency factors for smpi.",
829 xbt_cfgelm_string, 1, 1, NULL, NULL);
830 xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/lat_factor", "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;1426:1.61075;732:1.9503;257:1.95341;0:2.01467");
832 xbt_cfg_register(&_sg_cfg_set, "smpi/IB_penalty_factors",
833 "Correction factor to communications using Infiniband model with contention (default value based on Stampede cluster profiling)",
834 xbt_cfgelm_string, 1, 1, NULL, NULL);
835 xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/IB_penalty_factors", "0.965;0.925;1.35");
838 xbt_cfg_register(&_sg_cfg_set, "smpi/running_power",
839 "Power of the host running the simulation (in flop/s). Used to bench the operations.",
840 xbt_cfgelm_double, 1, 1, NULL, NULL);
841 xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/running_power", 20000.0);
843 xbt_cfg_register(&_sg_cfg_set, "smpi/display_timing",
844 "Boolean indicating whether we should display the timing after simulation.",
845 xbt_cfgelm_boolean, 1, 1, NULL, NULL);
846 xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/display_timing", "no");
848 xbt_cfg_register(&_sg_cfg_set, "smpi/simulate_computation",
849 "Boolean indicating whether the computational part of the simulated application should be simulated.",
850 xbt_cfgelm_boolean, 1, 1, NULL, NULL);
851 xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/simulate_computation", "yes");
853 xbt_cfg_register(&_sg_cfg_set, "smpi/use_shared_malloc",
854 "Boolean indicating whether we should use shared memory when using SMPI_SHARED_MALLOC. Allows user to disable it for debug purposes.",
855 xbt_cfgelm_boolean, 1, 1, NULL, NULL);
856 xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/use_shared_malloc", "yes");
858 xbt_cfg_register(&_sg_cfg_set, "smpi/cpu_threshold",
859 "Minimal computation time (in seconds) not discarded, or -1 for infinity.",
860 xbt_cfgelm_double, 1, 1, NULL, NULL);
861 xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/cpu_threshold", 1e-6);
863 xbt_cfg_register(&_sg_cfg_set, "smpi/async_small_thres",
864 "Maximal size of messages that are to be sent asynchronously, without waiting for the receiver",
865 xbt_cfgelm_int, 1, 1, NULL, NULL);
866 xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/async_small_thres", 0);
868 xbt_cfg_register(&_sg_cfg_set, "smpi/send_is_detached_thres",
869 "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend",
870 xbt_cfgelm_int, 1, 1, NULL, NULL);
871 xbt_cfg_setdefault_int(_sg_cfg_set, "smpi/send_is_detached_thres", 65536);
873 xbt_cfg_register(&_sg_cfg_set, "smpi/privatize_global_variables",
874 "Boolean indicating whether we should privatize global variable at runtime.",
875 xbt_cfgelm_boolean, 1, 1, NULL, NULL);
876 xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/privatize_global_variables", "no");
878 xbt_cfg_register(&_sg_cfg_set, "smpi/os",
879 "Small messages timings (MPI_Send minimum time for small messages)",
880 xbt_cfgelm_string, 1, 1, NULL, NULL);
881 xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/os", "1:0:0:0:0");
883 xbt_cfg_register(&_sg_cfg_set, "smpi/ois",
884 "Small messages timings (MPI_Isend minimum time for small messages)",
885 xbt_cfgelm_string, 1, 1, NULL, NULL);
886 xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/ois", "1:0:0:0:0");
888 xbt_cfg_register(&_sg_cfg_set, "smpi/or",
889 "Small messages timings (MPI_Recv minimum time for small messages)",
890 xbt_cfgelm_string, 1, 1, NULL, NULL);
891 xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/or", "1:0:0:0:0");
893 xbt_cfg_register(&_sg_cfg_set, "smpi/iprobe",
894 "Minimum time to inject inside a call to MPI_Iprobe",
895 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__iprobe_sleep, NULL);
896 xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/iprobe", 1e-4);
898 xbt_cfg_register(&_sg_cfg_set, "smpi/test",
899 "Minimum time to inject inside a call to MPI_Test",
900 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__test_sleep, NULL);
901 xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/test", 1e-4);
903 xbt_cfg_register(&_sg_cfg_set, "smpi/wtime",
904 "Minimum time to inject inside a call to MPI_Wtime",
905 xbt_cfgelm_double, 1, 1, _sg_cfg_cb__wtime_sleep, NULL);
906 xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/wtime", 0.0);
908 xbt_cfg_register(&_sg_cfg_set, "smpi/coll_selector",
909 "Which collective selector to use",
910 xbt_cfgelm_string, 1, 1, NULL, NULL);
911 xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/coll_selector", "default");
913 xbt_cfg_register(&_sg_cfg_set, "smpi/gather",
914 "Which collective to use for gather",
915 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_gather, NULL);
917 xbt_cfg_register(&_sg_cfg_set, "smpi/allgather",
918 "Which collective to use for allgather",
919 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgather, NULL);
921 xbt_cfg_register(&_sg_cfg_set, "smpi/barrier",
922 "Which collective to use for barrier",
923 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_barrier, NULL);
925 xbt_cfg_register(&_sg_cfg_set, "smpi/reduce_scatter",
926 "Which collective to use for reduce_scatter",
927 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce_scatter, NULL);
929 xbt_cfg_register(&_sg_cfg_set, "smpi/scatter",
930 "Which collective to use for scatter",
931 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_scatter, NULL);
933 xbt_cfg_register(&_sg_cfg_set, "smpi/allgatherv",
934 "Which collective to use for allgatherv",
935 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allgatherv, NULL);
937 xbt_cfg_register(&_sg_cfg_set, "smpi/allreduce",
938 "Which collective to use for allreduce",
939 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_allreduce, NULL);
941 xbt_cfg_register(&_sg_cfg_set, "smpi/alltoall",
942 "Which collective to use for alltoall",
943 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoall, NULL);
945 xbt_cfg_register(&_sg_cfg_set, "smpi/alltoallv",
946 "Which collective to use for alltoallv",
947 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_alltoallv, NULL);
949 xbt_cfg_register(&_sg_cfg_set, "smpi/bcast",
950 "Which collective to use for bcast",
951 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_bcast, NULL);
953 xbt_cfg_register(&_sg_cfg_set, "smpi/reduce",
954 "Which collective to use for reduce",
955 xbt_cfgelm_string, 0, 1, &_sg_cfg_cb__coll_reduce, NULL);
958 xbt_cfg_register(&_sg_cfg_set, "clean_atexit",
959 "\"yes\" or \"no\". \"yes\" enables all the cleanups of SimGrid (XBT,SIMIX,MSG) to be registered with atexit. \"no\" may be useful if your code segfaults when calling the exit function.",
960 xbt_cfgelm_boolean, 1, 1, _sg_cfg_cb_clean_atexit, NULL);
961 xbt_cfg_setdefault_boolean(_sg_cfg_set, "clean_atexit", "yes");
964 /* retrieves the current directory of the current process */
965 const char *initial_path = __surf_get_initial_path();
966 xbt_assert((initial_path),
967 "__surf_get_initial_path() failed! Can't resolves current Windows directory");
969 surf_path = xbt_dynar_new(sizeof(char *), NULL);
970 xbt_cfg_setdefault_string(_sg_cfg_set, "path", initial_path);
973 xbt_cfg_check(_sg_cfg_set);
974 _sg_cfg_init_status = 1;
976 sg_config_cmd_line(argc, argv);
978 xbt_mallocator_initialization_is_done(SIMIX_context_is_parallel());
981 XBT_WARN("Call to sg_config_init() after initialization ignored");
985 void sg_config_finalize(void)
987 if (!_sg_cfg_init_status)
988 return; /* Not initialized yet. Nothing to do */
990 xbt_cfg_free(&_sg_cfg_set);
991 _sg_cfg_init_status = 0;
994 /* Pick the right models for CPU, net and workstation, and call their model_init_preparse */
995 void surf_config_models_setup()
997 const char *workstation_model_name;
998 const char *vm_workstation_model_name;
999 int workstation_id = -1;
1000 int vm_workstation_id = -1;
1001 char *network_model_name = NULL;
1002 char *cpu_model_name = NULL;
1003 int storage_id = -1;
1004 char *storage_model_name = NULL;
1006 workstation_model_name =
1007 xbt_cfg_get_string(_sg_cfg_set, "workstation/model");
1008 vm_workstation_model_name =
1009 xbt_cfg_get_string(_sg_cfg_set, "vm_workstation/model");
1010 network_model_name = xbt_cfg_get_string(_sg_cfg_set, "network/model");
1011 cpu_model_name = xbt_cfg_get_string(_sg_cfg_set, "cpu/model");
1012 storage_model_name = xbt_cfg_get_string(_sg_cfg_set, "storage/model");
1014 /* Check whether we use a net/cpu model differing from the default ones, in which case
1015 * we should switch to the "compound" workstation model to correctly dispatch stuff to
1016 * the right net/cpu models.
1019 if ((!xbt_cfg_is_default_value(_sg_cfg_set, "network/model") ||
1020 !xbt_cfg_is_default_value(_sg_cfg_set, "cpu/model")) &&
1021 xbt_cfg_is_default_value(_sg_cfg_set, "workstation/model")) {
1022 XBT_INFO("Switching workstation model to compound since you changed the network and/or cpu model(s)");
1023 workstation_model_name = "compound";
1024 xbt_cfg_set_string(_sg_cfg_set, "workstation/model", workstation_model_name);
1027 XBT_DEBUG("Workstation model: %s", workstation_model_name);
1029 find_model_description(surf_workstation_model_description,
1030 workstation_model_name);
1031 if (!strcmp(workstation_model_name, "compound")) {
1032 int network_id = -1;
1035 xbt_assert(cpu_model_name,
1036 "Set a cpu model to use with the 'compound' workstation model");
1038 xbt_assert(network_model_name,
1039 "Set a network model to use with the 'compound' workstation model");
1041 if(surf_cpu_model_init_preparse){
1042 surf_cpu_model_init_preparse();
1045 find_model_description(surf_cpu_model_description, cpu_model_name);
1046 surf_cpu_model_description[cpu_id].model_init_preparse();
1050 find_model_description(surf_network_model_description,
1051 network_model_name);
1052 surf_network_model_description[network_id].model_init_preparse();
1055 XBT_DEBUG("Call workstation_model_init");
1056 surf_workstation_model_description[workstation_id].model_init_preparse();
1058 XBT_DEBUG("Call vm_workstation_model_init");
1059 vm_workstation_id = find_model_description(surf_vm_workstation_model_description,
1060 vm_workstation_model_name);
1061 surf_vm_workstation_model_description[vm_workstation_id].model_init_preparse();
1063 XBT_DEBUG("Call storage_model_init");
1064 storage_id = find_model_description(surf_storage_model_description, storage_model_name);
1065 surf_storage_model_description[storage_id].model_init_preparse();
1069 int sg_cfg_is_default_value(const char *name)
1071 return xbt_cfg_is_default_value(_sg_cfg_set, name);
1074 int sg_cfg_get_int(const char* name)
1076 return xbt_cfg_get_int(_sg_cfg_set, name);
1079 double sg_cfg_get_double(const char* name)
1081 return xbt_cfg_get_double(_sg_cfg_set, name);
1084 char* sg_cfg_get_string(const char* name)
1086 return xbt_cfg_get_string(_sg_cfg_set, name);
1089 int sg_cfg_get_boolean(const char* name)
1091 return xbt_cfg_get_boolean(_sg_cfg_set, name);
1094 void sg_cfg_get_peer(const char *name, char **peer, int *port)
1096 xbt_cfg_get_peer(_sg_cfg_set, name, peer, port);
1099 xbt_dynar_t sg_cfg_get_dynar(const char* name)
1101 return xbt_cfg_get_dynar(_sg_cfg_set, name);