Function: reduce_async
Applicable Products
- Ascend 950PR&950DT products: Supported
- Atlas A3 products: Supported
- Atlas A2 products: Supported
- Atlas 200I/500 A2 inference products: Supported
- Atlas inference products: Supported
- Atlas training products: Supported
Function
Performs a Reduce operation, including SUM, MIN, and MAX.
This API is asynchronous. The API call delivers a task rather than executes a task. After this API is called, you need to call a synchronization API (for example, synchronize_stream) to ensure that the task is complete. Otherwise, service exceptions (such as training or inference exceptions) or unknown situations (such as device disconnection or card disconnection) may occur.
Prototype
-
C Prototype
aclError aclrtReduceAsync(void *dst, const void *src, uint64_t count, aclrtReduceKind kind, aclDataType type, aclrtStream stream, void *reserve) -
Python Function
ret = acl.rt.reduce_async(dst, src, count, kind, type, stream, reserve)
Parameters
| Parameter | Description |
|---|---|
| dst | Int, pointer to the destination memory address. |
| src | Int, pointer to the source memory address. |
| count | Int, size of the source memory, in bytes. |
| kind | Int, operation type. For details, see aclrtReduceKind. |
| type | Int, data type. For details, see aclDataType. |
| stream | Int, stream. Pass 0 if the default stream is used. |
| reserve | Int, reserved parameter. Currently, this parameter is fixed at NULL. |
Return Values
| Return Value | Description |
|---|---|
| ret | Int, error code. If 0 is returned, the operation is successful. If other values are returned, the operation fails. |
Constraints
dts and src must be on the same device as stream.
Atlas A3 products support the following data types: int8, int16, int32, fp16, fp32, and bf16.
Atlas A2 products support the following data types: int8, int16, int32, fp16, fp32, and bf16.
Atlas 200I/500 A2 inference products support the following data types: int8, int16, int32, fp16, and fp32.
Atlas inference products support the following data types: fp32, fp16, and int16.
Atlas training products support only the fp32 data type.