pub unsafe extern "C" fn cutensorContractTrinary(
handle: cutensorHandle_t,
plan: cutensorPlan_t,
alpha: *const c_void,
A: *const c_void,
B: *const c_void,
C: *const c_void,
beta: *const c_void,
D: *const c_void,
E: *mut c_void,
workspace: *mut c_void,
workspaceSize: u64,
stream: cudaStream_t,
) -> cutensorStatus_tExpand description
This routine computes the tensor contraction $E = alpha \* A \* B \* C + beta \* D$. $$ \mathcal{E}{{modes}\mathcal{E}} \gets \alpha \* \mathcal{A}{{modes}\mathcal{A}} \mathcal{B}{{modes}\mathcal{B}} \mathcal{C}{{modes}\mathcal{C}} + \beta \mathcal{D}{{modes}\mathcal{D}} $$
The active CUDA device must match the CUDA device that was active at the time at which the plan was created.
[Example] : See NVIDIA/CUDALibrarySamples for a concrete example.
§Parameters
handle: Opaque handle holding cuTENSOR’s library context.plan: Opaque handle holding the contraction execution plan (created bycutensorCreateContractionTrinaryfollowed bycutensorCreatePlan).alpha: Scaling for A*B*C. Its data type is determined by ‘descCompute’ (see cutensorOperationDescriptorGetAttribute(desc, CUTENSOR_OPERATION_SCALAR_TYPE)). Pointer to the host memory.A: Pointer to the data corresponding to A. Pointer to the GPU-accessible memory. The data accessed via this pointer must not overlap with the elements written to E.B: Pointer to the data corresponding to B. Pointer to the GPU-accessible memory. The data accessed via this pointer must not overlap with the elements written to E.C: Pointer to the data corresponding to C. Pointer to the GPU-accessible memory. The data accessed via this pointer must not overlap with the elements written to E.beta: Scaling for D. Its data type is determined by ‘descCompute’ (see cutensorOperationDescriptorGetAttribute(desc, CUTENSOR_OPERATION_SCALAR_TYPE)). Pointer to the host memory.D: Pointer to the data corresponding to D. Pointer to the GPU-accessible memory.E: Pointer to the data corresponding to E. Pointer to the GPU-accessible memory.workspace: Optional parameter that may be NULL. This pointer provides additional workspace, in device memory, to the library for additional optimizations; the workspace must be aligned to 256 bytes (i.e., the default alignment of cudaMalloc).workspaceSize: Size of the workspace array in bytes; please refer tocutensorEstimateWorkspaceSizeto query the required workspace. WhilecutensorContractdoes not strictly require a workspace for the contraction, it is still recommended to provide some small workspace (e.g., 128 MB).stream: The CUDA stream in which all the computation is performed.
§Return value
cutensorStatus_t::CUTENSOR_STATUS_ARCH_MISMATCH: if the plan was created for a different device than the currently active device.cutensorStatus_t::CUTENSOR_STATUS_CUDA_ERROR: if some unknown CUDA error has occurred (e.g., out of memory).cutensorStatus_t::CUTENSOR_STATUS_INSUFFICIENT_DRIVER: if the driver is insufficient.cutensorStatus_t::CUTENSOR_STATUS_INVALID_VALUE: if some input data is invalid (this typically indicates an user error).cutensorStatus_t::CUTENSOR_STATUS_NOT_INITIALIZED: if the handle is not initialized.cutensorStatus_t::CUTENSOR_STATUS_NOT_SUPPORTED: if operation is not supported.cutensorStatus_t::CUTENSOR_STATUS_SUCCESS: The operation completed successfully.