pub unsafe extern "C" fn cutensorBlockSparseContract(
handle: cutensorHandle_t,
plan: cutensorPlan_t,
alpha: *const c_void,
A: *const *const c_void,
B: *const *const c_void,
beta: *const c_void,
C: *const *const c_void,
D: *const *mut c_void,
workspace: *mut c_void,
workspaceSize: u64,
stream: cudaStream_t,
) -> cutensorStatus_tExpand description
This routine computes the block-sparse tensor contraction $D = alpha \* A \* B + beta \* C$. $$ \mathcal{D}{{modes}\mathcal{D}} \gets \alpha \* \mathcal{A}{{modes}\mathcal{A}} B_{{modes}\mathcal{B}} + \beta \mathcal{C}{{modes}_\mathcal{C}} $$
The active CUDA device must match the CUDA device that was active at the time at which the plan was created.
The array-parameters A, B, C, and D are host-arrays containing pointers to GPU-accessible memory. For example, A is a host-array whose size equals the number of non-zero blocks in tensor $\mathcal{A}$. A\[i\] is a pointer to the GPU-accessible memory location of block number i of $\mathcal{A}$. The blocks are numbered in the same way as in the construction of $\mathcal{A}$’s block-sparse tensor descriptor. The same analogously holds for the other array-parameters B, C, and D.
§Parameters
handle: Opaque handle holding cuTENSOR’s library context.plan: Opaque handle holding the contraction execution plan (created bycutensorCreateBlockSparseContractionfollowed bycutensorCreatePlan).alpha: Scaling for A*B. Its data type is determined by ‘descCompute’ (seecutensorCreateBlockSparseContraction). Pointer to host memory.A: Host-array of size numNonZeroBlocks(A), containing pointers to GPU-accessible memory, corresponding the blocks of A. The data accessed via these pointers must not overlap with the elements written to D.B: Host-array of size numNonZeroBlocks(B), containing pointers to GPU-accessible memory, corresponding the blocks of B. The data accessed via these pointers must not overlap with the elements written to D.beta: Scaling for C. Its data type is determined by ‘descCompute’ (seecutensorCreateBlockSparseContraction). Pointer to host memory.C: Host-array of size numNonZeroBlocks(C), containing pointers to GPU-accessible memory, corresponding the blocks of C.D: Host-array of size numNonZeroBlocks(D), containing pointers to GPU-accessible memory, corresponding the blocks of D.workspace: This pointer provides the required workspace in device memory. 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. For block-sparse contractions, this estimate is exact.stream: The CUDA stream to which all of the computation is synchronised.
§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.