Ver código fonte

Modify the filters. filter_func now only updates a child interface using the father interface. Additionally, the user may provide two functions to a filter: get_nchildren returns the wanted number of children. If NULL, filter_arg is used. get_child_ops enables the programmer to specify each child's interface. If NULL, the father's interface is used.

Mehdi Juhoor 15 anos atrás
pai
commit
7902862bca

+ 3 - 1
examples/audio/starpu_audio_processing.c

@@ -394,7 +394,9 @@ int main(int argc, char **argv)
 	starpu_filter f = 
 	starpu_filter f = 
 	{
 	{
 		.filter_func = starpu_block_filter_func_vector,
 		.filter_func = starpu_block_filter_func_vector,
-		.filter_arg = niter
+		.filter_arg = niter,
+		.get_nchildren = NULL,
+		.get_child_ops = NULL
 	};
 	};
 
 
 	starpu_data_partition(A_handle, &f);
 	starpu_data_partition(A_handle, &f);

+ 3 - 1
examples/axpy/axpy.c

@@ -111,7 +111,9 @@ int main(int argc, char **argv)
 	/* Divide the vector into blocks */
 	/* Divide the vector into blocks */
 	starpu_filter block_filter = {
 	starpu_filter block_filter = {
 		.filter_func = starpu_block_filter_func_vector,
 		.filter_func = starpu_block_filter_func_vector,
-		.filter_arg = NBLOCKS
+		.filter_arg = NBLOCKS,
+		.get_nchildren = NULL,
+		.get_child_ops = NULL
 	};
 	};
 
 
 	starpu_data_partition(handle_x, &block_filter);
 	starpu_data_partition(handle_x, &block_filter);

+ 6 - 2
examples/basic_examples/mult.c

@@ -218,12 +218,16 @@ static void partition_mult_data(void)
 	 * name of the filters are a bit misleading */
 	 * name of the filters are a bit misleading */
 	starpu_filter f = {
 	starpu_filter f = {
 		.filter_func = starpu_vertical_block_filter_func,
 		.filter_func = starpu_vertical_block_filter_func,
-		.filter_arg = nslicesx
+		.filter_arg = nslicesx,
+		.get_nchildren = NULL,
+		.get_child_ops = NULL
 	};
 	};
 		
 		
 	starpu_filter f2 = {
 	starpu_filter f2 = {
 		.filter_func = starpu_block_filter_func,
 		.filter_func = starpu_block_filter_func,
-		.filter_arg = nslicesy
+		.filter_arg = nslicesy,
+		.get_nchildren = NULL,
+		.get_child_ops = NULL
 	};
 	};
 		
 		
 /*
 /*

+ 4 - 0
examples/cholesky/dw_cholesky.c

@@ -245,10 +245,14 @@ void dw_cholesky(float *matA, unsigned size, unsigned ld, unsigned nblocks)
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 4 - 0
examples/cholesky/dw_cholesky_grain.c

@@ -175,10 +175,14 @@ static void _dw_cholesky_grain(float *matA, unsigned size, unsigned ld, unsigned
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 3 - 1
examples/filters/filters.c

@@ -60,7 +60,9 @@ int main(int argc, char **argv)
 	starpu_filter f =
 	starpu_filter f =
 	{
 	{
 		.filter_func = starpu_block_filter_func_vector,
 		.filter_func = starpu_block_filter_func_vector,
-		.filter_arg = PARTS
+		.filter_arg = PARTS,
+		.get_nchildren = NULL,
+		.get_child_ops = NULL
 	};
 	};
 	starpu_data_partition(handle, &f);
 	starpu_data_partition(handle, &f);
 
 

+ 4 - 0
examples/heat/dw_factolu.c

@@ -731,10 +731,14 @@ void dw_factoLU(float *matA, unsigned size,
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 4 - 0
examples/heat/dw_factolu_grain.c

@@ -208,10 +208,14 @@ static void dw_factoLU_grain_inner(float *matA, unsigned size, unsigned inner_si
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 4 - 0
examples/heat/dw_factolu_tag.c

@@ -281,10 +281,14 @@ void dw_factoLU_tag(float *matA, unsigned size, unsigned ld, unsigned nblocks, u
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 4 - 0
examples/lu/xlu.c

@@ -237,10 +237,14 @@ void STARPU_LU(lu_decomposition)(TYPE *matA, unsigned size, unsigned ld, unsigne
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 5 - 1
examples/lu/xlu_implicit.c

@@ -140,14 +140,18 @@ void STARPU_LU(lu_decomposition)(TYPE *matA, unsigned size, unsigned ld, unsigne
 	/* monitor and partition the A matrix into blocks :
 	/* monitor and partition the A matrix into blocks :
 	 * one block is now determined by 2 unsigned (i,j) */
 	 * one block is now determined by 2 unsigned (i,j) */
 	starpu_matrix_data_register(&dataA, 0, (uintptr_t)matA, ld, size, size, sizeof(TYPE));
 	starpu_matrix_data_register(&dataA, 0, (uintptr_t)matA, ld, size, size, sizeof(TYPE));
-
+	
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 4 - 0
examples/lu/xlu_implicit_pivot.c

