pub unsafe extern "C" fn cutensorCreateContractionTrinary(
handle: cutensorHandle_t,
desc: *mut cutensorOperationDescriptor_t,
descA: cutensorTensorDescriptor_t,
modeA: *const i32,
opA: cutensorOperator_t,
descB: cutensorTensorDescriptor_t,
modeB: *const i32,
opB: cutensorOperator_t,
descC: cutensorTensorDescriptor_t,
modeC: *const i32,
opC: cutensorOperator_t,
descD: cutensorTensorDescriptor_t,
modeD: *const i32,
opD: cutensorOperator_t,
descE: cutensorTensorDescriptor_t,
modeE: *const i32,
descCompute: cutensorComputeDescriptor_t,
) -> cutensorStatus_tExpand description
This function allocates a cutensorOperationDescriptor_t object that encodes a tensor contraction of the form $\mathcal{E} = \alpha \mathcal{A} \mathcal{B} \mathcal{C} + \beta \mathcal{D}$.
Allocates data for desc to be used to perform a tensor contraction of the form:
$$
\mathcal{E}{{modes}\mathcal{E}} \gets \alpha op_\mathcal{A}(\mathcal{A}{{modes}\mathcal{A}}) op_\mathcal{B}(\mathcal{B}{{modes}\mathcal{B}}) op_\mathcal{C}(\mathcal{C}{{modes}\mathcal{C}}) + \beta op_\mathcal{D}(\mathcal{D}{{modes}\mathcal{D}}).
$$
See cutensorCreatePlan (or cutensorCreatePlanAutotuned) to create the plan (i.e., to select the kernel) followed by a call to cutensorContractTrinary to perform the actual contraction.
The user is responsible for calling cutensorDestroyOperationDescriptor to free the resources associated with the descriptor.
The performance improvements due to this API are currently especially high if your data resides on the host (i.e. out-of-core), targeting Grace-based systems.
Supported data-type combinations are:
§Parameters
handle: Opaque handle holding cuTENSOR’s library context.desc: This opaque struct gets allocated and filled with the information that encodes the tensor contraction operation.descA: The descriptor that holds the information about the data type, modes and strides of A.modeA: Array with ‘nmodeA’ entries that represent the modes of A. The modeA[i] corresponds to extent[i] and stride[i] with respect to the arguments provided to cutensorInitTensorDescriptor.opA: Unary operator that will be applied to each element of A before it is further processed. The original data of this tensor remains unchanged.descB: The descriptor that holds information about the data type, modes, and strides of B.modeB: Array with ‘nmodeB’ entries that represent the modes of B. The modeB[i] corresponds to extent[i] and stride[i] with respect to the arguments provided to cutensorInitTensorDescriptor.opB: Unary operator that will be applied to each element of B before it is further processed. The original data of this tensor remains unchanged.descC: The escriptor that holds information about the data type, modes, and strides of C.modeC: Array with ‘nmodeC’ entries that represent the modes of C. The modeC[i] corresponds to extent[i] and stride[i] with respect to the arguments provided to cutensorInitTensorDescriptor.opC: Unary operator that will be applied to each element of C before it is further processed. The original data of this tensor remains unchanged.descD: The escriptor that holds information about the data type, modes, and strides of D.modeD: Array with ‘nmodeD’ entries that represent the modes of D. The modeD[i] corresponds to extent[i] and stride[i] with respect to the arguments provided to cutensorInitTensorDescriptor.opD: Unary operator that will be applied to each element of D before it is further processed. The original data of this tensor remains unchanged.descE: The descriptor that holds information about the data type, modes, and strides of E (must be identical todescDfor now).modeE: Array with ‘nmodeE’ entries that represent the modes of E (must be identical to modeD for now). The modeE[i] corresponds to extent[i] and stride[i] with respect to the arguments provided to cutensorInitTensorDescriptor.descCompute: Determines the precision in which this operations is performed.
§Return value
cutensorStatus_t::CUTENSOR_STATUS_INVALID_VALUE: if tensor dimensions or modes have an illegal value.cutensorStatus_t::CUTENSOR_STATUS_NOT_INITIALIZED: if the handle is not initialized.cutensorStatus_t::CUTENSOR_STATUS_NOT_SUPPORTED: if the combination of data types or operations is not supported.cutensorStatus_t::CUTENSOR_STATUS_SUCCESS: The operation completed successfully without error.