昇腾社区首页
中文
注册

函数:reduce_async

产品支持情况

产品

是否支持

Atlas A3 训练系列产品 / Atlas A3 推理系列产品

Atlas A2 训练系列产品 / Atlas 800I A2 推理产品 /A200I A2 Box 异构组件

Atlas 训练系列产品

Atlas 推理系列产品

Atlas 200I/500 A2 推理产品

x

Atlas 200/300/500 推理产品

x

功能说明

执行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函数
    1
    ret = acl.rt.reduce_async(dst, src, count, kind, type, stream, reserve)
    

参数说明

参数名

说明

dst

int,目的内存地址指针。

src

int,源内存地址指针。

count

int,源内存大小,单位为Byte。

kind

int,操作类型。具体请参见新增数据结构aclrtReduceKind

type

int,数据类型。

Atlas A3 训练系列产品 / Atlas A3 推理系列产品 支持如下类型:int8、int16、int32、uint32、fp16、fp32、bf16。

Atlas A2 训练系列产品 / Atlas 800I A2 推理产品 /A200I A2 Box 异构组件支持如下类型:int8、int16、int32、uint32、fp16、fp32、bf16。

Atlas 推理系列产品 支持如下类型:fp32 、fp16、int16。

Atlas 训练系列产品 仅支持fp32类型。

stream

int,指定Stream。如果使用默认Stream,此处设置为0。

reserve

int,预留参数。当前固定传NULL。

返回值说明

返回值

说明

ret

int,错误码,返回0表示成功,返回其它值表示失败。

约束说明

dts、src必须跟stream所在的Device是同一个设备。