X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/64267f7e36562e503aa04a2895707d74b37cc7a2..abf3b21ad3f4a19475431076e6e2b26f76d2e7d6:/src/smpi/internals/smpi_global.cpp diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 39941125fc..10203cbca8 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -1,9 +1,8 @@ -/* Copyright (c) 2007-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2007-2023. The SimGrid Team. All rights reserved. */ /* 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 "mc/mc.h" #include "simgrid/Exception.hpp" #include "simgrid/plugins/file_system.h" #include "simgrid/s4u/Engine.hpp" @@ -13,6 +12,7 @@ #include "smpi_host.hpp" #include "src/kernel/EngineImpl.hpp" #include "src/kernel/activity/CommImpl.hpp" +#include "src/mc/mc.h" #include "src/mc/mc_replay.hpp" #include "src/smpi/include/smpi_actor.hpp" #include "xbt/config.hpp" @@ -36,7 +36,7 @@ #endif #if HAVE_PAPI -#include "papi.h" +#include #endif #if not defined(__APPLE__) && not defined(__HAIKU__) @@ -59,51 +59,51 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (ke * See https://www.akkadia.org/drepper/dsohowto.pdf * and https://lists.freebsd.org/pipermail/freebsd-current/2016-March/060284.html */ -#if !RTLD_DEEPBIND || HAVE_SANITIZER_ADDRESS || HAVE_SANITIZER_THREAD +#if !defined(RTLD_DEEPBIND) || !RTLD_DEEPBIND || HAVE_SANITIZER_ADDRESS || HAVE_SANITIZER_THREAD #define WANT_RTLD_DEEPBIND 0 #else #define WANT_RTLD_DEEPBIND RTLD_DEEPBIND #endif #if HAVE_PAPI -std::map> units2papi_setup; + std::map> units2papi_setup; #endif -std::unordered_map location2speedup; + std::unordered_map location2speedup; -static int smpi_exit_status = 0; -xbt_os_timer_t global_timer; -static std::vector privatize_libs_paths; + static int smpi_exit_status = 0; + static xbt_os_timer_t global_timer; + static std::vector privatize_libs_paths; -// No instance gets manually created; check also the smpirun.in script as -// this default name is used there as well (when the tag is generated). -static const std::string smpi_default_instance_name("smpirun"); + // No instance gets manually created; check also the smpirun.in script as + // this default name is used there as well (when the tag is generated). + static const std::string smpi_default_instance_name("smpirun"); -static simgrid::config::Flag - smpi_hostfile("smpi/hostfile", - "Classical MPI hostfile containing list of machines to dispatch " - "the processes, one per line", - ""); + static simgrid::config::Flag + smpi_hostfile("smpi/hostfile", + "Classical MPI hostfile containing list of machines to dispatch " + "the processes, one per line", + ""); -static simgrid::config::Flag smpi_replay("smpi/replay", - "Replay a trace instead of executing the application", ""); + static simgrid::config::Flag smpi_replay("smpi/replay", + "Replay a trace instead of executing the application", ""); -static simgrid::config::Flag smpi_np("smpi/np", "Number of processes to be created", 0); + static simgrid::config::Flag smpi_np("smpi/np", "Number of processes to be created", 0); -static simgrid::config::Flag smpi_map("smpi/map", "Display the mapping between nodes and processes", 0); + static simgrid::config::Flag smpi_map("smpi/map", "Display the mapping between nodes and processes", 0); -std::function smpi_comm_copy_data_callback = - &smpi_comm_copy_buffer_callback; + std::function smpi_comm_copy_data_callback = + &smpi_comm_copy_buffer_callback; -simgrid::smpi::ActorExt* smpi_process() -{ - simgrid::s4u::ActorPtr me = simgrid::s4u::Actor::self(); + simgrid::smpi::ActorExt* smpi_process() + { + simgrid::s4u::ActorPtr me = simgrid::s4u::Actor::self(); - if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) - return nullptr; + if (me == nullptr) // This happens sometimes (eg, when linking against NS3 because it pulls openMPI...) + return nullptr; - return me->extension(); -} + return me->extension(); + } simgrid::smpi::ActorExt* smpi_process_remote(simgrid::s4u::ActorPtr actor) { @@ -520,6 +520,10 @@ int smpi_main(const char* executable, int argc, char* argv[]) * configuration tools */ return 0; } + if (argv[0] == std::string("--help-coll")) { + std::cerr << simgrid::smpi::colls::get_smpi_coll_help(); + return 0; + } smpi_init_options_internal(true); simgrid::s4u::Engine engine(&argc, argv); @@ -529,6 +533,9 @@ int smpi_main(const char* executable, int argc, char* argv[]) engine.load_platform(argv[1]); engine.set_default_comm_data_copy_callback(smpi_comm_copy_buffer_callback); + xbt_assert(not MC_is_active() || smpi_cfg_privatization() != SmpiPrivStrategies::MMAP, + "Please use the dlopen privatization schema when model-checking SMPI code"); + if (smpi_cfg_privatization() == SmpiPrivStrategies::DLOPEN) smpi_init_privatization_dlopen(executable); else @@ -561,12 +568,15 @@ int smpi_main(const char* executable, int argc, char* argv[]) SMPI_app_instance_register(smpi_default_instance_name.c_str(), nullptr, rank_counts); MPI_COMM_WORLD = *smpi_deployment_comm_world(smpi_default_instance_name); - /* Clean IO before the run */ + /* Flush output streams before and after the run */ fflush(stdout); fflush(stderr); engine.get_impl()->run(-1); + fflush(stderr); + fflush(stdout); + xbt_os_walltimer_stop(global_timer); simgrid::smpi::utils::print_time_analysis(xbt_os_timer_elapsed(global_timer));