@@ -192,10 +192,14 @@ void STARPU_LU(lu_decomposition_pivot)(TYPE *matA, unsigned *ipiv, unsigned size
 	starpu_filter f;
 	starpu_filter f;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_func = starpu_vertical_block_filter_func;
 		f.filter_arg = nblocks;
 		f.filter_arg = nblocks;
+		f.get_nchildren = NULL;
+		f.get_child_ops = NULL;
 
 
 	starpu_filter f2;
 	starpu_filter f2;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_func = starpu_block_filter_func;
 		f2.filter_arg = nblocks;
 		f2.filter_arg = nblocks;
+		f2.get_nchildren = NULL;
+		f2.get_child_ops = NULL;
 
 
 	starpu_map_filters(dataA, 2, &f, &f2);
 	starpu_map_filters(dataA, 2, &f, &f2);
 
 

+ 4 - 0
examples/mult/dw_mult.c

@@ -169,10 +169,14 @@ static void partition_mult_data(void)
 	starpu_filter f;
 	starpu_filter f;
 	f.filter_func = starpu_vertical_block_filter_func;
 	f.filter_func = starpu_vertical_block_filter_func;
 	f.filter_arg = nslicesx;
 	f.filter_arg = nslicesx;
+	f.get_nchildren = NULL;
+	f.get_child_ops = NULL;
 		
 		
 	starpu_filter f2;
 	starpu_filter f2;
 	f2.filter_func = starpu_block_filter_func;
 	f2.filter_func = starpu_block_filter_func;
 	f2.filter_arg = nslicesy;
 	f2.filter_arg = nslicesy;
+	f2.get_nchildren = NULL;
+	f2.get_child_ops = NULL;
 		
 		
 	starpu_data_partition(B_handle, &f);
 	starpu_data_partition(B_handle, &f);
 	starpu_data_partition(A_handle, &f2);
 	starpu_data_partition(A_handle, &f2);

+ 4 - 0
examples/mult/xgemm.c

@@ -153,10 +153,14 @@ static void partition_mult_data(void)
 	starpu_filter f;
 	starpu_filter f;
 	f.filter_func = starpu_vertical_block_filter_func;
 	f.filter_func = starpu_vertical_block_filter_func;
 	f.filter_arg = nslicesx;
 	f.filter_arg = nslicesx;
+	f.get_nchildren = NULL;
+	f.get_child_ops = NULL;
 		
 		
 	starpu_filter f2;
 	starpu_filter f2;
 	f2.filter_func = starpu_block_filter_func;
 	f2.filter_func = starpu_block_filter_func;
 	f2.filter_arg = nslicesy;
 	f2.filter_arg = nslicesy;
+	f2.get_nchildren = NULL;
+	f2.get_child_ops = NULL;
 		
 		
 	starpu_data_partition(B_handle, &f);
 	starpu_data_partition(B_handle, &f);
 	starpu_data_partition(A_handle, &f2);
 	starpu_data_partition(A_handle, &f2);

+ 3 - 1
examples/pi/pi.c

@@ -98,7 +98,9 @@ int main(int argc, char **argv)
 
 
 	struct starpu_filter_t f = {
 	struct starpu_filter_t f = {
 		.filter_func = starpu_block_filter_func_vector,
 		.filter_func = starpu_block_filter_func_vector,
-		.filter_arg = ntasks
+		.filter_arg = ntasks,
+		.get_nchildren = NULL,
+		.get_child_ops = NULL
 	};
 	};
 	
 	
 	starpu_data_partition(cnt_array_handle, &f);
 	starpu_data_partition(cnt_array_handle, &f);

+ 9 - 3
examples/ppm_downscaler/yuv_downscaler.c

@@ -108,17 +108,23 @@ static struct starpu_codelet_t ds_codelet = {
 /* each block contains BLOCK_HEIGHT consecutive lines */
 /* each block contains BLOCK_HEIGHT consecutive lines */
 static starpu_filter filter_y = {
 static starpu_filter filter_y = {
 	.filter_func = starpu_block_filter_func,
 	.filter_func = starpu_block_filter_func,
-	.filter_arg = HEIGHT/BLOCK_HEIGHT
+	.filter_arg = HEIGHT/BLOCK_HEIGHT,
+	.get_nchildren = NULL,
+	.get_child_ops = NULL
 };
 };
 	
 	
 static starpu_filter filter_u = {
 static starpu_filter filter_u = {
 	.filter_func = starpu_block_filter_func,
 	.filter_func = starpu_block_filter_func,
-	.filter_arg = (HEIGHT/2)/BLOCK_HEIGHT
+	.filter_arg = (HEIGHT/2)/BLOCK_HEIGHT,
+	.get_nchildren = NULL,
+	.get_child_ops = NULL
 };
 };
 
 
 static starpu_filter filter_v = {
 static starpu_filter filter_v = {
 	.filter_func = starpu_block_filter_func,
 	.filter_func = starpu_block_filter_func,
-	.filter_arg = (HEIGHT/2)/BLOCK_HEIGHT
+	.filter_arg = (HEIGHT/2)/BLOCK_HEIGHT,
+	.get_nchildren = NULL,
+	.get_child_ops = NULL
 };
 };
 
 
 int main(int argc, char **argv)
 int main(int argc, char **argv)

+ 16 - 0
examples/spmv/dw_block_spmv.c

@@ -90,6 +90,15 @@ void init_problem_callback(void *arg)
 	}
 	}
 }
 }
 
 
+unsigned get_bcsr_nchildren(starpu_filter *f, starpu_data_handle handle)
+{
+  return handle->ops->nnz;
+}
+
+struct starpu_data_interface_ops_t *get_bcsr_child_ops(__attribute__((unused)) starpu_filter *f, __attribute__((unused)) unsigned child) 
+{
+  return &_starpu_interface_matrix_ops;
+}
 
 
 void call_filters(void)
 void call_filters(void)
 {
 {
@@ -98,12 +107,19 @@ void call_filters(void)
 	starpu_filter vector_in_f, vector_out_f;
 	starpu_filter vector_in_f, vector_out_f;
 
 
 	bcsr_f.filter_func    = starpu_canonical_block_filter_bcsr;
 	bcsr_f.filter_func    = starpu_canonical_block_filter_bcsr;
+	bcsr_f.get_nchildren = get_bcsr_nchildren;
+	/* the children use a matrix interface ! */
+	bcsr_f.get_child_ops = get_bcsr_child_ops;
 
 
 	vector_in_f.filter_func = starpu_block_filter_func_vector;
 	vector_in_f.filter_func = starpu_block_filter_func_vector;
 	vector_in_f.filter_arg  = size/c;
 	vector_in_f.filter_arg  = size/c;
+	vector_in_f.get_nchildren  = NULL;
+	vector_in_f.get_child_ops  = NULL;
 	
 	
 	vector_out_f.filter_func = starpu_block_filter_func_vector;
 	vector_out_f.filter_func = starpu_block_filter_func_vector;
 	vector_out_f.filter_arg  = size/r;
 	vector_out_f.filter_arg  = size/r;
+	vector_out_f.get_nchildren  = NULL;
+	vector_out_f.get_child_ops  = NULL;
 
 
 	starpu_data_partition(sparse_matrix, &bcsr_f);
 	starpu_data_partition(sparse_matrix, &bcsr_f);
 
 

+ 14 - 0
examples/spmv/dw_spmv.c

@@ -230,6 +230,14 @@ static void create_data(void)
 
 
 }
 }
 
 
