Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
smpi: some useless cleanups while I read this code
[simgrid.git] / src / simgrid / sg_config.cpp
index 29ed310..1bf0f9f 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();
@@ -299,9 +299,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 +354,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.",
@@ -456,10 +455,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", "./");