allgather

函数原型

def allgather(tensor, rank_size, group = "hccl_world_group")

功能说明

提供group内的集合通信allgather功能,将所有节点的输入Tensor合并起来。

参数说明

参数名

输入/输出

描述

tensor

输入

tensorflow的tensor类型。

tensor支持的数据类型为int8, int32, float16, float32, int64, uint64。

rank_size

输入

int类型。

group内device的数量。

最大值为4096。

group

输入

String类型,最大长度为128字节,含结束符。

group名称,可以为用户自定义group或者"hccl_world_group"。

返回值

tensor:对输入tensor执行完allgather操作之后的结果tensor。

调用示例

from npu_bridge.npu_init import *
rank_size = 2
result = hccl_ops.allgather (tensor, rank_size)

约束说明