+unsigned get_csr_nchildren(starpu_filter *f, starpu_data_handle initial_handle)
+{
+  uint32_t arg = f->filter_arg;
+  uint32_t nrow = starpu_csr_get_nrow(initial_handle);
+
+  return STARPU_MIN(nrow, arg);
+}
+
 void call_spmv_codelet_filters(void)
 void call_spmv_codelet_filters(void)
 {
 {
 
 
@@ -237,8 +245,14 @@ void call_spmv_codelet_filters(void)
 	starpu_filter csr_f, vector_f;
 	starpu_filter csr_f, vector_f;
 	csr_f.filter_func    = starpu_vertical_block_filter_func_csr;
 	csr_f.filter_func    = starpu_vertical_block_filter_func_csr;
 	csr_f.filter_arg     = nblocks;
 	csr_f.filter_arg     = nblocks;
+	csr_f.get_nchildren = get_csr_nchildren;
+	/* the children also use a csr interface */
+	csr_f.get_child_ops = NULL;
+
 	vector_f.filter_func = starpu_block_filter_func_vector;
 	vector_f.filter_func = starpu_block_filter_func_vector;
 	vector_f.filter_arg  = nblocks;
 	vector_f.filter_arg  = nblocks;
+	vector_f.get_nchildren = NULL;
+	vector_f.get_child_ops = NULL;
 
 
 	starpu_data_partition(sparse_matrix, &csr_f);
 	starpu_data_partition(sparse_matrix, &csr_f);
 	starpu_data_partition(vector_out, &vector_f);
 	starpu_data_partition(vector_out, &vector_f);

+ 16 - 14
include/starpu_data_filters.h

@@ -24,18 +24,20 @@
 extern "C" {
 extern "C" {
 #endif
 #endif
 
 
+struct starpu_data_interface_ops_t;
+
 typedef struct starpu_filter_t {
 typedef struct starpu_filter_t {
-	void (*filter_func)(struct starpu_filter_t *, starpu_data_handle); /* the actual partitionning function */
-	uint32_t filter_arg;
-	void *filter_arg_ptr;
+  void (*filter_func)(void *father_interface, void *child_interface, struct starpu_filter_t *, unsigned id, unsigned nparts);
+        unsigned (*get_nchildren)(struct starpu_filter_t *, starpu_data_handle initial_handle);
+        struct starpu_data_interface_ops_t *(*get_child_ops)(struct starpu_filter_t *, unsigned id);
+        unsigned filter_arg;
+        void *filter_arg_ptr;
 } starpu_filter;
 } starpu_filter;
 
 
-void starpu_data_partition(starpu_data_handle initial_data, starpu_filter *f); 
+void starpu_data_partition(starpu_data_handle initial_handle, starpu_filter *f);
 void starpu_data_unpartition(starpu_data_handle root_data, uint32_t gathering_node);
 void starpu_data_unpartition(starpu_data_handle root_data, uint32_t gathering_node);
 
 
-struct starpu_data_interface_ops_t;
-void starpu_data_create_children(starpu_data_handle handle, unsigned nchildren,
-		 struct starpu_data_interface_ops_t *children_interface_ops);
+void starpu_data_create_children(starpu_data_handle handle, unsigned nchildren, starpu_filter *f);
 
 
 starpu_data_handle starpu_data_get_child(starpu_data_handle handle, unsigned i);
 starpu_data_handle starpu_data_get_child(starpu_data_handle handle, unsigned i);
 
 
@@ -48,16 +50,16 @@ void starpu_map_filters(starpu_data_handle root_data, unsigned nfilters, ...);
 /* a few examples of filters */
 /* a few examples of filters */
 
 
 /* for BCSR */
 /* for BCSR */
-void starpu_canonical_block_filter_bcsr(starpu_filter *f, starpu_data_handle root_data);
-void starpu_vertical_block_filter_func_csr(starpu_filter *f, starpu_data_handle root_data);
+void starpu_canonical_block_filter_bcsr(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, unsigned nparts);
+void starpu_vertical_block_filter_func_csr(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, unsigned nparts);
 /* (filters for BLAS interface) */
 /* (filters for BLAS interface) */
-void starpu_block_filter_func(starpu_filter *f, starpu_data_handle root_data);
-void starpu_vertical_block_filter_func(starpu_filter *f, starpu_data_handle root_data);
+void starpu_block_filter_func(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, unsigned nparts);
+void starpu_vertical_block_filter_func(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, unsigned nparts);
 
 
 /* for vector */
 /* for vector */
-void starpu_block_filter_func_vector(starpu_filter *f, starpu_data_handle root_data);
-void starpu_vector_list_filter_func(starpu_filter *f, starpu_data_handle root_data);
-void starpu_vector_divide_in_2_filter_func(starpu_filter *f, starpu_data_handle root_data);
+void starpu_block_filter_func_vector(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, unsigned nparts);
+void starpu_vector_list_filter_func(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, unsigned nparts);
+void starpu_vector_divide_in_2_filter_func(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, unsigned nparts);
 
 
 #ifdef __cplusplus
 #ifdef __cplusplus
 }
 }

+ 29 - 20
src/datawizard/filters.c

@@ -37,7 +37,6 @@ static void map_filter(starpu_data_handle root_handle, starpu_filter *f)
 		}
 		}
 	}
 	}
 }
 }
