Browse Source

Enable allocation cache in main RAM when STARPU_LIMIT_CPU_MEM is set by the user.

Samuel Thibault 10 years ago
parent
commit
1088233b30
3 changed files with 12 additions and 11 deletions
  1. 2 0
      ChangeLog
  2. 2 1
      doc/doxygen/chapters/40environment_variables.doxy
  3. 8 10
      src/datawizard/memalloc.c

+ 2 - 0
ChangeLog

@@ -122,6 +122,8 @@ The scheduling context release
 
 New features:
   * Fix and actually enable the cache allocation.
+  * Enable allocation cache in main RAM when STARPU_LIMIT_CPU_MEM is set by
+    the user.
 
 Changes:
   * Fix complexity of implicit task/data dependency, from quadratic to linear.

+ 2 - 1
doc/doxygen/chapters/40environment_variables.doxy

@@ -565,7 +565,8 @@ that have a limited amount of memory.
 \anchor STARPU_LIMIT_CPU_MEM
 \addindex __env__STARPU_LIMIT_CPU_MEM
 This variable specifies the maximum number of megabytes that should be
-available to the application on each CPU device.
+available to the application on each CPU device. Setting it enables allocation
+cache in main memory
 </dd>
 
 <dt>STARPU_MINIMUM_AVAILABLE_MEM</dt>

+ 8 - 10
src/datawizard/memalloc.c

@@ -852,18 +852,16 @@ void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, struct _star
 
 	_starpu_spin_unlock(&mc_lock[node]);
 
-	/* We would only flush the RAM nodes cache if memory gets tight, either
-	 * because StarPU automatically knows the total memory size of the
-	 * machine, or because the user has provided a limitation.
-	 *
-	 * We don't really want the former scenario to be eating a lot of
-	 * memory just for caching allocations. Allocating main memory is cheap
-	 * anyway.
+	/*
+	 * Unless the user has provided a main RAM limitation, we would fill
+	 * memory with cached data and then eventually swap.
 	 */
-	/* This is particularly important when
+	/*
+	 * This is particularly important when
 	 * STARPU_USE_ALLOCATION_CACHE is not enabled, as we
-	 * wouldn't even re-use these allocations! */
-	if (starpu_node_get_kind(node) == STARPU_CPU_RAM)
+	 * wouldn't even re-use these allocations!
+	 */
+	if (starpu_node_get_kind(node) == STARPU_CPU_RAM && starpu_get_env_number("STARPU_LIMIT_CPU_MEM") < 0)
 	{
 		/* Free data immediately */
 		free_memory_on_node(mc, node);