Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add option "smpi/auto-shared-malloc-thresh"
[simgrid.git] / src / simgrid / sg_config.cpp
index 29ed310..2b8cdc2 100644 (file)
@@ -63,39 +63,39 @@ static void sg_config_cmd_line(int *argc, char **argv)
       sg_version();
       shall_exit = true;
     } else if (parse_args && (not strcmp(argv[i], "--cfg-help") || not strcmp(argv[i], "--help"))) {
-      printf("Description of the configuration accepted by this simulator:\n");
+      XBT_HELP("Description of the configuration accepted by this simulator:");
       simgrid::config::help();
-      printf(
-          "\n"
-          "Each of these configurations can be used by adding\n"
-          "    --cfg=<option name>:<option value>\n"
-          "to the command line.\n"
-          "\n"
-          "For more information, please refer to:\n"
-          "   --help-aliases for the list of all option aliases.\n"
-          "   --help-logs and --help-log-categories for the details of logging output.\n"
-          "   --help-models for a list of all models known by this simulator.\n"
-          "   --help-tracing for the details of all tracing options known by this simulator.\n"
-          "   --version to get SimGrid version information.\n"
-          "\n"
-        );
+      XBT_HELP("\n"
+               "Each of these configurations can be used by adding\n"
+               "    --cfg=<option name>:<option value>\n"
+               "to the command line. Try passing \"help\" as a value\n"
+               "to get the list of values accepted by a given option.\n"
+               "For example, \"--cfg=plugin:help\" gives you the list of\n"
+               "plugins available in your installation of SimGrid.\n"
+               "\n"
+               "For more information, please refer to:\n"
+               "   --help-aliases for the list of all option aliases.\n"
+               "   --help-logs and --help-log-categories for the details of logging output.\n"
+               "   --help-models for a list of all models known by this simulator.\n"
+               "   --help-tracing for the details of all tracing options known by this simulator.\n"
+               "   --version to get SimGrid version information.\n");
       shall_exit = not cfg_continue_after_help;
       argv[j++]  = argv[i]; // Preserve the --help in argv just in case someone else wants to see it
     } else if (parse_args && not strcmp(argv[i], "--help-aliases")) {
-      printf("Here is a list of all deprecated option names, with their replacement.\n");
+      XBT_HELP("Here is a list of all deprecated option names, with their replacement.");
       simgrid::config::show_aliases();
-      printf("Please consider using the recent names\n");
+      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);
-      printf("\n");
+      XBT_HELP("%s", "");
       model_help("CPU", surf_cpu_model_description);
-      printf("\n");
+      XBT_HELP("%s", "");
       model_help("network", surf_network_model_description);
-      printf("\nLong description of all optimization levels accepted by the models of this simulator:\n");
+      XBT_HELP("\nLong description of all optimization levels accepted by the models of this simulator:");
       for (auto const& item : surf_optimization_mode_description)
-        printf("  %s: %s\n", item.name, item.description);
-      printf("Both network and CPU models have 'Lazy' as default optimization level\n\n");
+        XBT_HELP("  %s: %s", item.name, item.description);
+      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")) {
       TRACE_help();
@@ -171,8 +171,20 @@ static void _sg_cfg_cb__optimization_mode(const std::string& value)
   find_model_description(surf_optimization_mode_description, value);
 }
 
+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);
+    exit(0);
+  }
+
+  find_model_description(surf_disk_model_description, value);
+}
+
 /* callback of the cpu/model variable */