-
 void starpu_map_filters(starpu_data_handle root_handle, unsigned nfilters, ...)
 void starpu_map_filters(starpu_data_handle root_handle, unsigned nfilters, ...)
 {
 {
 	unsigned i;
 	unsigned i;
@@ -88,14 +87,10 @@ starpu_data_handle starpu_data_get_sub_data(starpu_data_handle root_handle, unsi
 	return current_handle;
 	return current_handle;
 }
 }
 
 
-/*
- * For now, we assume that partitionned_data is already properly allocated;
- * at least by the starpu_filter function !
- */
 void starpu_data_partition(starpu_data_handle initial_handle, starpu_filter *f)
 void starpu_data_partition(starpu_data_handle initial_handle, starpu_filter *f)
 {
 {
-	int nparts;
-	int i;
+	unsigned nparts;
+	unsigned i;
 
 
 	/* first take care to properly lock the data header */
 	/* first take care to properly lock the data header */
 	_starpu_spin_lock(&initial_handle->header_lock);
 	_starpu_spin_lock(&initial_handle->header_lock);
@@ -103,12 +98,17 @@ void starpu_data_partition(starpu_data_handle initial_handle, starpu_filter *f)
 	/* there should not be mutiple filters applied on the same data */
 	/* there should not be mutiple filters applied on the same data */
 	STARPU_ASSERT(initial_handle->nchildren == 0);
 	STARPU_ASSERT(initial_handle->nchildren == 0);
 
 
-	/* this should update the pointers and size of the chunk */
-	f->filter_func(f, initial_handle);
+	/* how many parts ? */
+	if (f->get_nchildren)
+	  nparts = f->get_nchildren(f, initial_handle);
+	else
+	  nparts = f->filter_arg;
 
 
-	nparts = initial_handle->nchildren;
 	STARPU_ASSERT(nparts > 0);
 	STARPU_ASSERT(nparts > 0);
 
 
+	/* allocate the children */
+	starpu_data_create_children(initial_handle, nparts, f);
+
 	for (i = 0; i < nparts; i++)
 	for (i = 0; i < nparts; i++)
 	{
 	{
 		starpu_data_handle child =
 		starpu_data_handle child =
@@ -147,9 +147,11 @@ void starpu_data_partition(starpu_data_handle initial_handle, starpu_filter *f)
 				initial_handle->per_node[node].allocated;
 				initial_handle->per_node[node].allocated;
 			child->per_node[node].automatically_allocated = initial_handle->per_node[node].automatically_allocated;
 			child->per_node[node].automatically_allocated = initial_handle->per_node[node].automatically_allocated;
 			child->per_node[node].refcnt = 0;
 			child->per_node[node].refcnt = 0;
+			
+			/* update the interface */
+			f->filter_func(initial_handle->interface[node], child->interface[node], f, i, nparts);
 		}
 		}
 	}
 	}
-
 	/* now let the header */
 	/* now let the header */
 	_starpu_spin_unlock(&initial_handle->header_lock);
 	_starpu_spin_unlock(&initial_handle->header_lock);
 }
 }
@@ -239,10 +241,8 @@ void starpu_data_unpartition(starpu_data_handle root_handle, uint32_t gathering_
 	_starpu_spin_unlock(&root_handle->header_lock);
 	_starpu_spin_unlock(&root_handle->header_lock);
 }
 }
 
 
