|
@@ -259,21 +259,22 @@ of data interface} can also be used within StarPU-MPI and exchanged
|
|
|
between nodes. Two functions needs to be defined through
|
|
|
the type @code{struct starpu_data_interface_ops} (@pxref{Data
|
|
|
Interface API}). The pack function takes a handle and returns a
|
|
|
-contiguous memory buffer where data to be conveyed to another node
|
|
|
+contiguous memory buffer along with its size where data to be conveyed to another node
|
|
|
should be copied. The reversed operation is implemented in the unpack
|
|
|
function which takes a contiguous memory buffer and recreates the data
|
|
|
handle.
|
|
|
|
|
|
@cartouche
|
|
|
@smallexample
|
|
|
-static int complex_pack_data(starpu_data_handle_t handle, uint32_t node, void **ptr)
|
|
|
+static int complex_pack_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));
|
|
|
|
|
|
struct starpu_complex_interface *complex_interface =
|
|
|
(struct starpu_complex_interface *) starpu_data_get_interface_on_node(handle, node);
|
|
|
|
|
|
- *ptr = malloc(complex_get_size(handle));
|
|
|
+ *count = complex_get_size(handle);
|
|
|
+ *ptr = malloc(*count);
|
|
|
memcpy(*ptr, complex_interface->real, complex_interface->nx*sizeof(double));
|
|
|
memcpy(*ptr+complex_interface->nx*sizeof(double), complex_interface->imaginary,
|
|
|
complex_interface->nx*sizeof(double));
|