Просмотр исходного кода

Since we now use the hwloc-provided memory size for global mem, we can enable allocation caching

Samuel Thibault лет назад: 4
Родитель
Сommit
ef297ff6de
2 измененных файлов с 9 добавлено и 5 удалено
  1. 3 0
      src/core/topology.c
  2. 6 5
      src/datawizard/memalloc.c

+ 3 - 0
src/core/topology.c

@@ -1995,6 +1995,9 @@ static size_t _starpu_cpu_get_global_mem_size(int nodeid, struct _starpu_machine
 		}
 	}
 
+	/* Don't eat all memory for ourself */
+	global_mem *= 0.9;
+
 	if (limit < 0)
 		// No limit is defined, we return the global memory size
 		return global_mem;

+ 6 - 5
src/datawizard/memalloc.c

@@ -1394,7 +1394,7 @@ void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, struct _star
 	_starpu_spin_unlock(&mc_lock[node]);
 
 	/*
-	 * Unless the user has provided a main RAM limitation, we would fill
+	 * Unless we have a memory limitation, we would fill
 	 * memory with cached data and then eventually swap.
 	 */
 	/*
@@ -1402,11 +1402,12 @@ void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, struct _star
 	 * STARPU_USE_ALLOCATION_CACHE is not enabled, as we
 	 * wouldn't even re-use these allocations!
 	 */
-	if (handle->ops->dontcache || (starpu_node_get_kind(node) == STARPU_CPU_RAM
-#ifdef STARPU_USE_ALLOCATION_CACHE
-				&& limit_cpu_mem < 0
+	if (handle->ops->dontcache
+			|| !_starpu_memory_manager_get_global_memory_size(node)
+#ifndef STARPU_USE_ALLOCATION_CACHE
+			|| starpu_node_get_kind(node) == STARPU_CPU_RAM
 #endif
-				))
+			)
 	{
 		/* Free data immediately */
 		free_memory_on_node(mc, node);