Function: reduce_async

Applicable Products

Product

Supported (√/x)

Ascend 950PR/Ascend 950DT

√

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas training products

√

Atlas inference products

√

Atlas 200I/500 A2 inference products

√

Description

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 must call a synchronization API (for example, synchronize_stream) to ensure that the memory initialization task is complete. Otherwise, unknown problems may occur, such as service exceptions (for example, training or inference exceptions) or device disconnection.

Prototype

  • C Prototype
    aclError aclrtReduceAsync(void *dst, const void *src, uint64_t count, aclrtReduceKind kind, aclDataType type, aclrtStream stream, void *reserve)
  • Python Function
    1
    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.

The Atlas A3 training products/Atlas A3 inference products support the following data types: int8, int16, int32, fp16, fp32, and bf16.

The Atlas A2 training products/Atlas A2 inference products support the following data types: int8, int16, int32, fp16, fp32, and bf16.

The Atlas 200I/500 A2 inference products support the following types: int8, int16, int32, fp16 and fp32.

The Atlas inference products support the following data types: fp32, fp16, and int16.

The Atlas training products support only the fp32 type.

For details, see aclDataType.

stream

Int, stream. If the default stream is used, set the parameter to 0.

reserve

Int, reserved parameter. Currently, the value is fixed to NULL.

Return Values

Return Value

Description

ret

Int, error code. 0 on success; else, failure.

Restrictions

dts and src must be on the same device as stream.