瀏覽代碼

Do not free memory chunks used for reduction.

Samuel Thibault 13 年之前
父節點
當前提交
669684893e
共有 3 個文件被更改,包括 19 次插入4 次删除
  1. 1 0
      src/datawizard/interfaces/data_interface.c
  2. 9 3
      src/datawizard/memalloc.c
  3. 9 1
      src/datawizard/reduction.c

+ 1 - 0
src/datawizard/interfaces/data_interface.c

@@ -202,6 +202,7 @@ static void _starpu_register_new_data(starpu_data_handle_t handle,
 			replicate->request[node] = NULL;
 		}
 
+		/* Assuming being used for SCRATCH for now, patched when entering REDUX mode */
 		replicate->relaxed_coherency = 1;
 		replicate->initialized = 0;
 		replicate->memory_node = starpu_worker_get_memory_node(worker);

+ 9 - 3
src/datawizard/memalloc.c

@@ -303,9 +303,15 @@ static size_t try_to_free_mem_chunk(struct _starpu_mem_chunk *mc, unsigned node)
 	handle = mc->data;
 	STARPU_ASSERT(handle);
 
-	/* Either it's a "relaxed coherency" memchunk, or it's a memchunk that
-	 * could be used with filters. */
-	if (mc->relaxed_coherency)
+	/* REDUX memchunk */
+	if (mc->relaxed_coherency == 2)
+	{
+		/* TODO: reduce it back to e.g. main memory */
+	}
+	else
+	/* Either it's a "relaxed coherency" memchunk (SCRATCH), or it's a
+	 * memchunk that could be used with filters. */
+	if (mc->relaxed_coherency == 1)
 	{
 		STARPU_ASSERT(mc->replicate);
 

+ 9 - 1
src/datawizard/reduction.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010  Université de Bordeaux 1
+ * Copyright (C) 2010-2011  Université de Bordeaux 1
  * Copyright (C) 2011  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -93,6 +93,7 @@ void _starpu_data_start_reduction_mode(starpu_data_handle_t handle)
 		struct _starpu_data_replicate *replicate;
 		replicate = &handle->per_worker[worker];
 		replicate->initialized = 0;
+		replicate->relaxed_coherency = 2;
 	}
 }
 
@@ -252,6 +253,13 @@ void _starpu_data_end_reduction_mode(starpu_data_handle_t handle)
 	_starpu_spin_lock(&handle->header_lock);
 
 	}
+
+	for (worker = 0; worker < nworkers; worker++)
+	{
+		struct _starpu_data_replicate *replicate;
+		replicate = &handle->per_worker[worker];
+		replicate->relaxed_coherency = 1;
+	}
 }
 
 void _starpu_data_end_reduction_mode_terminate(starpu_data_handle_t handle)