X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/ee6ffc12bf5523e4d2d2193138c791d991ec0ae4..e98908d4e3ea9f355370a4f0a9db15b9593b7eb1:/src/simix/smx_process.cpp diff --git a/src/simix/smx_process.cpp b/src/simix/smx_process.cpp index b56bae07fc..3f74714d1c 100644 --- a/src/simix/smx_process.cpp +++ b/src/simix/smx_process.cpp @@ -13,6 +13,10 @@ #include "src/mc/mc_client.h" #include "src/simix/smx_private.hpp" +#ifdef HAVE_SMPI +#include "src/smpi/private.h" +#endif + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_process, simix, "Logging specific to SIMIX (process)"); @@ -262,9 +266,22 @@ smx_process_t SIMIX_process_create( process->data = data; process->comms = xbt_fifo_new(); process->simcall.issuer = process; + /* Initiliaze data segment to default value */ + SIMIX_segment_index_set(process, -1); - if (parent_process) { + if (parent_process != NULL) { process->ppid = SIMIX_process_get_PID(parent_process); + /* SMPI process have their own data segment and + each other inherit from their father */ +#ifdef HAVE_SMPI + if(smpi_privatize_global_variables){ + if( parent_process->pid != 0){ + SIMIX_segment_index_set(process, parent_process->segment_index); + } else { + SIMIX_segment_index_set(process, process->pid - 1); + } + } +#endif } else { process->ppid = -1; } @@ -655,6 +672,10 @@ sg_host_t SIMIX_process_get_host(smx_process_t process) return process->host; } +xbt_main_func_t SIMIX_process_get_code(void){ + return SIMIX_process_self()->code; +} + /* needs to be public and without simcall because it is called by exceptions and logging events */ const char* SIMIX_process_self_get_name(void) { @@ -875,6 +896,9 @@ void SIMIX_process_yield(smx_process_t self) SMX_THROW(); } + if(SMPI_switch_data_segment && self->segment_index != -1){ + SMPI_switch_data_segment(self->segment_index); + } } /* callback: context fetching */ @@ -1014,3 +1038,7 @@ smx_process_t SIMIX_process_restart(smx_process_t process, smx_process_t issuer) } return new_process; } + +void SIMIX_segment_index_set(smx_process_t proc, int index){ + proc->segment_index = index; +}