X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/494c5eaacbb6b0b6bad3cff6506d8bfbf14cf52e..76d5ed561fdd3411adbed2c3b659a1312e138284:/src/smpi/smpi_shared.cpp diff --git a/src/smpi/smpi_shared.cpp b/src/smpi/smpi_shared.cpp index e0aa0d1b35..a717d39a03 100644 --- a/src/smpi/smpi_shared.cpp +++ b/src/smpi/smpi_shared.cpp @@ -33,32 +33,19 @@ * \ | | * ---- */ -#include - #include -#include -#include "src/internal_config.h" #include "private.h" #include "private.hpp" -#include #include "xbt/dict.h" -//#include "xbt/sysdep.h" -//#include "xbt/ex.h" -#include "surf/surf.h" -#include "simgrid/sg_config.h" -//#include "simgrid/modelchecker.h" -//#include "src/mc/mc_replay.h" +#include #include #ifndef WIN32 #include #endif #include -#include #include -//#include // sqrt -#include #include #include @@ -225,6 +212,8 @@ void *smpi_shared_malloc(size_t size, const char *file, int line) if (smpi_shared_malloc_bogusfile == -1) { /* Create a fd to a new file on disk, make it smpi_shared_malloc_blocksize big, and unlink it. * It still exists in memory but not in the file system (thus it cannot be leaked). */ + smpi_shared_malloc_blocksize = static_cast(xbt_cfg_get_double("smpi/shared-malloc-blocksize")); + XBT_DEBUG("global shared allocation. Blocksize %lu", smpi_shared_malloc_blocksize); char* name = xbt_strdup("/tmp/simgrid-shmalloc-XXXXXX"); smpi_shared_malloc_bogusfile = mkstemp(name); unlink(name); @@ -243,7 +232,8 @@ void *smpi_shared_malloc(size_t size, const char *file, int line) void* res = mmap(pos, smpi_shared_malloc_blocksize, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED | MAP_POPULATE, smpi_shared_malloc_bogusfile, 0); xbt_assert(res == pos, "Could not map folded virtual memory (%s). Do you perhaps need to increase the " - "STARPU_MALLOC_SIMULATION_FOLD environment variable or the sysctl vm.max_map_count?", + "size of the mapped file using --cfg=smpi/shared-malloc-blocksize=newvalue (default 1048576) ?", + "You can also try using the sysctl vm.max_map_count", strerror(errno)); } if (size % smpi_shared_malloc_blocksize) { @@ -251,7 +241,8 @@ void *smpi_shared_malloc(size_t size, const char *file, int line) void* res = mmap(pos, size % smpi_shared_malloc_blocksize, PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED | MAP_POPULATE, smpi_shared_malloc_bogusfile, 0); xbt_assert(res == pos, "Could not map folded virtual memory (%s). Do you perhaps need to increase the " - "STARPU_MALLOC_SIMULATION_FOLD environment variable or the sysctl vm.max_map_count?", + "size of the mapped file using --cfg=smpi/shared-malloc-blocksize=newvalue (default 1048576) ?", + "You can also try using the sysctl vm.max_map_count", strerror(errno)); } @@ -272,6 +263,8 @@ void *smpi_shared_malloc(size_t size, const char *file, int line) } int smpi_is_shared(void*ptr){ + if (allocs_metadata.empty()) + return 0; if ( smpi_cfg_shared_malloc == shmalloc_local || smpi_cfg_shared_malloc == shmalloc_global) { if (allocs_metadata.count(ptr) != 0) return 1;