Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
attempt to make valgrind happier
[simgrid.git] / src / simgrid / sg_config.c
index d600f19..f61b9e3 100644 (file)
@@ -279,6 +279,12 @@ static void _sg_cfg_cb__coll_reduce(const char *name, int pos)
 static void _sg_cfg_cb__coll_reduce_scatter(const char *name, int pos){
   _sg_cfg_cb__coll("reduce_scatter", mpi_coll_reduce_scatter_description, name, pos);
 }
+static void _sg_cfg_cb__coll_scatter(const char *name, int pos){
+  _sg_cfg_cb__coll("scatter", mpi_coll_scatter_description, name, pos);
+}
+static void _sg_cfg_cb__coll_barrier(const char *name, int pos){
+  _sg_cfg_cb__coll("barrier", mpi_coll_barrier_description, name, pos);
+}
 #endif
 
 /* callback of the inclusion path */
@@ -312,6 +318,12 @@ static void _sg_cfg_cb_verbose_exit(const char *name, int pos)
   _sg_do_verbose_exit = xbt_cfg_get_boolean(_sg_cfg_set, name);
 }
 
+extern int _sg_do_clean_atexit;
+
+static void _sg_cfg_cb_clean_atexit(const char *name, int pos)
+{
+  _sg_do_clean_atexit = xbt_cfg_get_boolean(_sg_cfg_set, name);
+}
 
 static void _sg_cfg_cb_context_factory(const char *name, int pos) {
   smx_context_factory_name = xbt_cfg_get_string(_sg_cfg_set, name);
@@ -534,12 +546,12 @@ void sg_config_init(int *argc, char **argv)
                      xbt_cfgelm_string, NULL, 0, 0,
                      _sg_cfg_cb__surf_path, NULL);
 
-    default_value = xbt_strdup("off");
+    default_value = (char*)"off";
     xbt_cfg_register(&_sg_cfg_set, "cpu/maxmin_selective_update",
                      "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)",
                      xbt_cfgelm_boolean, &default_value, 0, 1,
                      NULL, NULL);
