/* 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();
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();
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()
{
- return xbt_cfg_get_string(OPT_TRACING_COMMENT_FILE);
+ return simgrid::config::get_config<std::string>(OPT_TRACING_COMMENT_FILE);
}
int TRACE_precision ()
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()
#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";
#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";
}
}
#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);
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 (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 {
- 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 {
- oisend_parsed_values = parse_factor(xbt_cfg_get_string("smpi/ois"));
+ oisend_parsed_values = parse_factor(simgrid::config::get_config<std::string>("smpi/ois"));
}
}
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()) {
* 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());
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();
}
#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();
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()) {
// 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",
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.
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_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") {
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;".
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,
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") {
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(";"));
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 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) {
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);
}
/* 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")) &&