From b0b20786751d59b46c18bc23416b45e3fa0167ba Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 19 Apr 2018 14:48:19 +0200 Subject: [PATCH 1/1] Rename simgrid::config::get_config -> simgrid::config::get_value. --- include/xbt/config.h | 6 +++--- include/xbt/config.hpp | 12 ++++++------ src/instr/instr_config.cpp | 12 ++++++------ src/instr/instr_paje_containers.cpp | 4 ++-- src/instr/instr_paje_events.cpp | 4 ++-- src/instr/instr_paje_header.cpp | 2 +- src/msg/msg_global.cpp | 2 +- src/simdag/sd_global.cpp | 2 +- src/simix/smx_context.cpp | 4 ++-- src/simix/smx_global.cpp | 2 +- src/smpi/colls/smpi_coll.cpp | 4 ++-- src/smpi/internals/SmpiHost.cpp | 6 +++--- src/smpi/internals/smpi_bench.cpp | 10 +++++----- src/smpi/internals/smpi_global.cpp | 24 ++++++++++++------------ src/smpi/internals/smpi_process.cpp | 2 +- src/smpi/internals/smpi_shared.cpp | 4 ++-- src/smpi/mpi/smpi_request.cpp | 14 +++++++------- src/surf/cpu_cas01.cpp | 2 +- src/surf/network_cm02.cpp | 8 ++++---- src/surf/network_ib.cpp | 2 +- src/surf/network_smpi.cpp | 4 ++-- src/surf/plugins/host_dvfs.cpp | 4 ++-- src/surf/sg_platf.cpp | 8 ++++---- src/xbt/config.cpp | 14 +++++++------- src/xbt/exception.cpp | 4 ++-- 25 files changed, 80 insertions(+), 80 deletions(-) diff --git a/include/xbt/config.h b/include/xbt/config.h index 6c4219acf0..e953b4757e 100644 --- a/include/xbt/config.h +++ b/include/xbt/config.h @@ -140,11 +140,11 @@ XBT_PUBLIC void xbt_cfg_help(); * @{ */ -XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_config") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_value") XBT_PUBLIC int xbt_cfg_get_int(const char* name); -XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_config") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_value") XBT_PUBLIC double xbt_cfg_get_double(const char* name); -XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_config") XBT_PUBLIC +XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_value") XBT_PUBLIC int xbt_cfg_get_boolean(const char* name); /** @} */ diff --git a/include/xbt/config.hpp b/include/xbt/config.hpp index 4521614f25..eb0e3d6d9d 100644 --- a/include/xbt/config.hpp +++ b/include/xbt/config.hpp @@ -45,12 +45,12 @@ inline std::string to_string(std::string&& value) // Get config -template XBT_PUBLIC T const& get_config(const char* name); +template XBT_PUBLIC T const& get_value(const char* name); -extern template XBT_PUBLIC int const& get_config(const char* name); -extern template XBT_PUBLIC double const& get_config(const char* name); -extern template XBT_PUBLIC bool const& get_config(const char* name); -extern template XBT_PUBLIC std::string const& get_config(const char* name); +extern template XBT_PUBLIC int const& get_value(const char* name); +extern template XBT_PUBLIC double const& get_value(const char* name); +extern template XBT_PUBLIC bool const& get_value(const char* name); +extern template XBT_PUBLIC std::string const& get_value(const char* name); // Register: @@ -258,7 +258,7 @@ public: } } -XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_config") XBT_PUBLIC std::string +XBT_ATTRIB_DEPRECATED_v323("Please use simgrid::config::get_value") XBT_PUBLIC std::string xbt_cfg_get_string(const char* name); #endif diff --git a/src/instr/instr_config.cpp b/src/instr/instr_config.cpp index 4acb268f48..f5e687a04c 100644 --- a/src/instr/instr_config.cpp +++ b/src/instr/instr_config.cpp @@ -86,7 +86,7 @@ int TRACE_start() /* init the tracing module to generate the right output */ /* open the trace file(s) */ - std::string format = simgrid::config::get_config(OPT_TRACING_FORMAT); + std::string format = simgrid::config::get_value(OPT_TRACING_FORMAT); 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 */ - std::string format = simgrid::config::get_config(OPT_TRACING_FORMAT); + std::string format = simgrid::config::get_value(OPT_TRACING_FORMAT); XBT_DEBUG("Tracing format %s\n", format.c_str()); if (format == "Paje") { TRACE_paje_end(); @@ -241,22 +241,22 @@ bool TRACE_display_sizes () std::string TRACE_get_comment() { - return simgrid::config::get_config(OPT_TRACING_COMMENT); + return simgrid::config::get_value(OPT_TRACING_COMMENT); } std::string TRACE_get_comment_file() { - return simgrid::config::get_config(OPT_TRACING_COMMENT_FILE); + return simgrid::config::get_value(OPT_TRACING_COMMENT_FILE); } int TRACE_precision () { - return simgrid::config::get_config(OPT_TRACING_PRECISION); + return simgrid::config::get_value(OPT_TRACING_PRECISION); } std::string TRACE_get_filename() { - return simgrid::config::get_config(OPT_TRACING_FILENAME); + return simgrid::config::get_value(OPT_TRACING_FILENAME); } void TRACE_global_init() diff --git a/src/instr/instr_paje_containers.cpp b/src/instr/instr_paje_containers.cpp index f509556e1c..9ecaa544fd 100644 --- a/src/instr/instr_paje_containers.cpp +++ b/src/instr/instr_paje_containers.cpp @@ -166,7 +166,7 @@ void Container::logCreation() prefix = xbt_os_time(); } - if (not simgrid::config::get_config("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) { + if (not simgrid::config::get_value("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) { std::string folder_name = TRACE_get_filename() + "_files"; std::string filename = folder_name + "/" + std::to_string(prefix) + "_" + name_ + ".txt"; #ifdef WIN32 @@ -197,7 +197,7 @@ void Container::logDestruction() XBT_DEBUG("Dump %s", stream.str().c_str()); fprintf(tracing_file, "%s\n", stream.str().c_str()); } else if (trace_format == simgrid::instr::TraceFormat::Ti) { - if (not simgrid::config::get_config("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) { + if (not simgrid::config::get_value("tracing/smpi/format/ti-one-file") || tracing_files.size() == 1) { fclose(tracing_files.at(this)); } tracing_files.erase(this); diff --git a/src/instr/instr_paje_events.cpp b/src/instr/instr_paje_events.cpp index a9abe0e473..267c16da00 100644 --- a/src/instr/instr_paje_events.cpp +++ b/src/instr/instr_paje_events.cpp @@ -32,7 +32,7 @@ StateEvent::StateEvent(Container* container, Type* type, e_event_type event_type : PajeEvent::PajeEvent(container, type, SIMIX_get_clock(), event_type), value(value), extra_(extra) { #if HAVE_SMPI - if (simgrid::config::get_config("smpi/trace-call-location")) { + if (simgrid::config::get_value("smpi/trace-call-location")) { smpi_trace_call_location_t* loc = smpi_trace_get_call_location(); filename = loc->filename; linenumber = loc->linenumber; @@ -87,7 +87,7 @@ void StateEvent::print() stream_ << " " << ((extra_ != nullptr) ? extra_->display_size() : 0); #if HAVE_SMPI - if (simgrid::config::get_config("smpi/trace-call-location")) { + if (simgrid::config::get_value("smpi/trace-call-location")) { stream_ << " \"" << filename << "\" " << linenumber; } #endif diff --git a/src/instr/instr_paje_header.cpp b/src/instr/instr_paje_header.cpp index b7f4229b8c..01cd5bd12a 100644 --- a/src/instr/instr_paje_header.cpp +++ b/src/instr/instr_paje_header.cpp @@ -164,7 +164,7 @@ static void TRACE_header_PajePushState(int size) fprintf(tracing_file, "%% Value string\n"); if (size) fprintf(tracing_file, "%% Size int\n"); #if HAVE_SMPI - if (simgrid::config::get_config("smpi/trace-call-location")) { + if (simgrid::config::get_value("smpi/trace-call-location")) { /** * paje currently (May 2016) uses "Filename" and "Linenumber" as * reserved words. We cannot use them... diff --git a/src/msg/msg_global.cpp b/src/msg/msg_global.cpp index 52ee291093..3fc450f83a 100644 --- a/src/msg/msg_global.cpp +++ b/src/msg/msg_global.cpp @@ -51,7 +51,7 @@ void MSG_init_nocheck(int *argc, char **argv) { MC_ignore_heap(&(msg_global->sent_msg), sizeof(msg_global->sent_msg)); } - if (simgrid::config::get_config("clean-atexit")) + if (simgrid::config::get_value("clean-atexit")) atexit(MSG_exit); } diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 664f838c55..3784c9b0a9 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -162,7 +162,7 @@ void SD_init_nocheck(int *argc, char **argv) surf_init(argc, argv); xbt_cfg_setdefault_string("host/model", "ptask_L07"); - if (simgrid::config::get_config("clean-atexit")) + if (simgrid::config::get_value("clean-atexit")) atexit(SD_exit); if (_sg_cfg_exit_asap) { exit(0); diff --git a/src/simix/smx_context.cpp b/src/simix/smx_context.cpp index 719f7d6fae..e5d27c3775 100644 --- a/src/simix/smx_context.cpp +++ b/src/simix/smx_context.cpp @@ -107,7 +107,7 @@ void SIMIX_context_mod_init() #endif #if HAVE_SMPI && (defined(__APPLE__) || defined(__NetBSD__)) - std::string priv = simgrid::config::get_config("smpi/privatization"); + std::string priv = simgrid::config::get_value("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"; @@ -115,7 +115,7 @@ void SIMIX_context_mod_init() #endif #if HAVE_SMPI && defined(__FreeBSD__) - if (context_factory_name == "thread" && simgrid::config::get_config("smpi/privatization") != "no") { + if (context_factory_name == "thread" && simgrid::config::get_value("smpi/privatization") != "no") { XBT_WARN("mmap broken on FreeBSD, but dlopen+thread broken too. Switching to dlopen+raw contexts."); context_factory_name = "raw"; } diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 0d7fae6b4f..37ebaba05e 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -217,7 +217,7 @@ void SIMIX_global_init(int *argc, char **argv) }); } - if (simgrid::config::get_config("clean-atexit")) + if (simgrid::config::get_value("clean-atexit")) atexit(SIMIX_clean); if (_sg_cfg_exit_asap) diff --git a/src/smpi/colls/smpi_coll.cpp b/src/smpi/colls/smpi_coll.cpp index 2423713019..e450b75b81 100644 --- a/src/smpi/colls/smpi_coll.cpp +++ b/src/smpi/colls/smpi_coll.cpp @@ -26,7 +26,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_coll, smpi, "Logging specific to SMPI (coll } #define SET_COLL(coll) \ - name = simgrid::config::get_config("smpi/" #coll); \ + name = simgrid::config::get_value("smpi/" #coll); \ if (name.empty()) \ name = selector_name; \ set_##coll(name); @@ -101,7 +101,7 @@ COLL_APPLY(COLL_SETTER,COLL_ALLTOALLV_SIG,""); void Colls::set_collectives(){ - std::string selector_name = simgrid::config::get_config("smpi/coll-selector"); + std::string selector_name = simgrid::config::get_value("smpi/coll-selector"); if (selector_name.empty()) selector_name = "default"; diff --git a/src/smpi/internals/SmpiHost.cpp b/src/smpi/internals/SmpiHost.cpp index 357b978f6f..7ef8657abf 100644 --- a/src/smpi/internals/SmpiHost.cpp +++ b/src/smpi/internals/SmpiHost.cpp @@ -97,21 +97,21 @@ SmpiHost::SmpiHost(simgrid::s4u::Host *ptr) : host(ptr) if (orecv_string != nullptr) { orecv_parsed_values = parse_factor(orecv_string); } else { - orecv_parsed_values = parse_factor(simgrid::config::get_config("smpi/or")); + orecv_parsed_values = parse_factor(simgrid::config::get_value("smpi/or")); } 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(simgrid::config::get_config("smpi/os")); + osend_parsed_values = parse_factor(simgrid::config::get_value("smpi/os")); } 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(simgrid::config::get_config("smpi/ois")); + oisend_parsed_values = parse_factor(simgrid::config::get_value("smpi/ois")); } } diff --git a/src/smpi/internals/smpi_bench.cpp b/src/smpi/internals/smpi_bench.cpp index ac1a8eb1bd..36b70048f9 100644 --- a/src/smpi/internals/smpi_bench.cpp +++ b/src/smpi/internals/smpi_bench.cpp @@ -90,7 +90,7 @@ void smpi_bench_begin() return; #if HAVE_PAPI - if (not simgrid::config::get_config("smpi/papi-events").empty()) { + if (not simgrid::config::get_value("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()) { @@ -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. */ - if (simgrid::config::get_config("smpi/papi-events")[0] != '\0') { + if (simgrid::config::get_value("smpi/papi-events")[0] != '\0') { papi_counter_t& counter_data = smpi_process()->papi_counters(); int event_set = smpi_process()->papi_event_set(); std::vector event_values = std::vector(counter_data.size()); @@ -143,7 +143,7 @@ void smpi_bench_end() } // Maybe we need to artificially speed up or slow down our computation based on our statistical analysis. - if (simgrid::config::get_config("smpi/comp-adjustment-file")[0] != '\0') { + if (simgrid::config::get_value("smpi/comp-adjustment-file")[0] != '\0') { smpi_trace_call_location_t* loc = smpi_process()->call_location(); std::string key = loc->get_composed_key(); @@ -154,12 +154,12 @@ void smpi_bench_end() } // Simulate the benchmarked computation unless disabled via command-line argument - if (simgrid::config::get_config("smpi/simulate-computation")) { + if (simgrid::config::get_value("smpi/simulate-computation")) { smpi_execute(xbt_os_timer_elapsed(timer)/speedup); } #if HAVE_PAPI - if (simgrid::config::get_config("smpi/papi-events")[0] != '\0' && TRACE_smpi_is_enabled()) { + if (simgrid::config::get_value("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(); diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 5d59dac8bb..902237b487 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -218,8 +218,8 @@ static void smpi_check_options() { //check correctness of MPI parameters - xbt_assert(simgrid::config::get_config("smpi/async-small-thresh") <= - simgrid::config::get_config("smpi/send-is-detached-thresh")); + xbt_assert(simgrid::config::get_value("smpi/async-small-thresh") <= + simgrid::config::get_value("smpi/send-is-detached-thresh")); if (xbt_cfg_is_default_value("smpi/host-speed")) { XBT_INFO("You did not set the power of the host running the simulation. " @@ -228,7 +228,7 @@ static void smpi_check_options() "Check http://simgrid.org/simgrid/latest/doc/options.html#options_smpi_bench for more information."); } - xbt_assert(simgrid::config::get_config("smpi/cpu-threshold") >= 0, + xbt_assert(simgrid::config::get_value("smpi/cpu-threshold") >= 0, "The 'smpi/cpu-threshold' option cannot have negative values [anymore]. If you want to discard " "the simulation of any computation, please use 'smpi/simulate-computation:no' instead."); } @@ -244,7 +244,7 @@ void smpi_global_init() xbt_os_walltimer_start(global_timer); } - std::string filename = simgrid::config::get_config("smpi/comp-adjustment-file"); + std::string filename = simgrid::config::get_value("smpi/comp-adjustment-file"); 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 units2papi_setup; - if (not simgrid::config::get_config("smpi/papi-events").empty()) { + if (not simgrid::config::get_value("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", @@ -279,7 +279,7 @@ void smpi_global_init() typedef boost::tokenizer> Tokenizer; boost::char_separator separator_units(";"); - std::string str = simgrid::config::get_config("smpi/papi-events"); + std::string str = simgrid::config::get_value("smpi/papi-events"); Tokenizer tokens(str, separator_units); // Iterate over all the computational units. This could be processes, hosts, threads, ranks... You name it. @@ -360,10 +360,10 @@ static void smpi_init_options(){ return; simgrid::smpi::Colls::set_collectives(); simgrid::smpi::Colls::smpi_coll_cleanup_callback = nullptr; - smpi_cpu_threshold = simgrid::config::get_config("smpi/cpu-threshold"); - smpi_host_speed = simgrid::config::get_config("smpi/host-speed"); + smpi_cpu_threshold = simgrid::config::get_value("smpi/cpu-threshold"); + smpi_host_speed = simgrid::config::get_value("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 = simgrid::config::get_config("smpi/privatization"); + std::string smpi_privatize_option = simgrid::config::get_value("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") @@ -389,7 +389,7 @@ static void smpi_init_options(){ if (smpi_cpu_threshold < 0) smpi_cpu_threshold = DBL_MAX; - std::string val = simgrid::config::get_config("smpi/shared-malloc"); + std::string val = simgrid::config::get_value("smpi/shared-malloc"); if ((val == "yes") || (val == "1") || (val == "on") || (val == "global")) { smpi_cfg_shared_malloc = shmalloc_global; } else if (val == "local") { @@ -529,7 +529,7 @@ int smpi_main(const char* executable, int argc, char *argv[]) // Load the copy and resolve the entry point: void* handle = dlopen(target_executable.c_str(), RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND); int saved_errno = errno; - if (simgrid::config::get_config("smpi/keep-temps") == false) + if (simgrid::config::get_value("smpi/keep-temps") == false) unlink(target_executable.c_str()); if (handle == nullptr) xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), saved_errno, strerror(saved_errno)); @@ -581,7 +581,7 @@ int smpi_main(const char* executable, int argc, char *argv[]) SIMIX_run(); xbt_os_walltimer_stop(global_timer); - if (simgrid::config::get_config("smpi/display-timing")) { + if (simgrid::config::get_value("smpi/display-timing")) { double global_time = xbt_os_timer_elapsed(global_timer); XBT_INFO("Simulated time: %g seconds. \n\n" "The simulation took %g seconds (after parsing and platform setup)\n" diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index 4f9ac07319..72a888834c 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -30,7 +30,7 @@ Process::Process(ActorPtr actor, msg_bar_t finalization_barrier) MC_ignore_heap(timer_, xbt_os_timer_size()); #if HAVE_PAPI - if (simgrid::config::get_config("smpi/papi-events")[0] != '\0') { + if (simgrid::config::get_value("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;". diff --git a/src/smpi/internals/smpi_shared.cpp b/src/smpi/internals/smpi_shared.cpp index d3f6899812..446cb08826 100644 --- a/src/smpi/internals/smpi_shared.cpp +++ b/src/smpi/internals/smpi_shared.cpp @@ -193,14 +193,14 @@ 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) { - std::string huge_page_mount_point = simgrid::config::get_config("smpi/shared-malloc-hugepage"); + std::string huge_page_mount_point = simgrid::config::get_value("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, "Huge pages are not available on your system, you cannot use the smpi/shared-malloc-hugepage option."); #endif smpi_shared_malloc_blocksize = - static_cast(simgrid::config::get_config("smpi/shared-malloc-blocksize")); + static_cast(simgrid::config::get_value("smpi/shared-malloc-blocksize")); void* mem; size_t allocated_size; if(use_huge_page) { diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index ad1a0cefc8..caee57166d 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -358,7 +358,7 @@ void Request::start() simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_)); - int async_small_thresh = simgrid::config::get_config("smpi/async-small-thresh"); + int async_small_thresh = simgrid::config::get_value("smpi/async-small-thresh"); xbt_mutex_t mut = process->mailboxes_mutex(); if (async_small_thresh != 0 || (flags_ & RMA) != 0) @@ -418,7 +418,7 @@ void Request::start() void* buf = buf_; if ((flags_ & SSEND) == 0 && ((flags_ & RMA) != 0 || - static_cast(size_) < simgrid::config::get_config("smpi/send-is-detached-thresh"))) { + static_cast(size_) < simgrid::config::get_value("smpi/send-is-detached-thresh"))) { void *oldbuf = nullptr; detached_ = 1; XBT_DEBUG("Send request %p is detached", this); @@ -453,7 +453,7 @@ void Request::start() XBT_DEBUG("sending size of %zu : sleep %f ", size_, sleeptime); } - int async_small_thresh = simgrid::config::get_config("smpi/async-small-thresh"); + int async_small_thresh = simgrid::config::get_value("smpi/async-small-thresh"); xbt_mutex_t mut=process->mailboxes_mutex(); @@ -548,7 +548,7 @@ int Request::test(MPI_Request * request, MPI_Status * status) { nsleeps=1;//reset the number of sleeps we will do next time if (*request != MPI_REQUEST_NULL && ((*request)->flags_ & PERSISTENT) == 0) *request = MPI_REQUEST_NULL; - } else if (simgrid::config::get_config("smpi/grow-injected-times")) { + } else if (simgrid::config::get_value("smpi/grow-injected-times")) { nsleeps++; } } @@ -668,7 +668,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* // This can speed up the execution of certain applications by an order of magnitude, such as HPL static int nsleeps = 1; double speed = simgrid::s4u::Actor::self()->get_host()->getSpeed(); - double maxrate = simgrid::config::get_config("smpi/iprobe-cpu-usage"); + double maxrate = simgrid::config::get_value("smpi/iprobe-cpu-usage"); MPI_Request request = new Request(nullptr, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->get_pid(), simgrid::s4u::this_actor::get_pid(), tag, comm, PERSISTENT | RECV); @@ -683,7 +683,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* request->print_request("New iprobe"); // We have to test both mailboxes as we don't know if we will receive one one or another - if (simgrid::config::get_config("smpi/async-small-thresh") > 0) { + if (simgrid::config::get_value("smpi/async-small-thresh") > 0) { mailbox = smpi_process()->mailbox_small(); XBT_DEBUG("Trying to probe the perm recv mailbox"); request->action_ = simcall_comm_iprobe(mailbox, 0, &match_recv, static_cast(request)); @@ -710,7 +710,7 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* } else { *flag = 0; - if (simgrid::config::get_config("smpi/grow-injected-times")) + if (simgrid::config::get_value("smpi/grow-injected-times")) nsleeps++; } unref(&request); diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 2f9fe9da8c..315520c4ae 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -60,7 +60,7 @@ namespace surf { CpuCas01Model::CpuCas01Model(kernel::resource::Model::UpdateAlgo algo) : simgrid::surf::CpuModel(algo) { - bool select = simgrid::config::get_config("cpu/maxmin-selective-update"); + bool select = simgrid::config::get_value("cpu/maxmin-selective-update"); if (algo == Model::UpdateAlgo::Lazy) { xbt_assert(select || xbt_cfg_is_default_value("cpu/maxmin-selective-update"), diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index 727ccced5b..02ea9eccd8 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -132,11 +132,11 @@ namespace kernel { namespace resource { NetworkCm02Model::NetworkCm02Model(kernel::lmm::System* (*make_new_lmm_system)(bool)) - : NetworkModel(simgrid::config::get_config("network/optim") == "Full" ? Model::UpdateAlgo::Full - : Model::UpdateAlgo::Lazy) + : NetworkModel(simgrid::config::get_value("network/optim") == "Full" ? Model::UpdateAlgo::Full + : Model::UpdateAlgo::Lazy) { - std::string optim = simgrid::config::get_config("network/optim"); - bool select = simgrid::config::get_config("network/maxmin-selective-update"); + std::string optim = simgrid::config::get_value("network/optim"); + bool select = simgrid::config::get_value("network/maxmin-selective-update"); if (optim == "Lazy") { xbt_assert(select || xbt_cfg_is_default_value("network/maxmin-selective-update"), diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 14bf4828df..f9599b6731 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -103,7 +103,7 @@ namespace resource { NetworkIBModel::NetworkIBModel() : NetworkSmpiModel() { - std::string IB_factors_string = simgrid::config::get_config("smpi/IB-penalty-factors"); + std::string IB_factors_string = simgrid::config::get_value("smpi/IB-penalty-factors"); std::vector radical_elements; boost::split(radical_elements, IB_factors_string, boost::is_any_of(";")); diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index 1531bc0ce1..0f089bca71 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -52,7 +52,7 @@ NetworkSmpiModel::~NetworkSmpiModel() = default; double NetworkSmpiModel::bandwidthFactor(double size) { if (smpi_bw_factor.empty()) - smpi_bw_factor = parse_factor(simgrid::config::get_config("smpi/bw-factor")); + smpi_bw_factor = parse_factor(simgrid::config::get_value("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()) - smpi_lat_factor = parse_factor(simgrid::config::get_config("smpi/lat-factor")); + smpi_lat_factor = parse_factor(simgrid::config::get_value("smpi/lat-factor")); double current = 1.0; for (auto const& fact : smpi_lat_factor) { diff --git a/src/surf/plugins/host_dvfs.cpp b/src/surf/plugins/host_dvfs.cpp index e9d98bc7c6..b926248075 100644 --- a/src/surf/plugins/host_dvfs.cpp +++ b/src/surf/plugins/host_dvfs.cpp @@ -42,7 +42,7 @@ public: void init() { const char* local_sampling_rate_config = host_->getProperty(property_sampling_rate); - double global_sampling_rate_config = simgrid::config::get_config(property_sampling_rate); + double global_sampling_rate_config = simgrid::config::get_value(property_sampling_rate); if (local_sampling_rate_config != nullptr) { sampling_rate = std::stod(local_sampling_rate_config); } else { @@ -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 = simgrid::config::get_config(property_governor); + dvfs_governor = simgrid::config::get_value(property_governor); boost::algorithm::to_lower(dvfs_governor); } diff --git a/src/surf/sg_platf.cpp b/src/surf/sg_platf.cpp index ef5d72b16c..46081c435f 100644 --- a/src/surf/sg_platf.cpp +++ b/src/surf/sg_platf.cpp @@ -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() { - std::string host_model_name = simgrid::config::get_config("host/model"); - std::string network_model_name = simgrid::config::get_config("network/model"); - std::string cpu_model_name = simgrid::config::get_config("cpu/model"); - std::string storage_model_name = simgrid::config::get_config("storage/model"); + std::string host_model_name = simgrid::config::get_value("host/model"); + std::string network_model_name = simgrid::config::get_value("network/model"); + std::string cpu_model_name = simgrid::config::get_value("cpu/model"); + std::string storage_model_name = simgrid::config::get_value("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")) && diff --git a/src/xbt/config.cpp b/src/xbt/config.cpp index 84c6b7b10a..19673d9449 100644 --- a/src/xbt/config.cpp +++ b/src/xbt/config.cpp @@ -366,17 +366,17 @@ void Config::help() } } -// ***** get_config ***** +// ***** get_value ***** -template XBT_PUBLIC T const& get_config(const char* name) +template XBT_PUBLIC T const& get_value(const char* name) { return (*simgrid_config)[name].get_value(); } -template XBT_PUBLIC int const& get_config(const char* name); -template XBT_PUBLIC double const& get_config(const char* name); -template XBT_PUBLIC bool const& get_config(const char* name); -template XBT_PUBLIC std::string const& get_config(const char* name); +template XBT_PUBLIC int const& get_value(const char* name); +template XBT_PUBLIC double const& get_value(const char* name); +template XBT_PUBLIC bool const& get_value(const char* name); +template XBT_PUBLIC std::string const& get_value(const char* name); // ***** alias ***** @@ -707,7 +707,7 @@ XBT_TEST_UNIT("use", test_config_use, "Data retrieving tests") { /* get_single_value */ xbt_cfg_set_parse("peername:toto:42 speed:42"); - int ival = simgrid::config::get_config("speed"); + int ival = simgrid::config::get_value("speed"); if (ival != 42) xbt_test_fail("Speed value = %d, I expected 42", ival); } diff --git a/src/xbt/exception.cpp b/src/xbt/exception.cpp index dd9a146660..dd91449b99 100644 --- a/src/xbt/exception.cpp +++ b/src/xbt/exception.cpp @@ -45,7 +45,7 @@ void logException( XBT_LOG(prio, "%s %s: %s", context, name.get(), exception.what()); // Do we have a backtrace? - if (with_context != nullptr && not simgrid::config::get_config("exception/cutpath")) { + if (with_context != nullptr && not simgrid::config::get_value("exception/cutpath")) { auto backtrace = simgrid::xbt::resolveBacktrace( with_context->backtrace().data(), with_context->backtrace().size()); for (std::string const& s : backtrace) @@ -74,7 +74,7 @@ void logException( static void showBacktrace(std::vector& bt) { - if (simgrid::config::get_config("exception/cutpath")) { + if (simgrid::config::get_value("exception/cutpath")) { XBT_LOG(xbt_log_priority_critical, "Display of current backtrace disabled by --cfg=exception/cutpath."); return; } -- 2.20.1