#[repr(C)]pub struct starpu_data_interface_ops {Show 34 fields
pub register_data_handle: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, home_node: c_int, data_interface: *mut c_void)>,
pub unregister_data_handle: Option<unsafe extern "C" fn(handle: starpu_data_handle_t)>,
pub allocate_data_on_node: Option<unsafe extern "C" fn(data_interface: *mut c_void, node: c_uint) -> starpu_ssize_t>,
pub free_data_on_node: Option<unsafe extern "C" fn(data_interface: *mut c_void, node: c_uint)>,
pub cache_data_on_node: Option<unsafe extern "C" fn(cached_interface: *mut c_void, src_interface: *mut c_void, node: c_uint)>,
pub reuse_data_on_node: Option<unsafe extern "C" fn(dst_data_interface: *mut c_void, cached_interface: *const c_void, node: c_uint)>,
pub map_data: Option<unsafe extern "C" fn(src_interface: *mut c_void, src_node: c_uint, dst_interface: *mut c_void, dst_node: c_uint) -> c_int>,
pub unmap_data: Option<unsafe extern "C" fn(src_interface: *mut c_void, src_node: c_uint, dst_interface: *mut c_void, dst_node: c_uint) -> c_int>,
pub update_map: Option<unsafe extern "C" fn(src_interface: *mut c_void, src_node: c_uint, dst_interface: *mut c_void, dst_node: c_uint) -> c_int>,
pub init: Option<unsafe extern "C" fn(data_interface: *mut c_void)>,
pub copy_methods: *const starpu_data_copy_methods,
pub handle_to_pointer: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint) -> *mut c_void>,
pub to_pointer: Option<unsafe extern "C" fn(data_interface: *mut c_void, node: c_uint) -> *mut c_void>,
pub get_size: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> usize>,
pub get_alloc_size: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> usize>,
pub get_max_size: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> usize>,
pub footprint: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> u32>,
pub alloc_footprint: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> u32>,
pub compare: Option<unsafe extern "C" fn(data_interface_a: *mut c_void, data_interface_b: *mut c_void) -> c_int>,
pub alloc_compare: Option<unsafe extern "C" fn(data_interface_a: *mut c_void, data_interface_b: *mut c_void) -> c_int>,
pub display: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, f: *mut FILE)>,
pub describe: Option<unsafe extern "C" fn(data_interface: *mut c_void, buf: *mut c_char, size: usize) -> starpu_ssize_t>,
pub interfaceid: starpu_data_interface_id,
pub interface_size: usize,
pub is_multiformat: c_char,
pub dontcache: c_char,
pub get_mf_ops: Option<unsafe extern "C" fn(data_interface: *mut c_void) -> *mut starpu_multiformat_data_interface_ops>,
pub pack_data: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint, ptr: *mut *mut c_void, count: *mut starpu_ssize_t) -> c_int>,
pub peek_data: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint, ptr: *mut c_void, count: usize) -> c_int>,
pub unpack_data: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint, ptr: *mut c_void, count: usize) -> c_int>,
pub pack_meta: Option<unsafe extern "C" fn(data_interface: *mut c_void, ptr: *mut *mut c_void, count: *mut starpu_ssize_t) -> c_int>,
pub unpack_meta: Option<unsafe extern "C" fn(data_interface: *mut *mut c_void, ptr: *mut c_void, count: *mut starpu_ssize_t) -> c_int>,
pub free_meta: Option<unsafe extern "C" fn(data_interface: *mut c_void) -> c_int>,
pub name: *mut c_char,
}Expand description
@defgroup API_Data_Partition Data Partition @{
Fields§
§register_data_handle: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, home_node: c_int, data_interface: *mut c_void)>Register an existing interface into a data handle.
This iterates over all memory nodes to initialize all fields of the data interface on each of them. Since data is not allocated yet except on the home node, pointers should be left as NULL except on the \p home_node (if >= 0), for which the pointers should be copied from the given \p data_interface, which was filled with the application’s pointers.
This method is mandatory.
See \ref DefiningANewDataInterface_registration for more details.
unregister_data_handle: Option<unsafe extern "C" fn(handle: starpu_data_handle_t)>Unregister a data handle.
This iterates over all memory nodes to free any pointer in the data interface on each of them.
At this point, free_data_on_node has been already called on each of them. This just clears anything that would still be left.
See \ref DefiningANewDataInterface_registration for more details.
allocate_data_on_node: Option<unsafe extern "C" fn(data_interface: *mut c_void, node: c_uint) -> starpu_ssize_t>Allocate data for the interface on a given node. This should use starpu_malloc_on_node() to perform the allocation(s), and fill the pointers in the data interface. It should return the size of the allocated memory, or -ENOMEM if memory could not be allocated.
Note that the memory node can be CPU memory, GPU memory, or even disk area. The result returned by starpu_malloc_on_node() should be just stored as uintptr_t without trying to interpret it since it may be a GPU pointer, a disk descriptor, etc.
This method is mandatory to be able to support memory nodes.
See \ref DefiningANewDataInterface_pointers for more details.
free_data_on_node: Option<unsafe extern "C" fn(data_interface: *mut c_void, node: c_uint)>Free data of the interface on a given node.
This method is mandatory to be able to support memory nodes.
See \ref DefiningANewDataInterface_pointers for more details.
cache_data_on_node: Option<unsafe extern "C" fn(cached_interface: *mut c_void, src_interface: *mut c_void, node: c_uint)>Cache the buffers from the given node to a caching interface.
This method is optional, mostly useful when also making starpu_data_interface_ops::unregister_data_handle check that pointers are NULL.
\p src_interface is an interface that already has buffers allocated, but which we don’t need any more. \p cached_interface is a new interface into which the buffer pointers should be transferred, for later reuse when allocating data of the same kind.
Usually we can just memcpy over the set of pointers and descriptions (this is what StarPU does when this method is not implemented), but if unregister_data_handle checks that pointers are NULL, we need to additionally clear the pointers in \p src_interface. Also, it is not useful to copy the whole interface, only the pointers need to be copied (essentially the pointers that starpu_data_interface_ops::reuse_data_on_node will then transfer into a new handle interface), as well as the properties that starpu_data_interface_ops::compare (or starpu_data_interface_ops::alloc_compare if defined) needs for comparing interfaces for caching compatibility.
When this method is not defined, StarPU will just copy the \p cached_interface into \p src_interface.
See \ref VariableSizeDataInterface and \ref DefiningANewDataInterface_pointers for more details.
reuse_data_on_node: Option<unsafe extern "C" fn(dst_data_interface: *mut c_void, cached_interface: *const c_void, node: c_uint)>Reuse on the given node the buffers of the provided interface
This method is optional, mostly useful when also defining alloc_footprint to share tiles of the same allocation size but different shapes, or when the interface contains pointers which are initialized at registration (e.g. nn array in the ndim interface)
\p cached_interface is an already-allocated buffer that we want to reuse, and \p new_data_interface is an interface in which we want to install that already-allocated buffer. Usually we can just memcpy over the set of pointers and descriptions. But e.g. with 2D tiles the ld value may not be correct, and memcpy would wrongly overwrite it in new_data_interface, i.e. reusing a vertical tile allocation for a horizontal tile, or vice-versa.
reuse_data_on_node should thus copy over pointers, and define fields that are usually set by allocate_data_on_node (e.g. ld).
See \ref VariableSizeDataInterface and \ref DefiningANewDataInterface_pointers for more details.
map_data: Option<unsafe extern "C" fn(src_interface: *mut c_void, src_node: c_uint, dst_interface: *mut c_void, dst_node: c_uint) -> c_int>Map data from a source to a destination. Define function starpu_interface_map() to set this field. See \ref DefiningANewDataInterface_pointers for more details.
unmap_data: Option<unsafe extern "C" fn(src_interface: *mut c_void, src_node: c_uint, dst_interface: *mut c_void, dst_node: c_uint) -> c_int>Unmap data from a source to a destination. Define function starpu_interface_unmap() to set this field. See \ref DefiningANewDataInterface_pointers for more details.
update_map: Option<unsafe extern "C" fn(src_interface: *mut c_void, src_node: c_uint, dst_interface: *mut c_void, dst_node: c_uint) -> c_int>Update map data from a source to a destination. Define function starpu_interface_update_map() to set this field. See \ref DefiningANewDataInterface_pointers for more details.
init: Option<unsafe extern "C" fn(data_interface: *mut c_void)>Initialize the interface. This method is optional. It is called when initializing the handler on all the memory nodes.
copy_methods: *const starpu_data_copy_methodsStruct with pointer to functions for performing ram/cuda/opencl synchronous and asynchronous transfers.
This field is mandatory to be able to support memory nodes, except disk nodes which can be supported by just implementing starpu_data_interface_ops::pack_data and starpu_data_interface_ops::unpack_data.
handle_to_pointer: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint) -> *mut c_void>@deprecated Use starpu_data_interface_ops::to_pointer instead. Return the current pointer (if any) for the handle on the given node.
This method is only required if starpu_data_interface_ops::to_pointer is not implemented.
to_pointer: Option<unsafe extern "C" fn(data_interface: *mut c_void, node: c_uint) -> *mut c_void>Return the current pointer (if any) for the given interface on the given node.
This method is only required for starpu_data_handle_to_pointer() and starpu_data_get_local_ptr(), and for disk support.
get_size: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> usize>Return an estimation of the size of data, for performance models and tracing feedback.
get_alloc_size: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> usize>Return an estimation of the size of allocated data, for allocation management. If not specified, the starpu_data_interface_ops::get_size method is used instead.
get_max_size: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> usize>Return the maximum size that the data may need to increase to. For instance, in the case of compressed matrix tiles this is the size when the block is fully dense. This is currently only used for feedback tools.
footprint: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> u32>Return a 32bit footprint which characterizes the data size and layout (nx, ny, ld, elemsize, etc.), required for indexing performance models.
starpu_hash_crc32c_be() and alike can be used to produce this 32bit value from various types of values.
alloc_footprint: Option<unsafe extern "C" fn(handle: starpu_data_handle_t) -> u32>Return a 32bit footprint which characterizes the data allocation, to be used for indexing allocation cache. If not specified, the starpu_data_interface_ops::footprint method is used instead. If specified, alloc_compare should be set to provide the strict comparison, and reuse_data_on_node should be set to provide correct buffer reuse.
compare: Option<unsafe extern "C" fn(data_interface_a: *mut c_void, data_interface_b: *mut c_void) -> c_int>Compare the data size and layout of two interfaces (nx, ny, ld, elemsize, etc.), to be used for indexing performance models. It should return 1 if the two interfaces size and layout match computation-wise, and 0 otherwise. It does not compare the actual content of the interfaces.
alloc_compare: Option<unsafe extern "C" fn(data_interface_a: *mut c_void, data_interface_b: *mut c_void) -> c_int>Compare the data allocation of two interfaces etc.), to be used for indexing allocation cache. It should return 1 if the two interfaces are allocation-compatible, i.e. basically have the same alloc_size, and 0 otherwise. If not specified, the starpu_data_interface_ops::compare method is used instead.
display: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, f: *mut FILE)>Dump the sizes of a handle to a file. This is required for performance models
describe: Option<unsafe extern "C" fn(data_interface: *mut c_void, buf: *mut c_char, size: usize) -> starpu_ssize_t>Describe the data into a string in a brief way, such as one letter to describe the type of data, and the data dimensions. This is required for tracing feedback.
interfaceid: starpu_data_interface_idAn identifier that is unique to each interface.
interface_size: usizeSize of the interface data descriptor.
is_multiformat: c_char§dontcache: c_charIf set to non-zero, StarPU will never try to reuse an allocated buffer for a different handle. This can be notably useful for application-defined interfaces which have a dynamic size, and for which it thus does not make sense to reuse the buffer since will probably not have the proper size.
get_mf_ops: Option<unsafe extern "C" fn(data_interface: *mut c_void) -> *mut starpu_multiformat_data_interface_ops>§pack_data: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint, ptr: *mut *mut c_void, count: *mut starpu_ssize_t) -> c_int>Pack the data handle into a contiguous buffer at the address
allocated with
This method (and starpu_data_interface_ops::unpack_data) is required for disk support if the starpu_data_copy_methods::any_to_any method is not implemented (because the in-memory data layout is too complex).
This is also required for MPI support if there is no registered MPI data type.
peek_data: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint, ptr: *mut c_void, count: usize) -> c_int>Read the data handle from the contiguous buffer at the address \p ptr of size \p count.
unpack_data: Option<unsafe extern "C" fn(handle: starpu_data_handle_t, node: c_uint, ptr: *mut c_void, count: usize) -> c_int>Unpack the data handle from the contiguous buffer at the address \p ptr of size \p count. The memory at the address \p ptr should be freed after the data unpacking operation.
pack_meta: Option<unsafe extern "C" fn(data_interface: *mut c_void, ptr: *mut *mut c_void, count: *mut starpu_ssize_t) -> c_int>Pack the interface into a contiguous buffer and set the size of the newly created buffer in \p count. This function is used in master slave mode for data interfaces with a dynamic content.
unpack_meta: Option<unsafe extern "C" fn(data_interface: *mut *mut c_void, ptr: *mut c_void, count: *mut starpu_ssize_t) -> c_int>Unpack the interface from the given buffer and set the size of the unpacked data in \p count. This function is used in master slave mode for data interfaces with a dynamic content.
free_meta: Option<unsafe extern "C" fn(data_interface: *mut c_void) -> c_int>Free the allocated memory by a previous call to unpack_meta()
name: *mut c_charName of the interface
Trait Implementations§
Source§impl Clone for starpu_data_interface_ops
impl Clone for starpu_data_interface_ops
Source§fn clone(&self) -> starpu_data_interface_ops
fn clone(&self) -> starpu_data_interface_ops
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more