-    default_value = xbt_strdup("off");
+    default_value = (char*)"off";
     xbt_cfg_register(&_sg_cfg_set, "network/maxmin_selective_update",
                      "Update the constraint set propagating recursively to others constraints (off by default when optim is set to lazy)",
                      xbt_cfgelm_boolean, &default_value, 0, 1,
@@ -547,7 +559,7 @@ void sg_config_init(int *argc, char **argv)
 
 #ifdef HAVE_MC
     /* do model-checking */
-    default_value = xbt_strdup("off");
+    default_value = (char*)"off";
     xbt_cfg_register(&_sg_cfg_set, "model-check",
                      "Verify the system through model-checking instead of simulating it (EXPERIMENTAL)",
                      xbt_cfgelm_boolean, NULL, 0, 1,
@@ -555,7 +567,7 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_setdefault_boolean(_sg_cfg_set, "model-check", default_value);
 
     /* do stateful model-checking */
-    default_value = xbt_strdup("off");
+    default_value = (char*)"off";
     xbt_cfg_register(&_sg_cfg_set, "model-check/checkpoint",
                      "Specify the amount of steps between checkpoints during stateful model-checking (default: off => stateless verification). "
                      "If value=on, one checkpoint is saved for each step => faster verification, but huge memory consumption; higher values are good compromises between speed and memory consumption.",
@@ -578,7 +590,7 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_setdefault_string(_sg_cfg_set, "model-check/reduction", "dpor");
 
     /* Enable/disable timeout for wait requests with model-checking */
-    default_value = xbt_strdup("off");
+    default_value = (char*)"off";
     xbt_cfg_register(&_sg_cfg_set, "model-check/timeout",
                      "Enable/Disable timeout for wait requests",
                      xbt_cfgelm_boolean, NULL, 0, 1,
@@ -608,7 +620,7 @@ void sg_config_init(int *argc, char **argv)
 #endif
 
     /* do verbose-exit */
-    default_value = xbt_strdup("on");
+    default_value = (char*)"on";
     xbt_cfg_register(&_sg_cfg_set, "verbose-exit",
                      "Activate the \"do nothing\" mode in Ctrl-C",
                      xbt_cfgelm_boolean, &default_value, 0, 1,
@@ -653,14 +665,14 @@ void sg_config_init(int *argc, char **argv)
         xbt_cfgelm_string, &default_value, 1, 1,
         _sg_cfg_cb_contexts_parallel_mode, NULL);
 
-    default_value = xbt_strdup("no");
+    default_value = (char*)"no";
     xbt_cfg_register(&_sg_cfg_set, "network/coordinates",
                      "\"yes\" or \"no\", specifying whether we use a coordinate-based routing (as Vivaldi)",
                      xbt_cfgelm_boolean, &default_value, 1, 1,
                      _sg_cfg_cb__surf_network_coordinates, NULL);
     xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/coordinates", default_value);
 
-    default_value = xbt_strdup("no");
+    default_value = (char*)"no";
     xbt_cfg_register(&_sg_cfg_set, "network/crosstraffic",
                      "Activate the interferences between uploads and downloads for fluid max-min models (LV08, CM02)",
                      xbt_cfgelm_boolean, &default_value, 0, 1,
@@ -702,6 +714,13 @@ void sg_config_init(int *argc, char **argv)
                      NULL);
     xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/display_timing", default_value);
 
+    default_value = (char*)"yes";
+    xbt_cfg_register(&_sg_cfg_set, "smpi/use_shared_malloc",
+                     "Boolean indicating whether we should use shared memory when using SMPI_SHARED_MALLOC. Allows user to disable it for debug purposes.",
+                     xbt_cfgelm_boolean, &default_value, 1, 1, NULL,
+                     NULL);
+    xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/use_shared_malloc", default_value);
+    
     double default_threshold = 1e-6;
     xbt_cfg_register(&_sg_cfg_set, "smpi/cpu_threshold",
                      "Minimal computation time (in seconds) not discarded.",
@@ -775,11 +794,21 @@ void sg_config_init(int *argc, char **argv)
                     xbt_cfgelm_string, NULL, 1, 1, &_sg_cfg_cb__coll_allgather,
                     NULL);
 
+    xbt_cfg_register(&_sg_cfg_set, "smpi/barrier",
+                    "Which collective to use for barrier",
+                    xbt_cfgelm_string, NULL, 1, 1, &_sg_cfg_cb__coll_barrier,
+                    NULL);
+
     xbt_cfg_register(&_sg_cfg_set, "smpi/reduce_scatter",
                     "Which collective to use for reduce_scatter",
                     xbt_cfgelm_string, NULL, 1, 1, &_sg_cfg_cb__coll_reduce_scatter,
                     NULL);
 
+    xbt_cfg_register(&_sg_cfg_set, "smpi/scatter",
+                    "Which collective to use for scatter",
+                    xbt_cfgelm_string, NULL, 1, 1, &_sg_cfg_cb__coll_scatter,
+                    NULL);
+
     xbt_cfg_register(&_sg_cfg_set, "smpi/allgatherv",
                     "Which collective to use for allgatherv",
                     xbt_cfgelm_string, NULL, 1, 1, &_sg_cfg_cb__coll_allgatherv,
@@ -811,6 +840,13 @@ void sg_config_init(int *argc, char **argv)
                     NULL);
 #endif // HAVE_SMPI
 
+    default_value = (char*)"yes";
+    xbt_cfg_register(&_sg_cfg_set, "clean_atexit",
+                     "\"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.",
+                     xbt_cfgelm_boolean, &default_value, 1, 1,
+                     _sg_cfg_cb_clean_atexit, NULL);
+    xbt_cfg_setdefault_boolean(_sg_cfg_set, "clean_atexit", default_value);
+
     if (!surf_path) {
       /* retrieves the current directory of the        current process */
       const char *initial_path = __surf_get_initial_path();