-/* TODO create an alternative version of that function which takes an array of
- * data interface ops in case each child may have its own interface type */
-void starpu_data_create_children(starpu_data_handle handle,
-		unsigned nchildren, struct starpu_data_interface_ops_t *children_interface_ops)
+/* each child may have his own interface type */
+void starpu_data_create_children(starpu_data_handle handle, unsigned nchildren, starpu_filter *f)
 {
 {
 	handle->children = calloc(nchildren, sizeof(struct starpu_data_state_t));
 	handle->children = calloc(nchildren, sizeof(struct starpu_data_state_t));
 	STARPU_ASSERT(handle->children);
 	STARPU_ASSERT(handle->children);
@@ -253,10 +253,18 @@ void starpu_data_create_children(starpu_data_handle handle,
 	for (child = 0; child < nchildren; child++)
 	for (child = 0; child < nchildren; child++)
 	{
 	{
 		starpu_data_handle handle_child = &handle->children[child];
 		starpu_data_handle handle_child = &handle->children[child];
-
-		handle_child->ops = children_interface_ops;
-
-		size_t interfacesize = children_interface_ops->interface_size;
+		
+		struct starpu_data_interface_ops_t *ops;
+		
+		/* what's this child's interface ? */
+		if (f->get_child_ops)
+		  ops = f->get_child_ops(f, child);
+		else
+		  ops = handle->ops;
+		
+		handle_child->ops = ops;
+
+		size_t interfacesize = ops->interface_size;
 
 
 		for (node = 0; node < STARPU_MAXNODES; node++)
 		for (node = 0; node < STARPU_MAXNODES; node++)
 		{
 		{
@@ -264,6 +272,7 @@ void starpu_data_create_children(starpu_data_handle handle,
 			STARPU_ASSERT(handle->children->interface[node]);
 			STARPU_ASSERT(handle->children->interface[node]);
 		}
 		}
 	}
 	}
-
+	
+	/* this handle now has children */
 	handle->nchildren = nchildren;
 	handle->nchildren = nchildren;
 }
 }

+ 21 - 38
src/datawizard/interfaces/bcsr_filters.c

@@ -18,56 +18,39 @@
 #include <common/config.h>
 #include <common/config.h>
 #include <datawizard/filters.h>
 #include <datawizard/filters.h>
 
 
-void starpu_canonical_block_filter_bcsr(starpu_filter *f __attribute__((unused)), starpu_data_handle root_handle)
+void starpu_canonical_block_filter_bcsr(void *father_interface, void *child_interface, __attribute__((unused)) starpu_filter *f, unsigned id, __attribute__((unused)) unsigned nparts)
 {
 {
-	unsigned nchunks;
-
-	struct starpu_bcsr_interface_s *interface =
-		starpu_data_get_interface_on_node(root_handle, 0);
-
-	uint32_t nnz = interface->nnz;
+        unsigned nchunks;
+	struct starpu_bcsr_interface_s *bcsr_father = father_interface;
+	/* each chunk becomes a small dense matrix */
+	starpu_matrix_interface_t *matrix_child = child_interface;
+	
+	uint32_t nnz = bcsr_father->nnz;
 
 
-	size_t elemsize = interface->elemsize;
-	uint32_t firstentry = interface->firstentry;
+	size_t elemsize = bcsr_father->elemsize;
+	uint32_t firstentry = bcsr_father->firstentry;
 
 
 	/* size of the tiles */
 	/* size of the tiles */
-	uint32_t r = interface->r;
-	uint32_t c = interface->c;
+	uint32_t r = bcsr_father->r;
+	uint32_t c = bcsr_father->c;
 
 
 	/* we create as many subdata as there are blocks ... */
 	/* we create as many subdata as there are blocks ... */
 	nchunks = nnz;
 	nchunks = nnz;
 	
 	
 	/* first allocate the children : it's a set of BLAS !*/
 	/* first allocate the children : it's a set of BLAS !*/
-	starpu_data_create_children(root_handle, nchunks, &_starpu_interface_matrix_ops);
+	//starpu_data_create_children(root_handle, nchunks, &_starpu_interface_matrix_ops);
 
 
-	/* actually create all the chunks */
-
-	STARPU_ASSERT(starpu_data_test_if_allocated_on_node(root_handle, 0));
-
-	/* each chunk becomes a small dense matrix */
-	unsigned chunk;
-	for (chunk = 0; chunk < nchunks; chunk++)
-	{
-		starpu_data_handle sub_handle = starpu_data_get_child(root_handle, chunk);
-		uint32_t ptr_offset = c*r*chunk*elemsize;
+	//STARPU_ASSERT(starpu_data_test_if_allocated_on_node(root_handle, 0));
 
 
-		unsigned node;
-		for (node = 0; node < STARPU_MAXNODES; node++)
-		{
-			starpu_matrix_interface_t *local =
-				starpu_data_get_interface_on_node(sub_handle, node);
+	uint32_t ptr_offset = c*r*id*elemsize;
 
 
-			local->nx = c;
-			local->ny = r;
-			local->ld = c;
-			local->elemsize = elemsize;
+	matrix_child->nx = c;
+	matrix_child->ny = r;
+	matrix_child->ld = c;
+	matrix_child->elemsize = elemsize;
 
 
-			if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-				struct starpu_bcsr_interface_s *node_interface =
-					starpu_data_get_interface_on_node(root_handle, node);
-				uint8_t *nzval = (uint8_t *)(node_interface->nzval);
-				local->ptr = (uintptr_t)&nzval[firstentry + ptr_offset];
-			}
-		}
+	if (bcsr_father->nzval != 0) {
+	  uint8_t *nzval = (uint8_t *)(bcsr_father->nzval);
+	  matrix_child->ptr = (uintptr_t)&nzval[firstentry + ptr_offset];
 	}
 	}
 }
 }

+ 24 - 52
src/datawizard/interfaces/csr_filters.c

@@ -18,63 +18,35 @@
 #include <common/config.h>
 #include <common/config.h>
 #include <datawizard/filters.h>
 #include <datawizard/filters.h>
 
 
-void starpu_vertical_block_filter_func_csr(starpu_filter *f, starpu_data_handle root_handle)
+void starpu_vertical_block_filter_func_csr(void *father_interface, void *child_interface, __attribute__((unused)) starpu_filter *f, unsigned id, unsigned nchunks)
 {
 {
-	unsigned nchunks;
-	uint32_t arg = f->filter_arg;
+	starpu_csr_interface_t *csr_father = father_interface;
+	starpu_csr_interface_t *csr_child = child_interface;
 
 
-	starpu_csr_interface_t *root_interface =
-		starpu_data_get_interface_on_node(root_handle, 0);
+	uint32_t nrow = csr_father->nrow;
+	size_t elemsize = csr_father->elemsize;
+	uint32_t firstentry = csr_father->firstentry;
 
 
-	uint32_t nrow = root_interface->nrow;
-	size_t elemsize = root_interface->elemsize;
-	uint32_t firstentry = root_interface->firstentry;
-
-	/* we will have arg chunks */
-	nchunks = STARPU_MIN(nrow, arg);
-	
-	/* first allocate the children (they also use the csr interface) */
-	starpu_data_create_children(root_handle, nchunks, root_handle->ops);
-
-	/* actually create all the chunks */
 	uint32_t chunk_size = (nrow + nchunks - 1)/nchunks;
 	uint32_t chunk_size = (nrow + nchunks - 1)/nchunks;
 
 
-	STARPU_ASSERT(starpu_data_test_if_allocated_on_node(root_handle, 0));
-	uint32_t *rowptr = root_interface->rowptr;
-
-	unsigned chunk;
-	for (chunk = 0; chunk < nchunks; chunk++)
-	{
-		uint32_t first_index = chunk*chunk_size - firstentry;
-		uint32_t local_firstentry = rowptr[first_index];
-
-		uint32_t child_nrow = 
-			STARPU_MIN(chunk_size, nrow - chunk*chunk_size);
-
-		uint32_t local_nnz = rowptr[first_index + child_nrow] - rowptr[first_index]; 
-
-		starpu_data_handle chunk_handle =
-			starpu_data_get_child(root_handle, chunk);
+	uint32_t *rowptr = csr_father->rowptr;
 
 
-		unsigned node;
-		for (node = 0; node < STARPU_MAXNODES; node++)
-		{
-			starpu_csr_interface_t *local = 
-				starpu_data_get_interface_on_node(chunk_handle, node);
-
-			starpu_csr_interface_t *root_local = 
-				starpu_data_get_interface_on_node(root_handle, node);
-
-			local->nnz = local_nnz;
-			local->nrow = child_nrow;
-			local->firstentry = local_firstentry;
-			local->elemsize = elemsize;
-
-			if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-				local->rowptr = &root_local->rowptr[first_index];
-				local->colind = &root_local->colind[local_firstentry];
-				local->nzval = root_local->nzval + local_firstentry * elemsize;
-			}
-		}
+	uint32_t first_index = id*chunk_size - firstentry;
+	uint32_t local_firstentry = rowptr[first_index];
+	
+	uint32_t child_nrow = 
+	  STARPU_MIN(chunk_size, nrow - id*chunk_size);
+	
+	uint32_t local_nnz = rowptr[first_index + child_nrow] - rowptr[first_index]; 
+	
+	csr_child->nnz = local_nnz;
+	csr_child->nrow = child_nrow;
+	csr_child->firstentry = local_firstentry;
+	csr_child->elemsize = elemsize;
+	
+	if (csr_father->nzval != 0) {
+	  csr_child->rowptr = &csr_father->rowptr[first_index];
+	  csr_child->colind = &csr_father->colind[local_firstentry];
+	  csr_child->nzval = csr_father->nzval + local_firstentry * elemsize;
 	}
 	}
 }
 }

+ 1 - 2
src/datawizard/interfaces/csr_interface.c

