瀏覽代碼

Add starpu_vector_filter_list_long

Samuel Thibault 8 年之前
父節點
當前提交
347ded8d7d

+ 1 - 0
ChangeLog

@@ -79,6 +79,7 @@ Small features:
   * MPI: Add mpi communications in dag.dot
   * MPI: Add mpi communications in dag.dot
   * Add STARPU_PERF_MODEL_HOMOGENEOUS_CPU environment variable to
   * Add STARPU_PERF_MODEL_HOMOGENEOUS_CPU environment variable to
     allow having one perfmodel per CPU core
     allow having one perfmodel per CPU core
+  * Add starpu_vector_filter_list_long filter.
 
 
 Small changes:
 Small changes:
   * Output generated through STARPU_MPI_COMM has been modified to
   * Output generated through STARPU_MPI_COMM has been modified to

+ 9 - 0
doc/doxygen/chapters/api/data_partition.doxy

@@ -220,6 +220,15 @@ of \p f must be the shadow size casted into \c void*.
 enforced for the shadowed parts. An usage example is available in
 enforced for the shadowed parts. An usage example is available in
 examples/filters/shadow.c
 examples/filters/shadow.c
 
 
+\fn void starpu_vector_filter_list_long(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts)
+\ingroup API_Data_Partition
+Return in \p child_interface the \p id th element of the vector
+represented by \p father_interface once partitioned into \p nparts chunks
+according to the <c>filter_arg_ptr</c> field of \p f. The
+<c>filter_arg_ptr</c> field must point to an array of \p nparts long
+elements, each of which specifies the number of elements in each chunk
+of the partition.
+
 \fn void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts)
 \fn void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts)
 \ingroup API_Data_Partition
 \ingroup API_Data_Partition
 Return in \p child_interface the \p id th element of the vector
 Return in \p child_interface the \p id th element of the vector

+ 11 - 0
include/fstarpu_mod.f90

@@ -1298,6 +1298,17 @@ module fstarpu_mod
                         type(c_ptr), value, intent(in) :: nparts
                         type(c_ptr), value, intent(in) :: nparts
                 end subroutine fstarpu_vector_filter_block_shadow
                 end subroutine fstarpu_vector_filter_block_shadow
 
 
+                ! void starpu_vector_filter_list_long(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
+                subroutine fstarpu_vector_filter_list_long (father_interface,child_interface,filter,id,nparts) &
+                                bind(C,name="starpu_vector_filter_list_long")
+                        use iso_c_binding, only: c_ptr
+                        type(c_ptr), value, intent(in) :: father_interface
+                        type(c_ptr), value, intent(in) :: child_interface
+                        type(c_ptr), value, intent(in) :: filter
+                        type(c_ptr), value, intent(in) :: id
+                        type(c_ptr), value, intent(in) :: nparts
+                end subroutine fstarpu_vector_filter_list_long
+
                 ! void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
                 ! void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
                 subroutine fstarpu_vector_filter_list (father_interface,child_interface,filter,id,nparts) &
                 subroutine fstarpu_vector_filter_list (father_interface,child_interface,filter,id,nparts) &
                                 bind(C,name="starpu_vector_filter_list")
                                 bind(C,name="starpu_vector_filter_list")

+ 2 - 1
include/starpu_data_filters.h

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
- * Copyright (C) 2010-2012, 2015  Université de Bordeaux
+ * Copyright (C) 2010-2012, 2015, 2017  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  *
@@ -69,6 +69,7 @@ void starpu_matrix_filter_vertical_block_shadow(void *father_interface, void *ch
 
 
 void starpu_vector_filter_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_vector_filter_block(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_vector_filter_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_vector_filter_block_shadow(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
+void starpu_vector_filter_list_long(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_vector_filter_divide_in_2(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 void starpu_vector_filter_divide_in_2(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, unsigned nparts);
 
 

+ 32 - 1
src/datawizard/interfaces/vector_filters.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  *
- * Copyright (C) 2009-2013, 2016  Université de Bordeaux
+ * Copyright (C) 2009-2013, 2016-2017  Université de Bordeaux
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010  Mehdi Juhoor <mjuhoor@gmail.com>
  * Copyright (C) 2010, 2011, 2016  CNRS
  * Copyright (C) 2010, 2011, 2016  CNRS
  *
  *
@@ -132,6 +132,37 @@ void starpu_vector_filter_divide_in_2(void *father_interface, void *child_interf
 }
 }
 
 
 
 
+void starpu_vector_filter_list_long(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, STARPU_ATTRIBUTE_UNUSED unsigned nchunks)
+{
+        struct starpu_vector_interface *vector_father = (struct starpu_vector_interface *) father_interface;
+        struct starpu_vector_interface *vector_child = (struct starpu_vector_interface *) child_interface;
+
+        long *length_tab = (long *) f->filter_arg_ptr;
+
+	size_t elemsize = vector_father->elemsize;
+
+	long chunk_size = length_tab[id];
+
+	STARPU_ASSERT_MSG(vector_father->id == STARPU_VECTOR_INTERFACE_ID, "%s can only be applied on a vector data", __func__);
+	vector_child->id = vector_father->id;
+	vector_child->nx = chunk_size;
+	vector_child->elemsize = elemsize;
+
+	if (vector_father->dev_handle)
+	{
+		/* compute the current position */
+		unsigned current_pos = 0;
+		unsigned i;
+		for (i = 0; i < id; i++)
+			current_pos += length_tab[i];
+
+		if (vector_father->ptr)
+			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;
+	}
+}
+
 void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, STARPU_ATTRIBUTE_UNUSED unsigned nchunks)
 void starpu_vector_filter_list(void *father_interface, void *child_interface, struct starpu_data_filter *f, unsigned id, STARPU_ATTRIBUTE_UNUSED unsigned nchunks)
 {
 {
         struct starpu_vector_interface *vector_father = (struct starpu_vector_interface *) father_interface;
         struct starpu_vector_interface *vector_father = (struct starpu_vector_interface *) father_interface;