From: Arnaud Giersch Date: Tue, 28 Jun 2022 13:08:05 +0000 (+0200) Subject: SMPI_is_inited() and smpi_enabled() have the same purpose. Keep only the former. X-Git-Tag: v3.32~178^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0e886d5f40a337fb0746a86df15ede0e871fe7f9 SMPI_is_inited() and smpi_enabled() have the same purpose. Keep only the former. --- diff --git a/src/kernel/EngineImpl.cpp b/src/kernel/EngineImpl.cpp index 7706219d05..00d0f16557 100644 --- a/src/kernel/EngineImpl.cpp +++ b/src/kernel/EngineImpl.cpp @@ -106,7 +106,7 @@ static void segvhandler(int signum, siginfo_t* siginfo, void* /*context*/) } else if (siginfo->si_signo == SIGSEGV) { fprintf(stderr, "Segmentation fault.\n"); #if HAVE_SMPI - if (smpi_enabled() && smpi_cfg_privatization() == SmpiPrivStrategies::NONE) { + if (SMPI_is_inited() && smpi_cfg_privatization() == SmpiPrivStrategies::NONE) { #if HAVE_PRIVATIZATION fprintf(stderr, "Try to enable SMPI variable privatization with --cfg=smpi/privatization:yes.\n"); #else diff --git a/src/mc/remote/AppSide.cpp b/src/mc/remote/AppSide.cpp index 8d612f150a..2d4dfbea70 100644 --- a/src/mc/remote/AppSide.cpp +++ b/src/mc/remote/AppSide.cpp @@ -137,8 +137,8 @@ void AppSide::handle_finalize(const s_mc_message_int_t* msg) const if (XBT_LOG_ISENABLED(mc_client, xbt_log_priority_debug)) kernel::EngineImpl::get_instance()->display_all_actor_status(); #if HAVE_SMPI - XBT_DEBUG("Smpi_enabled: %d", (int)smpi_enabled()); - if (smpi_enabled()) + XBT_DEBUG("Smpi_enabled: %d", SMPI_is_inited()); + if (SMPI_is_inited()) SMPI_finalize(); #endif } diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index 87cfe01ae9..f92ea49c7c 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -95,7 +95,6 @@ XBT_PRIVATE void smpi_cleanup_op_cost_callback(); XBT_PRIVATE void smpi_comm_null_copy_buffer_callback(simgrid::kernel::activity::CommImpl* comm, void* buff, size_t buff_size); -XBT_PRIVATE int smpi_enabled(); XBT_PRIVATE double smpi_mpi_wtime(); XBT_PRIVATE void smpi_mpi_init(); diff --git a/src/smpi/internals/smpi_global.cpp b/src/smpi/internals/smpi_global.cpp index 3ff42f8613..8b3a184c87 100644 --- a/src/smpi/internals/smpi_global.cpp +++ b/src/smpi/internals/smpi_global.cpp @@ -213,10 +213,6 @@ void smpi_comm_null_copy_buffer_callback(simgrid::kernel::activity::CommImpl*, v /* nothing done in this version */ } -int smpi_enabled() { - return MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED; -} - static void smpi_init_papi() { #if HAVE_PAPI @@ -583,11 +579,11 @@ int smpi_main(const char* executable, int argc, char* argv[]) return smpi_exit_status; } -static bool smpi_inited = false; int SMPI_is_inited() { - return smpi_inited; + return MPI_COMM_WORLD != MPI_COMM_UNINITIALIZED; } + // Called either directly from the user code, or from the code called by smpirun void SMPI_init(){ smpi_init_options_internal(false); @@ -606,7 +602,6 @@ void SMPI_init(){ } smpi_init_papi(); smpi_check_options(); - smpi_inited = true; } void SMPI_finalize()