pub unsafe extern "C" fn cutensorMpContract(
handle: cutensorMpHandle_t,
plan: cutensorMpPlan_t,
alpha: *const c_void,
A: *const c_void,
B: *const c_void,
beta: *const c_void,
C: *const c_void,
D: *mut c_void,
device_workspace: *mut c_void,
host_workspace: *mut c_void,
) -> cutensorStatus_tExpand description
Performs a distributed tensor contraction across multiple processes.
This function executes the distributed tensor contraction $D = \alpha \mathcal{A} \mathcal{B} + \beta \mathcal{C}$ according to the execution plan created by cutensorMpCreatePlan. The operation coordinates computation and communication across multiple processes and GPUs to efficiently perform tensor contractions that exceed the capacity of a single device.
The execution involves several phases:
- Data redistribution to align tensor blocks for efficient computation
- Local tensor contractions using cuTENSOR on each participating device
- Communication and aggregation of partial results across processes
- Final result assembly in the distributed output tensor
All participating processes in the MPI communicator must call this function with consistent parameters. The input and output tensors must be distributed according to their respective tensor descriptors, with each process providing its local portion of the data.
Remark
calls asynchronous functions, no reentrant, and thread-safe.
§Parameters
handle: Opaque handle holding cutensorMp’s library context.plan: Execution plan for the distributed contraction (created by cutensorMpCreatePlan).alpha: Scaling factor for the A*B product. Pointer to host memory with data type determined by the compute descriptor. The data type follows that of cuTENSOR (i.e., the data type of the scalar is deptermined by the data type ofC:cudaDataType_t::CUDA_R_16FandcudaDataType_t::CUDA_R_16BFusecudaDataType_t::CUDA_R_32Fscalars, all data types of the scalar are identical to the type ofC).A: Pointer to the local portion of distributed tensor A in GPU memory.B: Pointer to the local portion of distributed tensor B in GPU memory.beta: Scaling factor for tensor C. Pointer to host memory with data type determined by the compute descriptor. The data type follows that of cuTENSOR (i.e., the data type of the scalar is deptermined by the data type ofC:cudaDataType_t::CUDA_R_16FandcudaDataType_t::CUDA_R_16BFusecudaDataType_t::CUDA_R_32Fscalars, all data types of the scalar are identical to the type ofC).C: Pointer to the local portion of distributed tensor C in GPU memory.D: Pointer to the local portion of distributed tensor D in GPU memory (may be identical to C).device_workspace: Pointer to device workspace memory (size determined by cutensorMpPlanGetAttribute withcutensorMpPlanAttribute_t::CUTENSORMP_PLAN_REQUIRED_WORKSPACE_DEVICE).host_workspace: Pointer to host workspace memory (size determined by cutensorMpPlanGetAttribute withcutensorMpPlanAttribute_t::CUTENSORMP_PLAN_REQUIRED_WORKSPACE_HOST).
§Return value
cutensorStatus_t::CUTENSOR_STATUS_ARCH_MISMATCH: if the plan was created for a different device architecture.cutensorStatus_t::CUTENSOR_STATUS_CUDA_ERROR: if a CUDA error occurred during execution.cutensorStatus_t::CUTENSOR_STATUS_INSUFFICIENT_WORKSPACE: if the provided workspace is insufficient.cutensorStatus_t::CUTENSOR_STATUS_INVALID_VALUE: if some input data is invalid (this typically indicates a user error).cutensorStatus_t::CUTENSOR_STATUS_NOT_INITIALIZED: if the handle is not initialized.cutensorStatus_t::CUTENSOR_STATUS_NOT_SUPPORTED: if the operation is not supported with the given configuration.cutensorStatus_t::CUTENSOR_STATUS_SUCCESS: The operation completed successfully.