-static void _sg_cfg_cb__storage_mode(const std::string& value)
+static void _sg_cfg_cb__storage_model(const std::string& value)
 {
   xbt_assert(_sg_cfg_init_status < 2, "Cannot change the model after the initialization");
 
@@ -243,7 +255,10 @@ void sg_config_init(int *argc, char **argv)
   declare_model_flag("cpu/model", "Cas01", &_sg_cfg_cb__cpu_model, surf_cpu_model_description, "model",
                      "The model to use for the CPU");
 
-  declare_model_flag("storage/model", "default", &_sg_cfg_cb__storage_mode, surf_storage_model_description, "model",
+  declare_model_flag("disk/model", "default", &_sg_cfg_cb__disk_model, surf_disk_model_description, "model",
+                     "The model to use for the disk");
+
+  declare_model_flag("storage/model", "default", &_sg_cfg_cb__storage_model, surf_storage_model_description, "model",
                      "The model to use for the storage");
 
   declare_model_flag("network/model", "LV08", &_sg_cfg_cb__network_model, surf_network_model_description, "model",
@@ -299,9 +314,6 @@ void sg_config_init(int *argc, char **argv)
                                       "no");
   simgrid::config::alias("network/maxmin-selective-update", {"network/maxmin_selective_update"});
 
-  extern bool _sg_do_verbose_exit;
-  simgrid::config::bind_flag(_sg_do_verbose_exit, "verbose-exit", "Activate the \"do nothing\" mode in Ctrl-C");
-
   simgrid::config::declare_flag<int>("contexts/stack-size", "Stack size of contexts in KiB (not with threads)",
                                      8 * 1024, [](int value) { smx_context_stack_size = value * 1024; });
   simgrid::config::alias("contexts/stack-size", {"contexts/stack_size"});
@@ -357,7 +369,9 @@ void sg_config_init(int *argc, char **argv)
 #if HAVE_SMPI
   simgrid::config::declare_flag<double>("smpi/host-speed", "Speed of the host running the simulation (in flop/s). "
                                                            "Used to bench the operations.",
-                                        20000.0);
+                                        20000.0, [](const double& val) {
+      xbt_assert(val > 0.0, "Invalid value (%f) for 'smpi/host-speed': it must be positive.", val);
+    });
   simgrid::config::alias("smpi/host-speed", {"smpi/running_power", "smpi/running-power"});
 
   simgrid::config::declare_flag<bool>("smpi/keep-temps", "Whether we should keep the generated temporary files.",
@@ -378,6 +392,10 @@ void sg_config_init(int *argc, char **argv)
   simgrid::config::declare_flag<double>("smpi/shared-malloc-blocksize",
                                         "Size of the bogus file which will be created for global shared allocations",
                                         1UL << 20);
+  simgrid::config::declare_flag<double>("smpi/auto-shared-malloc-thresh",
+                                        "Threshold size for the automatic sharing of memory",
+                                        0);
+
   simgrid::config::declare_flag<std::string>("smpi/shared-malloc-hugepage",
                                              "Path to a mounted hugetlbfs, to use huge pages with shared malloc.", "");
 
@@ -392,7 +410,8 @@ void sg_config_init(int *argc, char **argv)
 
   simgrid::config::declare_flag<bool>("smpi/trace-call-location",
                                       "Should filename and linenumber of MPI calls be traced?", false);
-
+  simgrid::config::declare_flag<bool>("smpi/trace-call-use-absolute-path",
+                                      "Should filenames for trace-call tracing be absolute or not?", false);
   simgrid::config::declare_flag<int>(
       "smpi/send-is-detached-thresh",
       "Threshold of message size where MPI_Send stops behaving like MPI_Isend and becomes MPI_Ssend", 65536);
@@ -456,10 +475,6 @@ void sg_config_init(int *argc, char **argv)
   simgrid::config::declare_flag<bool>(
       "exception/cutpath", "Whether to cut all path information from call traces, used e.g. in exceptions.", false);
 
-  extern bool _sg_do_clean_atexit;
-  simgrid::config::bind_flag(_sg_do_clean_atexit, "clean-atexit", {"clean_atexit"},
-                             "Whether to cleanup SimGrid at exit. Disable it if your code segfaults after its end.");
-
   if (surf_path.empty())
     simgrid::config::set_default<std::string>("path", "./");