X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9de2143df74699fb6e21a9eb8f37e38db0c00357..8d02fbe4957574edddc92b86d2d32dcdd81b8d1d:/src/smpi/internals/smpi_memory.cpp diff --git a/src/smpi/internals/smpi_memory.cpp b/src/smpi/internals/smpi_memory.cpp index 7ac4abd024..ce5d3da4bc 100644 --- a/src/smpi/internals/smpi_memory.cpp +++ b/src/smpi/internals/smpi_memory.cpp @@ -28,10 +28,13 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_memory, smpi, "Memory layout support for SMPI"); -int smpi_loaded_page = -1; +int smpi_loaded_page = -1; char* smpi_data_exe_start = nullptr; int smpi_data_exe_size = 0; int smpi_privatize_global_variables; +static char* smpi_data_exe_copy; +smpi_privatization_region_t smpi_privatization_regions; +// static std::set smpi_privatization_regions; static const int PROT_RWX = (PROT_READ | PROT_WRITE | PROT_EXEC); static const int PROT_RW = (PROT_READ | PROT_WRITE ); @@ -110,10 +113,8 @@ void smpi_really_switch_data_segment(int dest) return; #if HAVE_PRIVATIZATION - if(smpi_loaded_page==-1){//initial switch, do the copy from the real page here - for (int i=0; i< smpi_process_count(); i++){ - asan_safe_memcpy(smpi_privatization_regions[i].address, TOPAGE(smpi_data_exe_start), smpi_data_exe_size); - } + if (smpi_loaded_page == -1) { // initial switch, do the copy from the real page here + asan_safe_memcpy(smpi_data_exe_copy, TOPAGE(smpi_data_exe_start), smpi_data_exe_size); } // FIXME, cross-process support (mmap across process when necessary) @@ -146,6 +147,8 @@ void smpi_initialize_global_memory_segments() return; } + smpi_data_exe_copy = (char*)malloc(smpi_data_exe_size); + asan_safe_memcpy(smpi_data_exe_copy, TOPAGE(smpi_data_exe_start), smpi_data_exe_size); smpi_privatization_regions = new s_smpi_privatization_region_t[smpi_process_count()]; for (int i=0; i< smpi_process_count(); i++){ @@ -192,7 +195,7 @@ Ask the Internet about tutorials on how to increase the files limit such as: htt xbt_die("Impossible to unlink temporary file for memory mapping"); // initialize the values - asan_safe_memcpy(address, TOPAGE(smpi_data_exe_start), smpi_data_exe_size); + asan_safe_memcpy(address, smpi_data_exe_copy, smpi_data_exe_size); // store the address of the mapping for further switches smpi_privatization_regions[i].file_descriptor = file_descriptor;