-void smpi_global_destroy()
-{
- smpi_bench_destroy();
- smpi_shared_destroy();
- smpi_deployment_cleanup_instances();
-
- if (simgrid::smpi::Colls::smpi_coll_cleanup_callback != nullptr)
- simgrid::smpi::Colls::smpi_coll_cleanup_callback();
-
- MPI_COMM_WORLD = MPI_COMM_NULL;
-
- if (not MC_is_active()) {
- xbt_os_timer_free(global_timer);
- }
-
- if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP)
- smpi_destroy_global_memory_segments();
- smpi_free_static();
- if(simgrid::smpi::F2C::lookup() != nullptr)
- simgrid::smpi::F2C::delete_lookup();
-}
-
-static void smpi_init_options(){
- // 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 = 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);
- 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;
- 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;
- }
-#if !HAVE_WORKING_MMAP
- if (smpi_privatize_global_variables == SmpiPrivStrategies::MMAP) {
- XBT_INFO("mmap privatization is broken on this platform, switching to dlopen privatization instead.");
- smpi_privatize_global_variables = SmpiPrivStrategies::DLOPEN;
- }
-#endif
-
- 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;
- } else if (val == "local") {
- smpi_cfg_shared_malloc = SharedMallocType::LOCAL;
- } else if ((val == "no") || (val == "0") || (val == "off")) {
- smpi_cfg_shared_malloc = SharedMallocType::NONE;
- } else {
- xbt_die("Invalid value '%s' for option smpi/shared-malloc. Possible values: 'on' or 'global', 'local', 'off'",
- val.c_str());
- }
-}
-
-typedef std::function<int(int argc, char *argv[])> smpi_entry_point_type;
-typedef int (* smpi_c_entry_point_type)(int argc, char **argv);
-typedef void (*smpi_fortran_entry_point_type)();