X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/cf6a1cc5a48717bed67bcb9e32b77e51ea9f53c7..db5f97d1bc07f6e20cccd108be11e1e34b4ed109:/src/smpi/internals/smpi_memory.cpp diff --git a/src/smpi/internals/smpi_memory.cpp b/src/smpi/internals/smpi_memory.cpp index dab12faeca..fdfcb18c3f 100644 --- a/src/smpi/internals/smpi_memory.cpp +++ b/src/smpi/internals/smpi_memory.cpp @@ -1,8 +1,14 @@ -/* Copyright (c) 2015-2022. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2015-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 "private.hpp" +#include "src/internal_config.h" +#include "src/kernel/EngineImpl.hpp" +#include "src/smpi/include/smpi_actor.hpp" +#include "src/xbt/memory_map.hpp" + #include #include #include @@ -12,25 +18,17 @@ #include #include #include +#include #include #include -#include - -#ifndef WIN32 -#include #include - -#include "private.hpp" -#include "src/internal_config.h" -#include "src/smpi/include/smpi_actor.hpp" -#include "src/xbt/memory_map.hpp" -#include "xbt/virtu.h" +#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SMPI"); -char* smpi_data_exe_start = nullptr; -size_t smpi_data_exe_size = 0; -SmpiPrivStrategies smpi_privatize_global_variables; +static char* smpi_data_exe_start = nullptr; // start of the data+bss segment of the executable +static size_t smpi_data_exe_size = 0; // size of the data+bss segment of the executable +static SmpiPrivStrategies smpi_privatize_global_variables; static void* smpi_data_exe_copy; // Initialized by smpi_prepare_global_memory_segment(). @@ -54,8 +52,9 @@ void smpi_prepare_global_memory_segment() static void smpi_get_executable_global_size() { - char* buffer = realpath(simgrid::xbt::binary_name.c_str(), nullptr); - xbt_assert(buffer != nullptr, "Could not resolve real path of binary file '%s'", simgrid::xbt::binary_name.c_str()); + auto* binary_name = simgrid::kernel::EngineImpl::get_instance()->get_cmdline().front().c_str(); + char* buffer = realpath(binary_name, nullptr); + xbt_assert(buffer != nullptr, "Could not resolve real path of binary file '%s'", binary_name); std::string full_name = buffer; free(buffer); @@ -85,7 +84,6 @@ static void smpi_get_executable_global_size() } xbt_die("Did not find my data segment."); } -#endif #if HAVE_SANITIZER_ADDRESS #include