From: Martin Quinson Date: Wed, 31 Jul 2019 16:35:02 +0000 (+0200) Subject: MPI init: inline a function and various small cleanups X-Git-Tag: v3.24~230 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5c9583c94b9cef3f02ffec69b6cc245b1739f97e?hp=239a4433346f0075799df91488cf081f2a0d7b57 MPI init: inline a function and various small cleanups --- diff --git a/src/smpi/include/private.hpp b/src/smpi/include/private.hpp index 97e81b0c66..62da58d7d9 100644 --- a/src/smpi/include/private.hpp +++ b/src/smpi/include/private.hpp @@ -27,7 +27,7 @@ constexpr unsigned MPI_REQ_ACCUMULATE = 0x400; constexpr unsigned MPI_REQ_GENERALIZED = 0x800; constexpr unsigned MPI_REQ_COMPLETE = 0x1000; -enum class SmpiProcessState { UNINITIALIZED, INITIALIZING, INITIALIZED, FINALIZED }; +enum class SmpiProcessState { UNINITIALIZED, INITIALIZING, INITIALIZED /*(=MPI_Init called)*/, FINALIZED }; constexpr int COLL_TAG_REDUCE = -112; constexpr int COLL_TAG_SCATTER = -223; @@ -101,7 +101,6 @@ enum class SharedMallocType { NONE, LOCAL, GLOBAL }; extern XBT_PRIVATE SharedMallocType smpi_cfg_shared_malloc; // Whether to activate shared malloc XBT_PRIVATE void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor); -XBT_PRIVATE void smpi_really_switch_data_segment(simgrid::s4u::ActorPtr actor); XBT_PRIVATE void smpi_prepare_global_memory_segment(); XBT_PRIVATE void smpi_backup_global_memory_segment(); diff --git a/src/smpi/internals/smpi_actor.cpp b/src/smpi/internals/smpi_actor.cpp index 41bca6b497..0b8ff88a22 100644 --- a/src/smpi/internals/smpi_actor.cpp +++ b/src/smpi/internals/smpi_actor.cpp @@ -213,7 +213,7 @@ void ActorExt::init() simgrid::s4u::ActorPtr self = simgrid::s4u::Actor::self(); // cheinrich: I'm not sure what the impact of the SMPI_switch_data_segment on this call is. I moved // this up here so that I can set the privatized region before the switch. - ActorExt* ext = smpi_process_remote(self); + ActorExt* ext = smpi_process(); // if we are in MPI_Init and argc handling has already been done. if (ext->initialized()) return; diff --git a/src/smpi/internals/smpi_memory.cpp b/src/smpi/internals/smpi_memory.cpp index 5b927e8fd2..de20019985 100644 --- a/src/smpi/internals/smpi_memory.cpp +++ b/src/smpi/internals/smpi_memory.cpp @@ -57,8 +57,7 @@ static void smpi_get_executable_global_size() { char buffer[PATH_MAX]; char* full_name = realpath(xbt_binary_name, buffer); - if (full_name == nullptr) - xbt_die("Could not resolve binary file name"); + xbt_assert(full_name != nullptr, "Could not resolve real path of binary file '%s'", xbt_binary_name); std::vector map = simgrid::xbt::get_memory_map(getpid()); for (auto i = map.begin(); i != map.end() ; ++i) { @@ -111,23 +110,16 @@ static void* asan_safe_memcpy(void* dest, void* src, size_t n) #define asan_safe_memcpy(dest, src, n) memcpy(dest, src, n) #endif -/** Map a given SMPI privatization segment (make a SMPI process active) */ -void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor) -{ - if (smpi_loaded_page == actor->get_pid()) // no need to switch, we've already loaded the one we want - return; - - // So the job: - smpi_really_switch_data_segment(actor); -} - -/** Map a given SMPI privatization segment (make a SMPI process active) even if SMPI thinks it is already active +/** Map a given SMPI privatization segment (make a SMPI process active) * * When doing a state restoration, the state of the restored variables might not be consistent with the state of the * virtual memory. In this case, we to change the data segment. */ -void smpi_really_switch_data_segment(simgrid::s4u::ActorPtr actor) +void smpi_switch_data_segment(simgrid::s4u::ActorPtr actor) { + if (smpi_loaded_page == actor->get_pid()) // no need to switch, we've already loaded the one we want + return; + if (smpi_data_exe_size == 0) // no need to switch return;