X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/4f80adb3e995a6099ac4ca3da1fe02d23ecb2eb3..dd05e77cf9fe231aef1608d42c8e45ac3ee5c15c:/src/smpi/internals/smpi_global.cpp diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 6e379ab8dd..47ee856894 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -3,7 +3,7 @@ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ -#include "SmpiHost.hpp" +#include "smpi_host.hpp" #include "mc/mc.h" #include "simgrid/s4u/Engine.hpp" #include "smpi_coll.hpp" @@ -87,7 +87,7 @@ simgrid::smpi::Process* smpi_process() ActorPtr me = Actor::self(); if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) return nullptr; - simgrid::msg::ActorExt* msgExt = static_cast(me->get_impl()->userdata); + simgrid::msg::ActorExt* msgExt = static_cast(me->get_impl()->getUserData()); return static_cast(msgExt->data); } @@ -218,17 +218,17 @@ 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")) { + if (simgrid::config::is_default("smpi/host-speed")) { XBT_INFO("You did not set the power of the host running the simulation. " "The timings will certainly not be accurate. " "Use the option \"--cfg=smpi/host-speed:\" to set its value." "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 = xbt_cfg_get_string("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 xbt_cfg_get_string("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 = xbt_cfg_get_string("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 = xbt_cfg_get_string("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") @@ -386,20 +386,20 @@ static void smpi_init_options(){ } #endif - if (smpi_cpu_threshold < 0) - smpi_cpu_threshold = DBL_MAX; - - std::string val = xbt_cfg_get_string("smpi/shared-malloc"); - if ((val == "yes") || (val == "1") || (val == "on") || (val == "global")) { - smpi_cfg_shared_malloc = shmalloc_global; - } else if (val == "local") { - smpi_cfg_shared_malloc = shmalloc_local; - } else if ((val == "no") || (val == "0") || (val == "off")) { - smpi_cfg_shared_malloc = shmalloc_none; - } else { - xbt_die("Invalid value '%s' for option smpi/shared-malloc. Possible values: 'on' or 'global', 'local', 'off'", - val.c_str()); - } + if (smpi_cpu_threshold < 0) + smpi_cpu_threshold = DBL_MAX; + + 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") { + smpi_cfg_shared_malloc = shmalloc_local; + } else if ((val == "no") || (val == "0") || (val == "off")) { + smpi_cfg_shared_malloc = shmalloc_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 smpi_entry_point_type; @@ -464,9 +464,8 @@ int smpi_main(const char* executable, int argc, char *argv[]) // TODO This will not be executed in the case where smpi_main is not called, // e.g., not for smpi_msg_masterslave. This should be moved to another location // that is always called -- maybe close to Actor::onCreation? - simgrid::s4u::Host::onCreation.connect([](simgrid::s4u::Host& host) { - host.extension_set(new simgrid::smpi::SmpiHost(&host)); - }); + simgrid::s4u::Host::on_creation.connect( + [](simgrid::s4u::Host& host) { host.extension_set(new simgrid::smpi::Host(&host)); }); // parse the platform file: get the host list SIMIX_create_environment(argv[1]); @@ -529,7 +528,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 +580,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" @@ -595,8 +594,6 @@ int smpi_main(const char* executable, int argc, char *argv[]) } smpi_global_destroy(); - TRACE_end(); - return smpi_exit_status; } @@ -618,7 +615,7 @@ void SMPI_init(){ smpi_init_options(); smpi_global_init(); smpi_check_options(); - simgrid::s4u::onSimulationEnd.connect(TRACE_smpi_release); + simgrid::s4u::on_simulation_end.connect(TRACE_smpi_release); } void SMPI_finalize(){