network_contract#
-
cuquantum.
bindings. cutensornet. network_contract( - intptr_t handle,
- intptr_t network_desc,
- int32_t accumulate_output,
- intptr_t work_desc,
- intptr_t slice_group,
- intptr_t stream,
Performs the actual contraction of the tensor network.
- Parameters:
handle (intptr_t) – Opaque handle holding cuTensorNet’s library context.
network_desc (intptr_t) – The network descriptor whose specifed slices (
slice_group) will be contracted (seenetwork_prepare_contraction()andnetwork_autotune_contraction()). Some internal meta-data may be updated upon contraction.accumulate_output (int32_t) – If 0, write the contraction result into output data buffer as provided by
network_set_output_tensor_memory(); otherwise, accumulate the results.work_desc (intptr_t) – Opaque structure describing the workspace. The provided
CUTENSORNET_WORKSPACE_SCRATCHworkspace must bevalid(the workspace pointer must be device accessible, seecutensornetMemspace_t, and the workspace size must be the same as or larger than both the minimum needed and the value provided at contraction preparation). Seenetwork_prepare_contraction(),workspace_get_memory_size()&workspace_set_memory(). The providedCUTENSORNET_WORKSPACE_CACHEworkspace must be device accessible, seecutensornetMemspace_t; it can be of any size, the larger the better, up to the size that can be queried withworkspace_get_memory_size(). If a device memory handler is set (seecutensornetSetDeviceMemHandler()), thenwork_desccan be set to null, or the memory pointer inwork_descof either the workspace kinds can be set to null, and the workspace size can be set either to a negative value (in which case the “recommended” size is used, seeCUTENSORNET_WORKSIZE_PREF_RECOMMENDED) or to avalidsize. For a workspace of kindCUTENSORNET_WORKSPACE_SCRATCH, a memory buffer with the specified size will be drawn from the user’s mempool and released back once done. For a workspace of kindCUTENSORNET_WORKSPACE_CACHE, a memory buffer with the specified size will be drawn from the user’s mempool and released back once thework_descis destroyed, ifwork_desc!= NULL, otherwise, once thenetwork_descis destroyed,workspace_purge_cache()is called, or an alternativework_descwith a different memory address/size is provided in a subsequentnetwork_contract()call.slice_group (intptr_t) – Opaque object specifying the slices to be contracted (see
create_slice_group_from_id_range()andcutensornetCreateSliceGroupFromIDs()).If set to null, all slices will be contracted..stream (intptr_t) – The CUDA stream on which the computation is performed.
See also