|
@@ -32,6 +32,7 @@
|
|
|
#ifdef STARPU_SIMGRID
|
|
|
#include <sys/mman.h>
|
|
|
#include <fcntl.h>
|
|
|
+#include <smpi/smpi.h>
|
|
|
#endif
|
|
|
|
|
|
#ifndef O_BINARY
|
|
@@ -48,9 +49,12 @@ static int malloc_on_node_default_flags[STARPU_MAXNODES];
|
|
|
|
|
|
/* This file is used for implementing "folded" allocation */
|
|
|
#ifdef STARPU_SIMGRID
|
|
|
+#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 15)
|
|
|
+/* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
|
|
|
static int bogusfile = -1;
|
|
|
static unsigned long _starpu_malloc_simulation_fold;
|
|
|
#endif
|
|
|
+#endif
|
|
|
|
|
|
void starpu_malloc_set_align(size_t align)
|
|
|
{
|
|
@@ -224,6 +228,10 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
|
|
|
#ifdef STARPU_SIMGRID
|
|
|
if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
|
|
|
{
|
|
|
+#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 15)
|
|
|
+ *A = SMPI_SHARED_MALLOC(dim);
|
|
|
+#else
|
|
|
+ /* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
|
|
|
/* Use "folded" allocation: the same file is mapped several
|
|
|
* times contiguously, to get a memory area one can read/write,
|
|
|
* without consuming memory */
|
|
@@ -276,6 +284,7 @@ int starpu_malloc_flags(void **A, size_t dim, int flags)
|
|
|
}
|
|
|
*A = buf;
|
|
|
}
|
|
|
+#endif
|
|
|
}
|
|
|
else
|
|
|
#endif
|
|
@@ -442,7 +451,12 @@ int starpu_free_flags(void *A, size_t dim, int flags)
|
|
|
#ifdef STARPU_SIMGRID
|
|
|
if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
|
|
|
{
|
|
|
+#if SIMGRID_VERSION_MAJOR > 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR >= 15)
|
|
|
+ SMPI_SHARED_FREE(A);
|
|
|
+#else
|
|
|
+ /* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
|
|
|
munmap(A, dim);
|
|
|
+#endif
|
|
|
}
|
|
|
else
|
|
|
#endif
|
|
@@ -810,9 +824,11 @@ _starpu_malloc_init(unsigned dst_node)
|
|
|
disable_pinning = starpu_get_env_number("STARPU_DISABLE_PINNING");
|
|
|
malloc_on_node_default_flags[dst_node] = STARPU_MALLOC_PINNED | STARPU_MALLOC_COUNT;
|
|
|
#ifdef STARPU_SIMGRID
|
|
|
+#if SIMGRID_VERSION_MAJOR < 3 || (SIMGRID_VERSION_MAJOR == 3 && SIMGRID_VERSION_MINOR < 15)
|
|
|
/* Reasonably "costless" */
|
|
|
_starpu_malloc_simulation_fold = starpu_get_env_number_default("STARPU_MALLOC_SIMULATION_FOLD", 1) << 20;
|
|
|
#endif
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
void
|