@@ -87,14 +87,13 @@ static void register_csr_handle(starpu_data_handle handle, uint32_t home_node, v
 		if (node == home_node) {
 		if (node == home_node) {
 			local_interface->nzval = csr_interface->nzval;
 			local_interface->nzval = csr_interface->nzval;
 			local_interface->colind = csr_interface->colind;
 			local_interface->colind = csr_interface->colind;
-			local_interface->rowptr = csr_interface->rowptr;
 		}
 		}
 		else {
 		else {
 			local_interface->nzval = 0;
 			local_interface->nzval = 0;
 			local_interface->colind = NULL;
 			local_interface->colind = NULL;
-			local_interface->rowptr = NULL;
 		}
 		}
 
 
+		local_interface->rowptr = csr_interface->rowptr;
 		local_interface->nnz = csr_interface->nnz;
 		local_interface->nnz = csr_interface->nnz;
 		local_interface->nrow = csr_interface->nrow;
 		local_interface->nrow = csr_interface->nrow;
 		local_interface->firstentry = csr_interface->firstentry;
 		local_interface->firstentry = csr_interface->firstentry;

+ 49 - 102
src/datawizard/interfaces/matrix_filters.c

@@ -21,112 +21,59 @@
 /*
 /*
  * an example of a dummy partition function : blocks ...
  * an example of a dummy partition function : blocks ...
  */
  */
-void starpu_block_filter_func(starpu_filter *f, starpu_data_handle root_handle)
+void starpu_block_filter_func(void *father_interface, void *child_interface, __attribute__((unused)) starpu_filter *f, unsigned id, unsigned nchunks)
 {
 {
-	unsigned nchunks;
-	uint32_t arg = f->filter_arg;
-
-	starpu_matrix_interface_t *matrix_root =
-		starpu_data_get_interface_on_node(root_handle, 0);
-
-	uint32_t nx = matrix_root->nx;
-	uint32_t ny = matrix_root->ny;
-	size_t elemsize = matrix_root->elemsize;
-
-	/* we will have arg chunks */
-	nchunks = STARPU_MIN(nx, arg);
-
-	/* first allocate the children, they have the same interface type as
-	 * the root (matrix) */
-	starpu_data_create_children(root_handle, nchunks, root_handle->ops);
-
-	/* actually create all the chunks */
-	unsigned chunk;
-	for (chunk = 0; chunk < nchunks; chunk++)
-	{
-		size_t chunk_size = ((size_t)nx + nchunks - 1)/nchunks;
-		size_t offset = (size_t)chunk*chunk_size*elemsize;
-
-		uint32_t child_nx = 
-			STARPU_MIN(chunk_size, (size_t)nx - (size_t)chunk*chunk_size);
-
-		starpu_data_handle chunk_handle =
-			starpu_data_get_child(root_handle, chunk);
-
-		unsigned node;
-		for (node = 0; node < STARPU_MAXNODES; node++)
-		{
-			starpu_matrix_interface_t *local = 
-				starpu_data_get_interface_on_node(chunk_handle, node);
-
-			local->nx = child_nx;
-			local->ny = ny;
-			local->elemsize = elemsize;
-
-			if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-				starpu_matrix_interface_t *local_root =
-					starpu_data_get_interface_on_node(root_handle, node);
-
-				local->ptr = local_root->ptr + offset;
-				local->ld = local_root->ld;
-                                local->dev_handle = local_root->dev_handle;
-                                local->offset = local_root->offset + offset;
-			}
-		}
+       starpu_matrix_interface_t *matrix_father = father_interface;
+       starpu_matrix_interface_t *matrix_child = child_interface;
+  
+	uint32_t nx = matrix_father->nx;
+	uint32_t ny = matrix_father->ny;
+	size_t elemsize = matrix_father->elemsize;
+
+	size_t chunk_size = ((size_t)nx + nchunks - 1)/nchunks;
+	size_t offset = (size_t)id*chunk_size*elemsize;
+	
+	uint32_t child_nx = 
+	  STARPU_MIN(chunk_size, (size_t)nx - (size_t)id*chunk_size);
+	
+	/* update the child's interface */
+	matrix_child->nx = child_nx;
+	matrix_child->ny = ny;
+	matrix_child->elemsize = elemsize;
+	
+	/* is the information on this node valid ? */
+	if (matrix_father->ptr != 0) {
+	  matrix_child->ptr = matrix_father->ptr + offset;
+	  matrix_child->ld = matrix_father->ld;
+	  matrix_child->dev_handle = matrix_father->dev_handle;
+	  matrix_child->offset = matrix_father->offset + offset;
 	}
 	}
 }
 }
 
 
-void starpu_vertical_block_filter_func(starpu_filter *f, starpu_data_handle root_handle)
+void starpu_vertical_block_filter_func(void *father_interface, void *child_interface, __attribute__((unused)) starpu_filter *f, unsigned id, unsigned nchunks)
 {
 {
-	unsigned nchunks;
-	uint32_t arg = f->filter_arg;
-
-	starpu_matrix_interface_t *interface =
-		starpu_data_get_interface_on_node(root_handle, 0);
-
-	uint32_t nx = interface->nx;
-	uint32_t ny = interface->ny;
-	size_t elemsize = interface->elemsize;
-
-	/* we will have arg chunks */
-	nchunks = STARPU_MIN(ny, arg);
-	
-	/* first allocate the children: they also use a BLAS interface */
-	starpu_data_create_children(root_handle, nchunks, root_handle->ops);
-
-	/* actually create all the chunks */
-	unsigned chunk;
-	for (chunk = 0; chunk < nchunks; chunk++)
-	{
-		size_t chunk_size = ((size_t)ny + nchunks - 1)/nchunks;
-
-		size_t child_ny = 
-			STARPU_MIN(chunk_size, (size_t)ny - (size_t)chunk*chunk_size);
-
-		starpu_data_handle chunk_handle =
-			starpu_data_get_child(root_handle, chunk);
-
-		unsigned node;
-		for (node = 0; node < STARPU_MAXNODES; node++)
-		{
-			starpu_matrix_interface_t *local =
-				starpu_data_get_interface_on_node(chunk_handle, node);
-
-			local->nx = nx;
-			local->ny = child_ny;
-			local->elemsize = elemsize;
-
-			if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-				starpu_matrix_interface_t *local_root =
-					starpu_data_get_interface_on_node(root_handle, node);
-
-				size_t offset = 
-					(size_t)chunk*chunk_size*local_root->ld*elemsize;
-				local->ptr = local_root->ptr + offset;
-				local->ld = local_root->ld;
-                                local->dev_handle = local_root->dev_handle;
-                                local->offset = local_root->offset + offset;
-			}
-		}
+        starpu_matrix_interface_t *matrix_father = father_interface;
+        starpu_matrix_interface_t *matrix_child = child_interface;
+
+	uint32_t nx = matrix_father->nx;
+	uint32_t ny = matrix_father->ny;
+	size_t elemsize = matrix_father->elemsize;
+
+	size_t chunk_size = ((size_t)ny + nchunks - 1)/nchunks;
+	size_t child_ny = 
+	  STARPU_MIN(chunk_size, (size_t)ny - (size_t)id*chunk_size);
+
+	matrix_child->nx = nx;
+	matrix_child->ny = child_ny;
+	matrix_child->elemsize = elemsize;
+
+	/* is the information on this node valid ? */
+	if (matrix_father->ptr != 0) {
+	  size_t offset = 
+	    (size_t)id*chunk_size*matrix_father->ld*elemsize;
+	  matrix_child->ptr = matrix_father->ptr + offset;
+	  matrix_child->ld = matrix_father->ld;
+	  matrix_child->dev_handle = matrix_father->dev_handle;
+	  matrix_child->offset = matrix_father->offset + offset;
 	}
 	}
 }
 }

