#if HAVE_SMPI
simgrid::config::declare_flag<double>("smpi/host-speed", "Speed of the host running the simulation (in flop/s). "
"Used to bench the operations.",
- 20000.0);
+ 20000.0, [](const double& val) {
+ xbt_assert(val > 0.0, "Invalid value (%f) for 'smpi/host-speed': it must be positive.", val);
+ });
simgrid::config::alias("smpi/host-speed", {"smpi/running_power", "smpi/running-power"});
simgrid::config::declare_flag<bool>("smpi/keep-temps", "Whether we should keep the generated temporary files.",
void ActorExt::init()
{
- if (smpi_process_count() == 0) {
- xbt_die("SimGrid was not initialized properly before entering MPI_Init. Aborting, please check compilation process "
- "and use smpirun\n");
- }
+ xbt_assert(smpi_process_count() != 0, "SimGrid was not initialized properly before entering MPI_Init. "
+ "Aborting, please check compilation process and use smpirun.");
simgrid::s4u::ActorPtr proc = simgrid::s4u::Actor::self();
// cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved
, present_processes(0)
, comm_world(comm)
, finalization_barrier(finalization_barrier)
- { }
+ {
+ MPI_Group group = new simgrid::smpi::Group(size);
+ comm_world = new simgrid::smpi::Comm(group, nullptr, 0, -1);
+ // FIXME : using MPI_Attr_put with MPI_UNIVERSE_SIZE is forbidden and we make it a no-op (which triggers a warning
+ // as MPI_ERR_ARG is returned). Directly calling Comm::attr_put breaks for now, as MPI_UNIVERSE_SIZE,is <0
+ // instance.comm_world->attr_put<simgrid::smpi::Comm>(MPI_UNIVERSE_SIZE, reinterpret_cast<void*>(instance.size));
+ }
const std::string name;
int size;
*/
void SMPI_app_instance_register(const char *name, xbt_main_func_t code, int num_processes)
{
- if (code != nullptr) { // When started with smpirun, we will not execute a function
+ if (code != nullptr) // When started with smpirun, we will not execute a function
simgrid::s4u::Engine::get_instance()->register_function(name, code);
- }
- static int already_called = 0;
+ static bool already_called = false;
if (not already_called) {
- already_called = 1;
- std::vector<simgrid::s4u::Host*> list = simgrid::s4u::Engine::get_instance()->get_all_hosts();
- for (auto const& host : list) {
+ already_called = true;
+ for (auto const& host : simgrid::s4u::Engine::get_instance()->get_all_hosts())
host->extension_set(new simgrid::smpi::Host(host));
- }
}
Instance instance(std::string(name), num_processes, MPI_COMM_NULL, new simgrid::s4u::Barrier(num_processes));
- MPI_Group group = new simgrid::smpi::Group(instance.size);
- instance.comm_world = new simgrid::smpi::Comm(group, nullptr, 0, -1);
-// FIXME : using MPI_Attr_put with MPI_UNIVERSE_SIZE is forbidden and we make it a no-op (which triggers a warning as MPI_ERR_ARG is returned).
-// Directly calling Comm::attr_put breaks for now, as MPI_UNIVERSE_SIZE,is <0
-// instance.comm_world->attr_put<simgrid::smpi::Comm>(MPI_UNIVERSE_SIZE, reinterpret_cast<void*>(instance.size));
process_count+=num_processes;
simgrid::smpi::Colls::set_collectives();
simgrid::smpi::Colls::smpi_coll_cleanup_callback = nullptr;
smpi_cpu_threshold = simgrid::config::get_value<double>("smpi/cpu-threshold");
- smpi_host_speed = simgrid::config::get_value<double>("smpi/host-speed");
- xbt_assert(smpi_host_speed > 0.0, "You're trying to set the host_speed to a non-positive value (given: %f)", smpi_host_speed);
+ if (smpi_cpu_threshold < 0)
+ smpi_cpu_threshold = DBL_MAX;
+
+ smpi_host_speed = simgrid::config::get_value<double>("smpi/host-speed");
std::string smpi_privatize_option = simgrid::config::get_value<std::string>("smpi/privatization");
if (smpi_privatize_option == "no" || smpi_privatize_option == "0")
smpi_privatize_global_variables = SmpiPrivStrategies::NONE;
smpi_privatize_global_variables = SmpiPrivStrategies::DLOPEN;
}
- if (smpi_cpu_threshold < 0)
- smpi_cpu_threshold = DBL_MAX;
-
std::string val = simgrid::config::get_value<std::string>("smpi/shared-malloc");
if ((val == "yes") || (val == "1") || (val == "on") || (val == "global")) {
smpi_cfg_shared_malloc = SharedMallocType::GLOBAL;
char fullpath[512] = {'\0'};
strncpy(fullpath, libname.c_str(), 511);
#if not defined(__APPLE__) && not defined(__HAIKU__)
- int ret = dl_iterate_phdr(visit_libs, fullpath);
- if (ret == 0)
- xbt_die("Can't find a linked %s - check the setting you gave to smpi/privatize-libs", fullpath);
- else
- XBT_DEBUG("Extra lib to privatize found : %s", fullpath);
+ xbt_assert(0 != dl_iterate_phdr(visit_libs, fullpath),
+ "Can't find a linked %s - check your settings in smpi/privatize-libs", fullpath);
+ XBT_DEBUG("Extra lib to privatize '%s' found", fullpath);
#else
- xbt_die("smpi/privatize-libs is not (yet) compatible with OSX");
+ xbt_die("smpi/privatize-libs is not (yet) compatible with OSX nor with Haiku");
#endif
privatize_libs_paths.push_back(fullpath);
dlclose(libhandle);