HcclReduce
Description
Performs the sum operation (or other reduction operations) on the data of all ranks and sends the result to the specified position on the root rank.
Prototype
HcclResult HcclReduce(void *sendBuf, void *recvBuf, uint64_t count, HcclDataType dataType, HcclReduceOp op, uint32_t root, HcclComm comm, aclrtStream stream)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
sendBuf |
Input |
Address of the buffer to send source data. |
recvBuf |
Output |
Address of the buffer to receive collective communication result. |
count |
Input |
Number of data elements to perform the reduction operation. For example, if only one int32 data element is involved, then count = 1. |
dataType |
Input |
Data type of the reduction operation, which is of the HcclDataType type. |
op |
Input |
Reduction operation type. Currently, the following operation types are supported: sum, prod, max, and min. NOTE:
|
root |
Input |
ID of the root rank used for the reduction operation. |
comm |
Input |
Communicator where the operation is performed. |
stream |
Input |
Stream of the rank. |
Returns
HcclResult: HCCL_SUCCESS on success; else, failure.
Constraints
The ranks must have the same count, dataType, and op.