+ 67 - 130
src/datawizard/interfaces/vector_filters.c

@@ -18,163 +18,100 @@
 #include <common/config.h>
 #include <common/config.h>
 #include <datawizard/filters.h>
 #include <datawizard/filters.h>
 
 
-void starpu_block_filter_func_vector(starpu_filter *f, starpu_data_handle root_handle)
+void starpu_block_filter_func_vector(void *father_interface, void *child_interface, __attribute__((unused)) starpu_filter *f, unsigned id, unsigned nchunks)
 {
 {
-	unsigned nchunks;
-	uint32_t arg = f->filter_arg;
+        starpu_vector_interface_t *vector_father = father_interface;
+        starpu_vector_interface_t *vector_child = child_interface;
 
 
-	starpu_vector_interface_t *vector_root =
-		starpu_data_get_interface_on_node(root_handle, 0);
+        uint32_t nx = vector_father->nx;
+	size_t elemsize = vector_father->elemsize;
 
 
-	uint32_t nx = vector_root->nx;
-	size_t elemsize = vector_root->elemsize;
+	/* actually create all the chunks */
+	uint32_t chunk_size = (nx + nchunks - 1)/nchunks;
+	size_t offset = id*chunk_size*elemsize;
 
 
-	/* we will have arg chunks */
-	nchunks = STARPU_MIN(nx, arg);
+	uint32_t child_nx = 
+	  STARPU_MIN(chunk_size, nx - id*chunk_size);
 
 
-	/* first allocate the children data_state */
-	starpu_data_create_children(root_handle, nchunks, root_handle->ops);
+	vector_child->nx = child_nx;
+	vector_child->elemsize = elemsize;
 
 
-	/* actually create all the chunks */
-	unsigned chunk;
-	for (chunk = 0; chunk < nchunks; chunk++)
-	{
-		uint32_t chunk_size = (nx + nchunks - 1)/nchunks;
-		size_t offset = chunk*chunk_size*elemsize;
-
-		uint32_t child_nx = 
-			STARPU_MIN(chunk_size, nx - chunk*chunk_size);
-
-		starpu_data_handle chunk_handle =
-			starpu_data_get_child(root_handle, chunk);
-
-		unsigned node;
-		for (node = 0; node < STARPU_MAXNODES; node++)
-		{
-			starpu_vector_interface_t *local =
-				starpu_data_get_interface_on_node(chunk_handle, node);
-
-			local->nx = child_nx;
-			local->elemsize = elemsize;
-
-			if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-				starpu_vector_interface_t *local_root =
-					starpu_data_get_interface_on_node(root_handle, node);
-
-				local->ptr = local_root->ptr + offset;
-                                local->dev_handle = local_root->dev_handle;
-                                local->offset = local_root->offset + offset;
-			}
-		}
+	if (vector_father->ptr != 0) {
+	  vector_child->ptr = vector_father->ptr + offset;
+	  vector_child->dev_handle = vector_father->dev_handle;
+	  vector_child->offset = vector_father->offset + offset;
 	}
 	}
 }
 }
 
 
 
 
-void starpu_vector_divide_in_2_filter_func(starpu_filter *f, starpu_data_handle root_handle)
+void starpu_vector_divide_in_2_filter_func(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, __attribute__((unused)) unsigned nchunks)
 {
 {
-	uint32_t length_first = f->filter_arg;
+        /* there cannot be more than 2 chunks */
+        STARPU_ASSERT(id < 2);
+	
+	starpu_vector_interface_t *vector_father = father_interface;
+	starpu_vector_interface_t *vector_child = child_interface;
 
 
-	starpu_vector_interface_t *vector_root =
-		starpu_data_get_interface_on_node(root_handle, 0);
-
-	uint32_t nx = vector_root->nx;
-	size_t elemsize = vector_root->elemsize;
+	uint32_t length_first = f->filter_arg;
 
 
-	/* first allocate the children data_state */
-	starpu_data_create_children(root_handle, 2, root_handle->ops);
+	uint32_t nx = vector_father->nx;
+	size_t elemsize = vector_father->elemsize;
 
 
 	STARPU_ASSERT(length_first < nx);
 	STARPU_ASSERT(length_first < nx);
-
-	starpu_data_handle chunk0_handle =
-		starpu_data_get_child(root_handle, 0);
-
-	unsigned node;
-	for (node = 0; node < STARPU_MAXNODES; node++)
-	{
-		starpu_vector_interface_t *local =
-			starpu_data_get_interface_on_node(chunk0_handle, node);
-
-		local->nx = length_first;
-		local->elemsize = elemsize;
-
-		if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-			starpu_vector_interface_t *local_root =
-				starpu_data_get_interface_on_node(root_handle, node);
-
-			local->ptr = local_root->ptr;
-                        local->offset = local_root->offset;
-                        local->dev_handle = local_root->dev_handle;
-		}
+	
+	/* this is the first child */
+	if (id == 0) {
+	  vector_child->nx = length_first;
+	  vector_child->elemsize = elemsize;
+
+	  if (vector_father->ptr != 0) {
+	    vector_child->ptr = vector_father->ptr;
+	    vector_child->offset = vector_father->offset;
+	    vector_child->dev_handle = vector_father->dev_handle;
+	  }
 	}
 	}
 
 
-	starpu_data_handle chunk1_handle =
-		starpu_data_get_child(root_handle, 1);
-
-	for (node = 0; node < STARPU_MAXNODES; node++)
-	{
-		starpu_vector_interface_t *local =
-			starpu_data_get_interface_on_node(chunk1_handle, node);
-
-		local->nx = nx - length_first;
-		local->elemsize = elemsize;
-
-		if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-			starpu_vector_interface_t *local_root =
-				starpu_data_get_interface_on_node(root_handle, node);
+	/* the second child */
+	else {
+	  vector_child->nx = nx - length_first;
+	  vector_child->elemsize = elemsize;
 
 
-			local->ptr = local_root->ptr + length_first*elemsize;
-                        local->offset = local_root->offset + length_first*elemsize;
-                        local->dev_handle = local_root->dev_handle;
-		}
+	  if (vector_father->ptr != 0) {
+	    vector_child->ptr = vector_father->ptr + length_first*elemsize;
+	    vector_child->offset = vector_father->offset + length_first*elemsize;
+	    vector_child->dev_handle = vector_father->dev_handle;
+	  }
 	}
 	}
 }
 }
 
 
