浏览代码

automatically allocate lazily-allocated data when partitioning, or else unpartition will not have a backstore. Fixes tests/datawizard/partition_lazy

Samuel Thibault 13 年之前
父节点
当前提交
08cb460480
共有 1 个文件被更改,包括 13 次插入0 次删除
  1. 13 0
      src/datawizard/filters.c

+ 13 - 0
src/datawizard/filters.c

@@ -114,6 +114,7 @@ void starpu_data_partition(starpu_data_handle_t initial_handle, struct starpu_da
 {
 	unsigned nparts;
 	unsigned i;
+	unsigned node;
 
 	/* first take care to properly lock the data header */
 	_starpu_spin_lock(&initial_handle->header_lock);
@@ -134,6 +135,18 @@ void starpu_data_partition(starpu_data_handle_t initial_handle, struct starpu_da
 
 	unsigned nworkers = starpu_worker_get_count();
 
+	for (node = 0; node < STARPU_MAXNODES; node++)
+	{
+		if (initial_handle->per_node[node].state != STARPU_INVALID)
+			break;
+	}
+	if (node == STARPU_MAXNODES) {
+		/* This is lazy allocation, allocate it now in main RAM, so as
+		 * to have somewhere to gather pieces later */
+		int ret = _starpu_allocate_memory_on_node(initial_handle, &initial_handle->per_node[0], 0);
+		STARPU_ASSERT(!ret);
+	}
+
 	for (i = 0; i < nparts; i++)
 	{
 		starpu_data_handle_t child =