函数:reduce_async
产品支持情况
- Ascend 950PR&950DT系列产品:支持
- Atlas A3系列产品:支持
- Atlas A2系列产品:支持
- Atlas 200I/500 A2推理产品:支持
- Atlas推理系列产品:支持
- Atlas训练系列产品:支持
功能说明
执行Reduce操作,包括SUM、MIN、MAX等。
本接口是异步接口,调用接口成功仅表示任务下发成功,不表示任务执行成功。调用该接口后,需调用同步等待接口(例如,synchronize_stream)确保任务已执行完成,否则可能会导致训练或推理等业务异常、Device断链掉卡等未知情况。
函数原型
-
C函数原型
aclError aclrtReduceAsync(void *dst, const void *src, uint64_t count, aclrtReduceKind kind, aclDataType type, aclrtStream stream, void *reserve) -
python函数
ret = acl.rt.reduce_async(dst, src, count, kind, type, stream, reserve)
参数说明
| 参数名 | 说明 |
|---|---|
| dst | int,目的内存地址指针。 |
| src | int,源内存地址指针。 |
| count | int,源内存大小,单位为Byte。 |
| kind | int,操作类型。具体请参见aclrtReduceKind。 |
| type | int,数据类型。 具体请参见aclDataType。 |
| stream | int,指定Stream。如果使用默认Stream,此处设置为0。 |
| reserve | int,预留参数。当前固定传NULL。 |
返回值说明
| 返回值 | 说明 |
|---|---|
| ret | int,错误码,返回0表示成功,返回其它值表示失败。 |
约束说明
dst、src必须跟stream所在的Device是同一个设备。
Atlas A3系列产品支持如下类型:int8、int16、int32、fp16、fp32、bf16。
Atlas A2系列产品支持如下类型:int8、int16、int32、fp16、fp32、bf16。
Atlas 200I/500 A2推理产品支持如下类型:int8、int16、int32、fp16、fp32。
Atlas推理系列产品支持如下类型:fp32 、fp16、int16。
Atlas训练系列产品仅支持fp32类型。