alltoallv

函数原型

def all_to_all_v(send_data, send_counts, send_displacements, recv_counts, recv_displacements, group="hccl_world_group")

功能说明

集合通信域alltoallv操作接口。向通信域内所有rank发送数据(数据量可以定制),并从所有rank接收数据。

参数说明

参数名

输入/输出

描述

send_data

输入

tensorflow的tensor类型。tensor支持的数据类型为 int8, uint8, int16, uint16, int32, uint32, int64, uint64, float16, float32, float64 。

send_counts

输入

tensorflow的tensor类型。tensor支持的数据类型为int64, uint64。

send_displacements

输入

tensorflow的tensor类型。tensor支持的数据类型为int64, uint64。

recv_counts

输入

tensorflow的tensor类型。tensor支持的数据类型为int64, uint64。

recv_displacements

输入

tensorflow的tensor类型。tensor支持的数据类型为int64, uint64。

group

输入

String类型,最大长度为128字节,含结束符。group名称,可以为用户自定义group或者"hccl_world_group"。

返回值

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

调用示例

from npu_bridge.npu_init import *
result = hccl_ops.all_to_all_v(send_data_tensor, send_counts_tensor, send_displacements_tensor, recv_counts_tensor, recv_displacements_tensor)

约束说明

1、调用该接口的rank必须在当前接口入参group定义的范围内,不在此范围内的rank调用该接口会失败。

2、alltoallv的通信域需要满足:单server1p、2p通信域要在同一个cluster内(server内0-3卡和4-7卡各为一个cluster),单server4p、8p和多server通信域中rank要以cluster为基本单位,并且server间cluster选取要一致。