Browse Source

Add missing starpu_data_pack/unpack_node

Samuel Thibault 4 years ago
parent
commit
ff4f22836f
2 changed files with 28 additions and 5 deletions
  1. 14 1
      include/starpu_data_interfaces.h
  2. 14 4
      src/datawizard/interfaces/data_interface.c

+ 14 - 1
include/starpu_data_interfaces.h

@@ -622,16 +622,29 @@ enum starpu_data_interface_id starpu_data_get_interface_id(starpu_data_handle_t
 /**
    Execute the packing operation of the interface of the data
    registered at \p handle (see starpu_data_interface_ops). This
-   packing operation must allocate a buffer large enough at \p ptr and copy
+   packing operation must allocate a buffer large enough at \p ptr on node \p node and copy
    into the newly allocated buffer the data associated to \p handle. \p count
    will be set to the size of the allocated buffer. If \p ptr is <c>NULL</c>, the
    function should not copy the data in the buffer but just set \p count to
    the size of the buffer which would have been allocated. The special
    value -1 indicates the size is yet unknown.
 */
+int starpu_data_pack_node(starpu_data_handle_t handle, unsigned node, void **ptr, starpu_ssize_t *count);
+
+/**
+   Like starpu_data_pack_node(), but for the local memory node.
+*/
 int starpu_data_pack(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count);
 
 /**
+   Unpack in handle the data located at \p ptr of size \p count allocated
+   on node \p node as described by the interface of the data. The interface
+   registered at \p handle must define a unpacking operation (see
+   starpu_data_interface_ops).
+*/
+int starpu_data_unpack_node(starpu_data_handle_t handle, unsigned node, void *ptr, size_t count);
+
+/**
    Unpack in handle the data located at \p ptr of size \p count as
    described by the interface of the data. The interface registered at
    \p handle must define a unpacking operation (see

+ 14 - 4
src/datawizard/interfaces/data_interface.c

@@ -1217,20 +1217,30 @@ int starpu_data_interface_get_next_id(void)
 	return _data_interface_number-1;
 }
 
-int starpu_data_pack(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count)
+int starpu_data_pack_node(starpu_data_handle_t handle, unsigned node, void **ptr, starpu_ssize_t *count)
 {
 	STARPU_ASSERT_MSG(handle->ops->pack_data, "The datatype interface %s (%d) does not have a pack operation", handle->ops->name, handle->ops->interfaceid);
-	return handle->ops->pack_data(handle, starpu_worker_get_local_memory_node(), ptr, count);
+	return handle->ops->pack_data(handle, node, ptr, count);
 }
 
-int starpu_data_unpack(starpu_data_handle_t handle, void *ptr, size_t count)
+int starpu_data_pack(starpu_data_handle_t handle, void **ptr, starpu_ssize_t *count)
+{
+	return starpu_data_pack_node(handle, starpu_worker_get_local_memory_node(), ptr, count);
+}
+
+int starpu_data_unpack_node(starpu_data_handle_t handle, unsigned node, void *ptr, size_t count)
 {
 	STARPU_ASSERT_MSG(handle->ops->unpack_data, "The datatype interface %s (%d) does not have an unpack operation", handle->ops->name, handle->ops->interfaceid);
 	int ret;
-	ret = handle->ops->unpack_data(handle, starpu_worker_get_local_memory_node(), ptr, count);
+	ret = handle->ops->unpack_data(handle, node, ptr, count);
 	return ret;
 }
 
+int starpu_data_unpack(starpu_data_handle_t handle, void *ptr, size_t count)
+{
+	return starpu_data_unpack_node(handle, starpu_worker_get_local_memory_node(), ptr, count);
+}
+
 size_t starpu_data_get_size(starpu_data_handle_t handle)
 {
 	return handle->ops->get_size(handle);