Browse Source

Add starpu_bcsr_filter_canonical_block_child_ops.

Samuel Thibault 6 years ago
parent
commit
3a775f5988

+ 1 - 0
ChangeLog

@@ -25,6 +25,7 @@ StarPU 1.3.1 (git revision xxx)
 
 
 Small features:
 Small features:
   * Add starpu_filter_nparts_compute_chunk_size_and_offset helper.
   * Add starpu_filter_nparts_compute_chunk_size_and_offset helper.
+  * Add starpu_bcsr_filter_canonical_block_child_ops.
 
 
 StarPU 1.3.0 (git revision 24ca83c6dbb102e1cfc41db3bb21c49662067062)
 StarPU 1.3.0 (git revision 24ca83c6dbb102e1cfc41db3bb21c49662067062)
 ==============================================
 ==============================================

+ 4 - 1
doc/doxygen/chapters/310_data_management.doxy

@@ -355,13 +355,16 @@ __kernel void opencl_kernel(__global int *vector, unsigned offset)
 }
 }
 \endcode
 \endcode
 
 
+When the sub-data is not of the same type as the original data, the
+starpu_data_filter::get_child_ops field needs to be set appropriately for StarPU
+to know which type should be used.
+
 StarPU provides various interfaces and filters for matrices, vectors, etc.,
 StarPU provides various interfaces and filters for matrices, vectors, etc.,
 but applications can also write their own data interfaces and filters, see
 but applications can also write their own data interfaces and filters, see
 <c>examples/interface</c> and <c>examples/filters/custom_mf</c> for an example,
 <c>examples/interface</c> and <c>examples/filters/custom_mf</c> for an example,
 and see \ref DefiningANewDataInterface and \ref DefiningANewDataFilter
 and see \ref DefiningANewDataInterface and \ref DefiningANewDataFilter
 for documentation.
 for documentation.
 
 
-
 \section AsynchronousPartitioning Asynchronous Partitioning
 \section AsynchronousPartitioning Asynchronous Partitioning
 
 
 The partitioning functions described in the previous section are synchronous:
 The partitioning functions described in the previous section are synchronous:

+ 2 - 7
examples/spmv/dw_block_spmv.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
- * Copyright (C) 2008-2015,2017                           Université de Bordeaux
+ * Copyright (C) 2008-2015,2017,2019                      Université de Bordeaux
  * Copyright (C) 2012,2013                                Inria
  * Copyright (C) 2012,2013                                Inria
  * Copyright (C) 2010                                     Mehdi Juhoor
  * Copyright (C) 2010                                     Mehdi Juhoor
  * Copyright (C) 2010-2017                                CNRS
  * Copyright (C) 2010-2017                                CNRS
@@ -126,11 +126,6 @@ unsigned get_bcsr_nchildren(struct starpu_data_filter *f, starpu_data_handle_t h
   return (unsigned)starpu_bcsr_get_nnz(handle);
   return (unsigned)starpu_bcsr_get_nnz(handle);
 }
 }
 
 
-struct starpu_data_interface_ops *get_bcsr_child_ops(struct starpu_data_filter *f, unsigned child)
-{
-  return &starpu_interface_matrix_ops;
-}
-
 void call_filters(void)
 void call_filters(void)
 {
 {
 
 
@@ -140,7 +135,7 @@ void call_filters(void)
 	bcsr_f.filter_func    = starpu_bcsr_filter_canonical_block;
 	bcsr_f.filter_func    = starpu_bcsr_filter_canonical_block;
 	bcsr_f.get_nchildren = get_bcsr_nchildren;
 	bcsr_f.get_nchildren = get_bcsr_nchildren;
 	/* the children use a matrix interface ! */
 	/* the children use a matrix interface ! */
-	bcsr_f.get_child_ops = get_bcsr_child_ops;
+	bcsr_f.get_child_ops = starpu_bcsr_filter_canonical_block_child_ops;
 
 
 	vector_in_f.filter_func = starpu_vector_filter_block;
 	vector_in_f.filter_func = starpu_vector_filter_block;
 	vector_in_f.nchildren  = size/c;
 	vector_in_f.nchildren  = size/c;

+ 6 - 0
include/starpu_data_filters.h

@@ -315,8 +315,14 @@ void starpu_data_partition_not_automatic(starpu_data_handle_t handle);
 
 
 /**
 /**
    Partition a block-sparse matrix into dense matrices.
    Partition a block-sparse matrix into dense matrices.
+   starpu_data_filter::get_child_ops needs to be set to
+   starpu_bcsr_filter_canonical_block_child_ops()
 */
 */
 void starpu_bcsr_filter_canonical_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_bcsr_filter_canonical_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
+/**
+   Return the child_ops of the partition obtained with starpu_bcsr_filter_canonical_block().
+*/
+void starpu_bcsr_filter_canonical_block_child_ops(struct starpu_data_filter *f, unsigned child);
 
 
 /** @} */
 /** @} */
 
 

+ 5 - 0
src/datawizard/interfaces/bcsr_filters.c

@@ -50,3 +50,8 @@ void starpu_bcsr_filter_canonical_block(void *father_interface, void *child_inte
 		matrix_child->ptr = (uintptr_t)&nzval[firstentry + ptr_offset];
 		matrix_child->ptr = (uintptr_t)&nzval[firstentry + ptr_offset];
 	}
 	}
 }
 }
+
+void starpu_bcsr_filter_canonical_block_child_ops(STARPU_ATTRIBUTE_UNUSED struct starpu_data_filter *f, unsigned child)
+{
+	return &starpu_interface_matrix_ops;
+}