Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid to put smpi symbols in libsimgrid.
[simgrid.git] / src / simgrid / sg_config.c
index c39e34e..c325e2a 100644 (file)
 #include "xbt/log.h"
 #include "xbt/mallocator.h"
 #include "xbt/str.h"
-#include "surf/surf_private.h"
-#include "surf/surf_routing.h"  /* COORD_HOST_LEVEL and COORD_ASR_LEVEL */
+#include "xbt/lib.h" 
+#include "xbt/sysdep.h"
+#include "surf/surf.h"
+#include "surf/maxmin.h"
+#include "instr/instr_interface.h"
 #include "simgrid/simix.h"
 #include "simgrid/sg_config.h"
-#include "mc/mc.h" 
+#include "smpi/smpi_interface.h"
+#include "mc/mc.h"
+#include "instr/instr.h"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_config, surf,
                                 "About the configuration of simgrid");
 
 xbt_cfg_t _sg_cfg_set = NULL;
 
-int _sg_do_model_check = 0;
-int _surf_mc_checkpoint=0;
-char* _surf_mc_property_file=NULL;
-int _surf_mc_timeout=0;
-int _surf_mc_max_depth=1000;
-int _surf_mc_visited=0;
-
 int _sg_init_status = 0;      /* 0: beginning of time (config cannot be changed yet);
                                   1: initialized: cfg_set created (config can now be changed);
                                   2: configured: command line parsed and config part of platform file was integrated also, platform construction ongoing or done.
@@ -101,7 +99,6 @@ static void sg_config_cmd_line(int *argc, char **argv)
   }
 }
 
-
 /* callback of the workstation/model variable */
 static void _sg_cfg_cb__workstation_model(const char *name, int pos)
 {
@@ -238,14 +235,16 @@ static void _sg_cfg_cb__surf_path(const char *name, int pos)
 
 /* callback to decide if we want to use the model-checking */
 #include "xbt_modinter.h"
+#ifdef HAVE_MC
 extern int _sg_do_model_check;   /* this variable lives in xbt_main until I find a right location for it */
+#endif
 
 static void _sg_cfg_cb_model_check(const char *name, int pos)
 {
+#ifdef HAVE_MC
   _sg_do_model_check = xbt_cfg_get_int(_sg_cfg_set, name);
-
-#ifndef HAVE_MC
-  if (_sg_do_model_check) {
+#else
+  if (xbt_cfg_get_int(_sg_cfg_set, name)) {
     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");
   }
 #endif
@@ -297,11 +296,6 @@ static void _sg_cfg_cb_contexts_parallel_mode(const char *name, int pos)
   }
 }
 
-static void _sg_cfg_cb_surf_nthreads(const char *name, int pos)
-{
-  surf_set_nthreads(xbt_cfg_get_int(_sg_cfg_set, name));
-}
-
 static void _sg_cfg_cb__surf_network_coordinates(const char *name,
                                                    int pos)
 {
@@ -319,6 +313,11 @@ static void _sg_cfg_cb__surf_network_coordinates(const char *name,
   }
 }
 
+static void _sg_cfg_cb_surf_nthreads(const char *name, int pos)
+{
+  surf_set_nthreads(xbt_cfg_get_int(_sg_cfg_set, name));
+}
+
 static void _sg_cfg_cb__surf_network_crosstraffic(const char *name,
                                                   int pos)
 {
@@ -346,6 +345,9 @@ void sg_config_init(int *argc, char **argv)
   int default_value_int;
   int i;
 
+  TRACE_add_start_function(TRACE_surf_alloc);
+  TRACE_add_end_function(TRACE_surf_release);
+
   /* Create the configuration support */
   if (_sg_init_status == 0) { /* Only create stuff if not already inited */
     sprintf(description,
@@ -457,17 +459,16 @@ void sg_config_init(int *argc, char **argv)
     xbt_cfg_register(&_sg_cfg_set, "maxmin/precision",
                      "Numerical precision used when updating simulation models (epsilon in double comparisons)",
                      xbt_cfgelm_double, NULL, 1, 1, _sg_cfg_cb__maxmin_precision, NULL);
-    xbt_cfg_setdefault_double(_sg_cfg_set, "maxmin/precision", 0.00001); // FIXME use setdefault everywhere here!
+    xbt_cfg_setdefault_double(_sg_cfg_set, "maxmin/precision", 0.00001); 
 
     /* The parameters of network models */
 
-    double_default_value = 0.0;
     xbt_cfg_register(&_sg_cfg_set, "network/sender_gap",
                      "Minimum gap between two overlapping sends",
-                     xbt_cfgelm_double, &double_default_value, 1, 1,
+                     xbt_cfgelm_double, NULL, 1, 1, /* default is set in network.c */
                      _sg_cfg_cb__sender_gap, NULL);
 
-    double_default_value = 1.0;
+    double_default_value = 1.0; // FIXME use setdefault everywhere here!
     xbt_cfg_register(&_sg_cfg_set, "network/latency_factor",
                      "Correction factor to apply to the provided latency (default value set by network model)",
                      xbt_cfgelm_double, &double_default_value, 1, 1,
@@ -477,10 +478,10 @@ void sg_config_init(int *argc, char **argv)
                      "Correction factor to apply to the provided bandwidth (default value set by network model)",
                      xbt_cfgelm_double, &double_default_value, 1, 1,
                      _sg_cfg_cb__bandwidth_factor, NULL);
-    double_default_value = 0.0;
+
     xbt_cfg_register(&_sg_cfg_set, "network/weight_S",
                      "Correction factor to apply to the weight of competing streams(default value set by network model)",
-                     xbt_cfgelm_double, &double_default_value, 1, 1,
+                     xbt_cfgelm_double, NULL, 1, 1, /* default is set in network.c */
                      _sg_cfg_cb__weight_S, NULL);
 
     /* Inclusion path */