- //return if already called
- if (smpi_cpu_threshold > -1)
- return;
- simgrid::smpi::Colls::set_collectives();
- simgrid::smpi::Colls::smpi_coll_cleanup_callback=nullptr;
- smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold");
- smpi_host_speed = xbt_cfg_get_double("smpi/host-speed");
- const char* smpi_privatize_option = xbt_cfg_get_string("smpi/privatization");
- if (std::strcmp(smpi_privatize_option, "no") == 0)
- smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
- else if (std::strcmp(smpi_privatize_option, "yes") == 0)
- smpi_privatize_global_variables = SMPI_PRIVATIZE_DEFAULT;
- else if (std::strcmp(smpi_privatize_option, "mmap") == 0)
- smpi_privatize_global_variables = SMPI_PRIVATIZE_MMAP;
- else if (std::strcmp(smpi_privatize_option, "dlopen") == 0)
- smpi_privatize_global_variables = SMPI_PRIVATIZE_DLOPEN;
-
- // Some compatibility stuff:
- else if (std::strcmp(smpi_privatize_option, "1") == 0)
- smpi_privatize_global_variables = SMPI_PRIVATIZE_DEFAULT;
- else if (std::strcmp(smpi_privatize_option, "0") == 0)
- smpi_privatize_global_variables = SMPI_PRIVATIZE_NONE;
-
- else
- xbt_die("Invalid value for smpi/privatization: '%s'", smpi_privatize_option);
-
+ // return if already called
+ if (smpi_cpu_threshold > -1)
+ return;
+ simgrid::smpi::Colls::set_collectives();
+ simgrid::smpi::Colls::smpi_coll_cleanup_callback = nullptr;
+ smpi_cpu_threshold = xbt_cfg_get_double("smpi/cpu-threshold");
+ smpi_host_speed = xbt_cfg_get_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");
+ 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")
+ smpi_privatize_global_variables = SmpiPrivStrategies::Default;
+ else if (smpi_privatize_option == "mmap")
+ smpi_privatize_global_variables = SmpiPrivStrategies::Mmap;
+ else if (smpi_privatize_option == "dlopen")
+ smpi_privatize_global_variables = SmpiPrivStrategies::Dlopen;
+ else
+ xbt_die("Invalid value for smpi/privatization: '%s'", smpi_privatize_option.c_str());
+
+ if (not SMPI_switch_data_segment) {
+ XBT_DEBUG("Running without smpi_main(); disable smpi/privatization.");
+ smpi_privatize_global_variables = SmpiPrivStrategies::None;
+ }