Forráskód Böngészése

Use smpi functions only when smpi is running

Samuel Thibault 5 éve
szülő
commit
60d2151065
1 módosított fájl, 9 hozzáadás és 12 törlés
  1. 9 12
      src/datawizard/malloc.c

+ 9 - 12
src/datawizard/malloc.c

@@ -61,12 +61,9 @@ static int malloc_on_node_default_flags[STARPU_MAXNODES];
 
 /* This file is used for implementing "folded" allocation */
 #ifdef STARPU_SIMGRID
-#if SIMGRID_VERSION < 31500 || SIMGRID_VERSION == 31559
-/* 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
 
 static starpu_malloc_hook malloc_hook;
 static starpu_free_hook free_hook;
@@ -279,9 +276,11 @@ int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int fl
 	if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
 	{
 #if SIMGRID_VERSION >= 31500 && SIMGRID_VERSION != 31559
-		*A = SMPI_SHARED_MALLOC(dim);
-#else
-		/* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
+	    if (_starpu_simgrid_running_smpi())
+		    *A = SMPI_SHARED_MALLOC(dim);
+	    else
+#endif
+	    {
 		/* Use "folded" allocation: the same file is mapped several
 		 * times contiguously, to get a memory area one can read/write,
 		 * without consuming memory */
@@ -338,7 +337,7 @@ int _starpu_malloc_flags_on_node(unsigned dst_node, void **A, size_t dim, int fl
 			}
 			*A = buf;
 		}
-#endif
+	    }
 	}
 #endif
 #ifdef STARPU_HAVE_HWLOC
@@ -527,11 +526,11 @@ int _starpu_free_flags_on_node(unsigned dst_node, void *A, size_t dim, int flags
 	if (flags & STARPU_MALLOC_SIMULATION_FOLDED)
 	{
 #if SIMGRID_VERSION >= 31500 && SIMGRID_VERSION != 31559
+	    if (_starpu_simgrid_running_smpi())
 		SMPI_SHARED_FREE(A);
-#else
-		/* TODO: drop when simgrid 3.15 is reasonably largely used by people who need the feature */
-		munmap(A, dim);
+	    else
 #endif
+		munmap(A, dim);
 	}
 #endif
 #ifdef STARPU_HAVE_HWLOC
@@ -695,11 +694,9 @@ _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 < 31500 || SIMGRID_VERSION == 31559
 	/* Reasonably "costless" */
 	_starpu_malloc_simulation_fold = starpu_get_env_number_default("STARPU_MALLOC_SIMULATION_FOLD", 1) << 20;
 #endif
-#endif
 }
 
 void