-void starpu_vector_list_filter_func(starpu_filter *f, starpu_data_handle root_handle)
-{
-	uint32_t nchunks = f->filter_arg;
-	uint32_t *length_tab = f->filter_arg_ptr;
 
 
-	starpu_vector_interface_t *vector_root =
-		starpu_data_get_interface_on_node(root_handle, 0);
+void starpu_vector_list_filter_func(void *father_interface, void *child_interface, starpu_filter *f, unsigned id, __attribute__((unused)) unsigned nchunks)
+{
+        starpu_vector_interface_t *vector_father = father_interface;
+        starpu_vector_interface_t *vector_child = child_interface;
 
 
-	size_t elemsize = vector_root->elemsize;
+        uint32_t *length_tab = f->filter_arg_ptr;
 
 
-	/* first allocate the children data_state */
-	starpu_data_create_children(root_handle, nchunks, root_handle->ops);
+	size_t elemsize = vector_father->elemsize;
 
 
 	unsigned current_pos = 0;
 	unsigned current_pos = 0;
 
 
-	/* actually create all the chunks */
-	unsigned chunk;
-	for (chunk = 0; chunk < nchunks; chunk++)
-	{
-		starpu_data_handle chunk_handle =
-			starpu_data_get_child(root_handle, chunk);
-
-		uint32_t chunk_size = length_tab[chunk];
-
-		unsigned node;
-		for (node = 0; node < STARPU_MAXNODES; node++)
-		{
-			starpu_vector_interface_t *local =
-				starpu_data_get_interface_on_node(chunk_handle, node);
-
-			local->nx = chunk_size;
-			local->elemsize = elemsize;
-
-			if (starpu_data_test_if_allocated_on_node(root_handle, node)) {
-				starpu_vector_interface_t *local_root =
-					starpu_data_get_interface_on_node(root_handle, node);
-
-				local->ptr = local_root->ptr + current_pos*elemsize;
-                                local->offset = local_root->offset + current_pos*elemsize;
-                                local->dev_handle = local_root->dev_handle;
-			}
-		}
-
-		current_pos += chunk_size;
+	uint32_t chunk_size = length_tab[id];
+
+	vector_child->nx = chunk_size;
+	vector_child->elemsize = elemsize;
+	
+	if (vector_father->ptr != 0) {
+	  /* compute the current position */
+	  unsigned i;
+	  for (i = 0; i <= id; i++) 
+	    current_pos += length_tab[i];
+	  
+	  vector_child->ptr = vector_father->ptr + current_pos*elemsize;
+	  vector_child->offset = vector_father->offset + current_pos*elemsize;
+	  vector_child->dev_handle = vector_father->dev_handle;
 	}
 	}
-
-	__attribute__ ((unused)) uint32_t nx = vector_root->nx;
+	
+	__attribute__ ((unused)) uint32_t nx = vector_father->nx;
 	STARPU_ASSERT(current_pos == nx);
 	STARPU_ASSERT(current_pos == nx);
 }
 }

+ 9 - 1
tests/datawizard/unpartition.c

@@ -59,6 +59,12 @@ int use_handle(starpu_data_handle handle)
 	return ret;
 	return ret;
 }
 }
 
 
+/* there are 2 children */
+unsigned get_vector_nchildren(__attribute__((unused)) starpu_filter *f, __attribute__((unused)) starpu_data_handle initial_handle)
+{
+  return 2;
+}
+
 int main(int argc, char **argv)
 int main(int argc, char **argv)
 {
 {
 	int ret;
 	int ret;
@@ -71,7 +77,9 @@ int main(int argc, char **argv)
 
 
 	starpu_filter f = {
 	starpu_filter f = {
 		.filter_func = starpu_vector_divide_in_2_filter_func,
 		.filter_func = starpu_vector_divide_in_2_filter_func,
-		.filter_arg = VECTORSIZE/2
+		.filter_arg = VECTORSIZE/2,
+		.get_nchildren = get_vector_nchildren,
+		.get_child_ops = NULL
 	};
 	};
 
 
 	unsigned iter;
 	unsigned iter;

+ 3 - 1
tests/overlap/overlap.c

@@ -86,7 +86,9 @@ int main(int argc, char **argv)
 	starpu_filter f =
 	starpu_filter f =
 	{
 	{
 		.filter_func = starpu_block_filter_func_vector,
 		.filter_func = starpu_block_filter_func_vector,
-		.filter_arg = NTASKS
+		.filter_arg = NTASKS,
+		.get_nchildren = NULL,
+		.get_child_ops = NULL
 	};
 	};
 
 
 	starpu_data_partition(handle, &f);
 	starpu_data_partition(handle, &f);