X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d3a5b5e5113cf4438faf96f6dc442240c5b9d085..b1867c04911ca6ca2e39b960a9a44b8d20be2e2b:/src/smpi/internals/smpi_process.cpp diff --git a/src/smpi/internals/smpi_process.cpp b/src/smpi/internals/smpi_process.cpp index bb4f482f5d..d341b28f72 100644 --- a/src/smpi/internals/smpi_process.cpp +++ b/src/smpi/internals/smpi_process.cpp @@ -8,14 +8,12 @@ #include "private.hpp" #include "smpi_comm.hpp" #include "smpi_group.hpp" -#include "src/mc/mc_replay.h" +#include "src/mc/mc_replay.hpp" #include "src/msg/msg_private.hpp" #include "src/simix/smx_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_process, smpi, "Logging specific to SMPI (kernel)"); -//TODO : replace -extern simgrid::smpi::Process **process_data; extern int* index_to_process_data; #define MAILBOX_NAME_MAXLEN (5 + sizeof(int) * 2 + 1) @@ -75,7 +73,8 @@ void Process::set_data(int index, int* argc, char*** argv) instance_id_ = instance_id; index_ = index; - static_cast(SIMIX_process_self()->userdata)->data = this; + process_ = SIMIX_process_self(); + static_cast(process_->userdata)->data = this; if (*argc > 3) { memmove(&(*argv)[0], &(*argv)[2], sizeof(char *) * (*argc - 2)); @@ -87,8 +86,7 @@ void Process::set_data(int index, int* argc, char*** argv) argv_ = argv; // set the process attached to the mailbox mailbox_small_->setReceiver(simgrid::s4u::Actor::self()); - process_ = SIMIX_process_self(); - XBT_DEBUG("<%d> New process in the game: %p", index_, SIMIX_process_self()); + XBT_DEBUG("<%d> New process in the game: %p", index_, process_); } /** @brief Prepares the current process for termination. */ @@ -272,9 +270,8 @@ void Process::set_return_value(int val){ void Process::init(int *argc, char ***argv){ - if (process_data == nullptr){ - printf("SimGrid was not initialized properly before entering MPI_Init. Aborting, please check compilation process and use smpirun\n"); - exit(1); + if (smpi_process_count() == 0) { + xbt_die("SimGrid was not initialized properly before entering MPI_Init. Aborting, please check compilation process and use smpirun\n"); } if (argc != nullptr && argv != nullptr) { smx_actor_t proc = SIMIX_process_self(); @@ -298,7 +295,7 @@ void Process::init(int *argc, char ***argv){ // this up here so that I can set the privatized region before the switch. Process* process = smpi_process_remote(index); if(smpi_privatize_global_variables == SMPI_PRIVATIZE_MMAP){ - /* Now using segment index of the process */ + /* Now using the segment index of this process */ index = proc->segment_index; process->set_privatized_region(smpi_init_global_memory_segment_process()); /* Done at the process's creation */