Kaynağa Gözat

data interface: add parameter count to unpack operation

Nathalie Furmento 12 yıl önce
ebeveyn
işleme
ae2ffeec76

+ 2 - 2
doc/chapters/advanced-api.texi

@@ -75,8 +75,8 @@ todo
 @item @code{int (*pack_data)(starpu_data_handle_t handle, uint32_t node, void **ptr, size_t *count)}
 Pack the data handle into a contiguous buffer at the address @code{ptr} and set the size of the newly created buffer in @code{count}
 
-@item @code{int (*unpack_data)(starpu_data_handle_t handle, uint32_t node, void *ptr)}
-Unpack the data handle from the contiguous buffer at the address @code{ptr}
+@item @code{int (*unpack_data)(starpu_data_handle_t handle, uint32_t node, void *ptr, size_t count)}
+Unpack the data handle from the contiguous buffer at the address @code{ptr} of size @var{count}
 
 @end table
 @end deftp

+ 5 - 4
doc/chapters/basic-api.texi

@@ -767,10 +767,11 @@ The function also sets @var{count} to the size of the data handle by calling
 @code{starpu_handle_get_size()}.
 @end deftypefun
 
-@deftypefun int starpu_handle_unpack_data (starpu_data_handle_t @var{handle}, {void *}@var{ptr})
-Copy in @var{handle} the data located at @var{ptr} as described by the
-interface of the data. The interface registered at @var{handle} must
-define a unpacking operation (@pxref{struct starpu_data_interface_ops}).
+@deftypefun int starpu_handle_unpack_data (starpu_data_handle_t @var{handle}, {void *}@var{ptr}, size_t @var{count})
+Unpack in @var{handle} the data located at @var{ptr} of size
+@var{count} as described by the interface of the data. The interface
+registered at @var{handle} must define a unpacking operation
+(@pxref{struct starpu_data_interface_ops}).
 @end deftypefun
 
 @node Accessing Variable Data Interfaces

+ 1 - 1
doc/chapters/mpi-support.texi

@@ -286,7 +286,7 @@ static int complex_pack_data(starpu_data_handle_t handle, uint32_t node, void **
 
 @cartouche
 @smallexample
-static int complex_unpack_data(starpu_data_handle_t handle, uint32_t node, void *ptr)
+static int complex_unpack_data(starpu_data_handle_t handle, uint32_t node, void *ptr, size_t count)
 @{
   STARPU_ASSERT(starpu_data_test_if_allocated_on_node(handle, node));
 

+ 1 - 1
examples/interface/complex_interface.c

@@ -186,7 +186,7 @@ static int complex_pack_data(starpu_data_handle_t handle, uint32_t node, void **
 	return 0;
 }
 
-static int complex_unpack_data(starpu_data_handle_t handle, uint32_t node, void *ptr)
+static int complex_unpack_data(starpu_data_handle_t handle, uint32_t node, void *ptr, size_t count)
 {
 	STARPU_ASSERT(starpu_data_test_if_allocated_on_node(handle, node));
 

+ 2 - 2
include/starpu_data_interfaces.h

@@ -135,7 +135,7 @@ struct starpu_data_interface_ops
 	/* Pack the data handle into a contiguous buffer at the address ptr and store the size of the buffer in count */
         int (*pack_data)(starpu_data_handle_t handle, uint32_t node, void **ptr, size_t *count);
 	/* Unpack the data handle from the contiguous buffer at the address ptr */
-	int (*unpack_data)(starpu_data_handle_t handle, uint32_t node, void *ptr);
+	int (*unpack_data)(starpu_data_handle_t handle, uint32_t node, void *ptr, size_t count);
 };
 
 /* Return the next available id for a data interface */
@@ -435,7 +435,7 @@ void starpu_multiformat_data_register(starpu_data_handle_t *handle, uint32_t hom
 enum starpu_data_interface_id starpu_handle_get_interface_id(starpu_data_handle_t handle);
 
 int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, size_t *count);
-int starpu_handle_unpack_data(starpu_data_handle_t handle, void *ptr);
+int starpu_handle_unpack_data(starpu_data_handle_t handle, void *ptr, size_t count);
 size_t starpu_handle_get_size(starpu_data_handle_t handle);
 
 /* Lookup a ram pointer into a StarPU handle */

+ 1 - 1
mpi/src/starpu_mpi.c

@@ -557,7 +557,7 @@ static void _starpu_mpi_handle_request_termination(struct _starpu_mpi_req *req)
         if (req->request_type != BARRIER_REQ)
 	{
 		if (req->needs_unpacking)
-			starpu_handle_unpack_data(req->data_handle, req->ptr);
+			starpu_handle_unpack_data(req->data_handle, req->ptr, req->count);
 		else
 			MPI_Type_free(&req->datatype);
                 starpu_data_release(req->data_handle);

+ 2 - 2
src/datawizard/interfaces/data_interface.c

@@ -687,10 +687,10 @@ int starpu_handle_pack_data(starpu_data_handle_t handle, void **ptr, size_t *cou
 	return handle->ops->pack_data(handle, _starpu_get_local_memory_node(), ptr, count);
 }
 
-int starpu_handle_unpack_data(starpu_data_handle_t handle, void *ptr)
+int starpu_handle_unpack_data(starpu_data_handle_t handle, void *ptr, size_t count)
 {
 	STARPU_ASSERT(handle->ops->unpack_data);
-	return handle->ops->unpack_data(handle, _starpu_get_local_memory_node(), ptr);
+	return handle->ops->unpack_data(handle, _starpu_get_local_memory_node(), ptr, count);
 }
 
 size_t starpu_handle_get_size(starpu_data_handle_t handle)