Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Change xbt_cfg_get_string -> simgrid::config::get_config<std::string>.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 11:03:03 +0000 (13:03 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Thu, 19 Apr 2018 14:06:43 +0000 (16:06 +0200)
13 files changed:
src/instr/instr_config.cpp
src/simix/smx_context.cpp
src/smpi/colls/smpi_coll.cpp
src/smpi/internals/SmpiHost.cpp
src/smpi/internals/smpi_bench.cpp
src/smpi/internals/smpi_global.cpp
src/smpi/internals/smpi_process.cpp
src/smpi/internals/smpi_shared.cpp
src/surf/network_cm02.cpp
src/surf/network_ib.cpp
src/surf/network_smpi.cpp
src/surf/plugins/host_dvfs.cpp
src/surf/sg_platf.cpp

index 37a1015..4acb268 100644 (file)
@@ -86,7 +86,7 @@ int TRACE_start()
     /* init the tracing module to generate the right output */
 
     /* open the trace file(s) */
     /* init the tracing module to generate the right output */
 
     /* open the trace file(s) */
-    std::string format = xbt_cfg_get_string(OPT_TRACING_FORMAT);
+    std::string format = simgrid::config::get_config<std::string>(OPT_TRACING_FORMAT);
     XBT_DEBUG("Tracing format %s\n", format.c_str());
     if (format == "Paje") {
       TRACE_paje_start();
     XBT_DEBUG("Tracing format %s\n", format.c_str());
     if (format == "Paje") {
       TRACE_paje_start();
@@ -125,7 +125,7 @@ int TRACE_end()
     delete root_type;
 
     /* close the trace files */
     delete root_type;
 
     /* close the trace files */
-    std::string format = xbt_cfg_get_string(OPT_TRACING_FORMAT);
+    std::string format = simgrid::config::get_config<std::string>(OPT_TRACING_FORMAT);
     XBT_DEBUG("Tracing format %s\n", format.c_str());
     if (format == "Paje") {
       TRACE_paje_end();
     XBT_DEBUG("Tracing format %s\n", format.c_str());
     if (format == "Paje") {
       TRACE_paje_end();
@@ -241,12 +241,12 @@ bool TRACE_display_sizes ()
 
 std::string TRACE_get_comment()
 {
 
 std::string TRACE_get_comment()
 {
-  return xbt_cfg_get_string(OPT_TRACING_COMMENT);
+  return simgrid::config::get_config<std::string>(OPT_TRACING_COMMENT);
 }
 
 std::string TRACE_get_comment_file()
 {
 }
 
 std::string TRACE_get_comment_file()
 {
-  return xbt_cfg_get_string(OPT_TRACING_COMMENT_FILE);
+  return simgrid::config::get_config<std::string>(OPT_TRACING_COMMENT_FILE);
 }
 
 int TRACE_precision ()
 }
 
 int TRACE_precision ()
@@ -256,7 +256,7 @@ int TRACE_precision ()
 
 std::string TRACE_get_filename()
 {
 
 std::string TRACE_get_filename()
 {
-  return xbt_cfg_get_string(OPT_TRACING_FILENAME);
+  return simgrid::config::get_config<std::string>(OPT_TRACING_FILENAME);
 }
 
 void TRACE_global_init()
 }
 
 void TRACE_global_init()
index 2cc924b..719f7d6 100644 (file)
@@ -107,7 +107,7 @@ void SIMIX_context_mod_init()
 #endif
 
 #if HAVE_SMPI && (defined(__APPLE__) || defined(__NetBSD__))
 #endif
 
 #if HAVE_SMPI && (defined(__APPLE__) || defined(__NetBSD__))
-  std::string priv = xbt_cfg_get_string("smpi/privatization");
+  std::string priv = simgrid::config::get_config<std::string>("smpi/privatization");
   if (context_factory_name == "thread" && (priv == "dlopen" || priv == "yes" || priv == "default" || priv == "1")) {
     XBT_WARN("dlopen+thread broken on Apple and BSD. Switching to raw contexts.");
     context_factory_name = "raw";
   if (context_factory_name == "thread" && (priv == "dlopen" || priv == "yes" || priv == "default" || priv == "1")) {
     XBT_WARN("dlopen+thread broken on Apple and BSD. Switching to raw contexts.");
     context_factory_name = "raw";
@@ -115,7 +115,7 @@ void SIMIX_context_mod_init()
 #endif
 
 #if HAVE_SMPI && defined(__FreeBSD__)
 #endif
 
 #if HAVE_SMPI && defined(__FreeBSD__)
-  if (context_factory_name == "thread" && xbt_cfg_get_string("smpi/privatization") != "no"){
+  if (context_factory_name == "thread" && simgrid::config::get_config<std::string>("smpi/privatization") != "no") {
     XBT_WARN("mmap broken on FreeBSD, but dlopen+thread broken too. Switching to dlopen+raw contexts.");
     context_factory_name = "raw";
   }
     XBT_WARN("mmap broken on FreeBSD, but dlopen+thread broken too. Switching to dlopen+raw contexts.");
     context_factory_name = "raw";
   }
index 59425a3..2423713 100644 (file)
@@ -26,7 +26,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll
   }
 
 #define SET_COLL(coll)                                                                                                 \
   }
 
 #define SET_COLL(coll)                                                                                                 \
-  name = xbt_cfg_get_string("smpi/" #coll);                                                                            \
+  name = simgrid::config::get_config<std::string>("smpi/" #coll);                                                      \
   if (name.empty())                                                                                                    \
     name = selector_name;                                                                                              \
   set_##coll(name);
   if (name.empty())                                                                                                    \
     name = selector_name;                                                                                              \
   set_##coll(name);
@@ -101,7 +101,7 @@ COLL_APPLY(COLL_SETTER,COLL_ALLTOALLV_SIG,"");
 
 
 void Colls::set_collectives(){
 
 
 void Colls::set_collectives(){
-  std::string selector_name = xbt_cfg_get_string("smpi/coll-selector");
+  std::string selector_name = simgrid::config::get_config<std::string>("smpi/coll-selector");
   if (selector_name.empty())
     selector_name = "default";
 
   if (selector_name.empty())
     selector_name = "default";
 
index 0160728..357b978 100644 (file)
@@ -97,21 +97,21 @@ SmpiHost::SmpiHost(simgrid::s4u::Host *ptr) : host(ptr)
   if (orecv_string != nullptr) {
     orecv_parsed_values = parse_factor(orecv_string);
   } else {
   if (orecv_string != nullptr) {
     orecv_parsed_values = parse_factor(orecv_string);
   } else {
-    orecv_parsed_values = parse_factor(xbt_cfg_get_string("smpi/or"));
+    orecv_parsed_values = parse_factor(simgrid::config::get_config<std::string>("smpi/or"));
   }
 
   const char* osend_string = host->getProperty("smpi/os");
   if (osend_string != nullptr) {
     osend_parsed_values = parse_factor(osend_string);
   } else {
   }
 
   const char* osend_string = host->getProperty("smpi/os");
   if (osend_string != nullptr) {
     osend_parsed_values = parse_factor(osend_string);
   } else {
-    osend_parsed_values = parse_factor(xbt_cfg_get_string("smpi/os"));
+    osend_parsed_values = parse_factor(simgrid::config::get_config<std::string>("smpi/os"));
   }
 
   const char* oisend_string = host->getProperty("smpi/ois");
   if (oisend_string != nullptr) {
     oisend_parsed_values = parse_factor(oisend_string);
   } else {
   }
 
   const char* oisend_string = host->getProperty("smpi/ois");
   if (oisend_string != nullptr) {
     oisend_parsed_values = parse_factor(oisend_string);
   } else {
-    oisend_parsed_values = parse_factor(xbt_cfg_get_string("smpi/ois"));
+    oisend_parsed_values = parse_factor(simgrid::config::get_config<std::string>("smpi/ois"));
   }
 }
 
   }
 }
 
index fcd8453..ac1a8eb 100644 (file)
@@ -90,7 +90,7 @@ void smpi_bench_begin()
     return;
 
 #if HAVE_PAPI
     return;
 
 #if HAVE_PAPI
-  if (not xbt_cfg_get_string("smpi/papi-events").empty()) {
+  if (not simgrid::config::get_config<std::string>("smpi/papi-events").empty()) {
     int event_set = smpi_process()->papi_event_set();
     // PAPI_start sets everything to 0! See man(3) PAPI_start
     if (PAPI_LOW_LEVEL_INITED == PAPI_is_initialized()) {
     int event_set = smpi_process()->papi_event_set();
     // PAPI_start sets everything to 0! See man(3) PAPI_start
     if (PAPI_LOW_LEVEL_INITED == PAPI_is_initialized()) {
@@ -119,7 +119,7 @@ void smpi_bench_end()
    * An MPI function has been called and now is the right time to update
    * our PAPI counters for this process.
    */
    * An MPI function has been called and now is the right time to update
    * our PAPI counters for this process.
    */
-  if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0') {
+  if (simgrid::config::get_config<std::string>("smpi/papi-events")[0] != '\0') {
     papi_counter_t& counter_data        = smpi_process()->papi_counters();
     int event_set                       = smpi_process()->papi_event_set();
     std::vector<long long> event_values = std::vector<long long>(counter_data.size());
     papi_counter_t& counter_data        = smpi_process()->papi_counters();
     int event_set                       = smpi_process()->papi_event_set();
     std::vector<long long> event_values = std::vector<long long>(counter_data.size());
@@ -142,8 +142,8 @@ void smpi_bench_end()
     xbt_die("Aborting.");
   }
 
     xbt_die("Aborting.");
   }
 
-  if (xbt_cfg_get_string("smpi/comp-adjustment-file")[0] != '\0') { // Maybe we need to artificially speed up or slow
-    // down our computation based on our statistical analysis.
+  // Maybe we need to artificially speed up or slow down our computation based on our statistical analysis.
+  if (simgrid::config::get_config<std::string>("smpi/comp-adjustment-file")[0] != '\0') {
 
     smpi_trace_call_location_t* loc                            = smpi_process()->call_location();
     std::string key                                            = loc->get_composed_key();
 
     smpi_trace_call_location_t* loc                            = smpi_process()->call_location();
     std::string key                                            = loc->get_composed_key();
@@ -159,7 +159,7 @@ void smpi_bench_end()
   }
 
 #if HAVE_PAPI
   }
 
 #if HAVE_PAPI
-  if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) {
+  if (simgrid::config::get_config<std::string>("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) {
     container_t container =
         new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::this_actor::get_pid()));
     papi_counter_t& counter_data = smpi_process()->papi_counters();
     container_t container =
         new simgrid::instr::Container(std::string("rank-") + std::to_string(simgrid::s4u::this_actor::get_pid()));
     papi_counter_t& counter_data = smpi_process()->papi_counters();
index 6e379ab..5d59dac 100644 (file)
@@ -244,7 +244,7 @@ void smpi_global_init()
     xbt_os_walltimer_start(global_timer);
   }
 
     xbt_os_walltimer_start(global_timer);
   }
 
-  std::string filename = xbt_cfg_get_string("smpi/comp-adjustment-file");
+  std::string filename = simgrid::config::get_config<std::string>("smpi/comp-adjustment-file");
   if (not filename.empty()) {
     std::ifstream fstream(filename);
     if (not fstream.is_open()) {
   if (not filename.empty()) {
     std::ifstream fstream(filename);
     if (not fstream.is_open()) {
@@ -271,7 +271,7 @@ void smpi_global_init()
   // and the (computed) event_set.
   std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
 
   // and the (computed) event_set.
   std::map</* computation unit name */ std::string, papi_process_data> units2papi_setup;
 
-  if (not xbt_cfg_get_string("smpi/papi-events").empty()) {
+  if (not simgrid::config::get_config<std::string>("smpi/papi-events").empty()) {
     if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
       XBT_ERROR("Could not initialize PAPI library; is it correctly installed and linked?"
                 " Expected version is %i",
     if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
       XBT_ERROR("Could not initialize PAPI library; is it correctly installed and linked?"
                 " Expected version is %i",
@@ -279,7 +279,7 @@ void smpi_global_init()
 
     typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
     boost::char_separator<char> separator_units(";");
 
     typedef boost::tokenizer<boost::char_separator<char>> Tokenizer;
     boost::char_separator<char> separator_units(";");
-    std::string str = xbt_cfg_get_string("smpi/papi-events");
+    std::string str = simgrid::config::get_config<std::string>("smpi/papi-events");
     Tokenizer tokens(str, separator_units);
 
     // Iterate over all the computational units. This could be processes, hosts, threads, ranks... You name it.
     Tokenizer tokens(str, separator_units);
 
     // Iterate over all the computational units. This could be processes, hosts, threads, ranks... You name it.
@@ -363,7 +363,7 @@ static void smpi_init_options(){
   smpi_cpu_threshold                               = simgrid::config::get_config<double>("smpi/cpu-threshold");
   smpi_host_speed                                  = simgrid::config::get_config<double>("smpi/host-speed");
   xbt_assert(smpi_host_speed >= 0, "You're trying to set the host_speed to a negative value (%f)", smpi_host_speed);
   smpi_cpu_threshold                               = simgrid::config::get_config<double>("smpi/cpu-threshold");
   smpi_host_speed                                  = simgrid::config::get_config<double>("smpi/host-speed");
   xbt_assert(smpi_host_speed >= 0, "You're trying to set the host_speed to a negative value (%f)", smpi_host_speed);
-  std::string smpi_privatize_option                = xbt_cfg_get_string("smpi/privatization");
+  std::string smpi_privatize_option = simgrid::config::get_config<std::string>("smpi/privatization");
   if (smpi_privatize_option == "no" || smpi_privatize_option == "0")
     smpi_privatize_global_variables = SmpiPrivStrategies::None;
   else if (smpi_privatize_option == "yes" || smpi_privatize_option == "1")
   if (smpi_privatize_option == "no" || smpi_privatize_option == "0")
     smpi_privatize_global_variables = SmpiPrivStrategies::None;
   else if (smpi_privatize_option == "yes" || smpi_privatize_option == "1")
@@ -389,7 +389,7 @@ static void smpi_init_options(){
     if (smpi_cpu_threshold < 0)
       smpi_cpu_threshold = DBL_MAX;
 
     if (smpi_cpu_threshold < 0)
       smpi_cpu_threshold = DBL_MAX;
 
-    std::string val = xbt_cfg_get_string("smpi/shared-malloc");
+    std::string val = simgrid::config::get_config<std::string>("smpi/shared-malloc");
     if ((val == "yes") || (val == "1") || (val == "on") || (val == "global")) {
       smpi_cfg_shared_malloc = shmalloc_global;
     } else if (val == "local") {
     if ((val == "yes") || (val == "1") || (val == "on") || (val == "global")) {
       smpi_cfg_shared_malloc = shmalloc_global;
     } else if (val == "local") {
index 91fe28a..4f9ac07 100644 (file)
@@ -30,7 +30,7 @@ Process::Process(ActorPtr actor, msg_bar_t finalization_barrier)
     MC_ignore_heap(timer_, xbt_os_timer_size());
 
 #if HAVE_PAPI
     MC_ignore_heap(timer_, xbt_os_timer_size());
 
 #if HAVE_PAPI
-  if (xbt_cfg_get_string("smpi/papi-events")[0] != '\0') {
+  if (simgrid::config::get_config<std::string>("smpi/papi-events")[0] != '\0') {
     // TODO: Implement host/process/thread based counters. This implementation
     // just always takes the values passed via "default", like this:
     // "default:COUNTER1:COUNTER2:COUNTER3;".
     // TODO: Implement host/process/thread based counters. This implementation
     // just always takes the values passed via "default", like this:
     // "default:COUNTER1:COUNTER2:COUNTER3;".
index 358a78a..d3f6899 100644 (file)
@@ -193,7 +193,7 @@ static void *smpi_shared_malloc_local(size_t size, const char *file, int line)
 
 void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int nb_shared_blocks)
 {
 
 void* smpi_shared_malloc_partial(size_t size, size_t* shared_block_offsets, int nb_shared_blocks)
 {
-  std::string huge_page_mount_point = xbt_cfg_get_string("smpi/shared-malloc-hugepage");
+  std::string huge_page_mount_point = simgrid::config::get_config<std::string>("smpi/shared-malloc-hugepage");
   bool use_huge_page                = not huge_page_mount_point.empty();
 #ifndef MAP_HUGETLB /* If the system header don't define that mmap flag */
   xbt_assert(not use_huge_page,
   bool use_huge_page                = not huge_page_mount_point.empty();
 #ifndef MAP_HUGETLB /* If the system header don't define that mmap flag */
   xbt_assert(not use_huge_page,
index ccd09c7..727ccce 100644 (file)
@@ -132,9 +132,10 @@ namespace kernel {
 namespace resource {
 
 NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool))
 namespace resource {
 
 NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool))
-    : NetworkModel(xbt_cfg_get_string("network/optim") == "Full" ? Model::UpdateAlgo::Full : Model::UpdateAlgo::Lazy)
+    : NetworkModel(simgrid::config::get_config<std::string>("network/optim") == "Full" ? Model::UpdateAlgo::Full
+                                                                                       : Model::UpdateAlgo::Lazy)
 {
 {
-  std::string optim = xbt_cfg_get_string("network/optim");
+  std::string optim = simgrid::config::get_config<std::string>("network/optim");
   bool select       = simgrid::config::get_config<bool>("network/maxmin-selective-update");
 
   if (optim == "Lazy") {
   bool select       = simgrid::config::get_config<bool>("network/maxmin-selective-update");
 
   if (optim == "Lazy") {
index bbba768..14bf482 100644 (file)
@@ -103,7 +103,7 @@ namespace resource {
 
 NetworkIBModel::NetworkIBModel() : NetworkSmpiModel()
 {
 
 NetworkIBModel::NetworkIBModel() : NetworkSmpiModel()
 {
-  std::string IB_factors_string = xbt_cfg_get_string("smpi/IB-penalty-factors");
+  std::string IB_factors_string = simgrid::config::get_config<std::string>("smpi/IB-penalty-factors");
   std::vector<std::string> radical_elements;
   boost::split(radical_elements, IB_factors_string, boost::is_any_of(";"));
 
   std::vector<std::string> radical_elements;
   boost::split(radical_elements, IB_factors_string, boost::is_any_of(";"));
 
index 4189c00..1531bc0 100644 (file)
@@ -52,7 +52,7 @@ NetworkSmpiModel::~NetworkSmpiModel() = default;
 double NetworkSmpiModel::bandwidthFactor(double size)
 {
   if (smpi_bw_factor.empty())
 double NetworkSmpiModel::bandwidthFactor(double size)
 {
   if (smpi_bw_factor.empty())
-    smpi_bw_factor = parse_factor(xbt_cfg_get_string("smpi/bw-factor"));
+    smpi_bw_factor = parse_factor(simgrid::config::get_config<std::string>("smpi/bw-factor"));
 
   double current = 1.0;
   for (auto const& fact : smpi_bw_factor) {
 
   double current = 1.0;
   for (auto const& fact : smpi_bw_factor) {
@@ -70,7 +70,7 @@ double NetworkSmpiModel::bandwidthFactor(double size)
 double NetworkSmpiModel::latencyFactor(double size)
 {
   if (smpi_lat_factor.empty())
 double NetworkSmpiModel::latencyFactor(double size)
 {
   if (smpi_lat_factor.empty())
-    smpi_lat_factor = parse_factor(xbt_cfg_get_string("smpi/lat-factor"));
+    smpi_lat_factor = parse_factor(simgrid::config::get_config<std::string>("smpi/lat-factor"));
 
   double current = 1.0;
   for (auto const& fact : smpi_lat_factor) {
 
   double current = 1.0;
   for (auto const& fact : smpi_lat_factor) {
index 993a397..e9d98bc 100644 (file)
@@ -245,7 +245,7 @@ static void on_host_added(simgrid::s4u::Host& host)
       dvfs_governor = std::string(daemon_proc->get_host()->getProperty(property_governor));
       boost::algorithm::to_lower(dvfs_governor);
     } else {
       dvfs_governor = std::string(daemon_proc->get_host()->getProperty(property_governor));
       boost::algorithm::to_lower(dvfs_governor);
     } else {
-      dvfs_governor = xbt_cfg_get_string(property_governor);
+      dvfs_governor = simgrid::config::get_config<std::string>(property_governor);
       boost::algorithm::to_lower(dvfs_governor);
     }
 
       boost::algorithm::to_lower(dvfs_governor);
     }
 
index 472a5a5..ef5d72b 100644 (file)
@@ -500,10 +500,10 @@ void sg_platf_end() {
 /* Pick the right models for CPU, net and host, and call their model_init_preparse */
 static void surf_config_models_setup()
 {
 /* Pick the right models for CPU, net and host, and call their model_init_preparse */
 static void surf_config_models_setup()
 {
-  std::string host_model_name    = xbt_cfg_get_string("host/model");
-  std::string network_model_name = xbt_cfg_get_string("network/model");
-  std::string cpu_model_name     = xbt_cfg_get_string("cpu/model");
-  std::string storage_model_name = xbt_cfg_get_string("storage/model");
+  std::string host_model_name    = simgrid::config::get_config<std::string>("host/model");
+  std::string network_model_name = simgrid::config::get_config<std::string>("network/model");
+  std::string cpu_model_name     = simgrid::config::get_config<std::string>("cpu/model");
+  std::string storage_model_name = simgrid::config::get_config<std::string>("storage/model");
 
   /* The compound host model is needed when using non-default net/cpu models */
   if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) &&
 
   /* The compound host model is needed when using non-default net/cpu models */
   if ((not xbt_cfg_is_default_value("network/model") || not xbt_cfg_is_default_value("cpu/model")) &&