contract_slices#
-
cuquantum.
bindings. cutensornet. contract_slices( - intptr_t handle,
- intptr_t plan,
- raw_data_in,
- intptr_t raw_data_out,
- int32_t accumulate_output,
- intptr_t work_desc,
- intptr_t slice_group,
- intptr_t stream,
DEPRECATED: Performs the actual contraction of the tensor network.
- Parameters:
handle (intptr_t) – Opaque handle holding cuTensorNet’s library context.
plan (intptr_t) – Encodes the execution of a tensor network contraction (see
create_contraction_plan()
andcontraction_autotune()
). Some internal meta-data may be updated upon contraction.raw_data_in (object) –
Array of N pointers (N being the number of input tensors specified in
create_network_descriptor()
):raw_data_in[i]
points to the data associated with the i-th input tensor (in device memory). The order of the provided memory pointers for the input tensors should match the order at which the input tensors have been appended to the network. It can be:raw_data_out (intptr_t) – Points to the raw data of the output tensor (in device memory).
accumulate_output (int32_t) – If 0, write the contraction result into raw_data_out; otherwise accumulate the result into raw_data_out.
work_desc (intptr_t) – Opaque structure describing the workspace. The provided
CUTENSORNET_WORKSPACE_SCRATCH
workspace 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 plan creation). Seecreate_contraction_plan()
,workspace_get_memory_size()
&workspace_set_memory()
. The providedCUTENSORNET_WORKSPACE_CACHE
workspace 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, thenwork_desc
can be set to null, or the memory pointer inwork_desc
of 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 avalid
size. 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_desc
is destroyed, ifwork_desc
!= NULL, otherwise, once theplan
is destroyed, or an alternativework_desc
with a different memory address/size is provided in a subsequentcontract_slices()
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