alltoallv【免费下载链接】tensorflowAscend TensorFlow Adapter项目地址: https://gitcode.com/cann/tensorflow功能说明集合通信算子AlltoAllV操作接口向通信域内所有rank发送数据数据量可以定制并从所有rank接收数据。函数原型def all_to_all_v(send_data, send_counts, send_displacements, recv_counts, recv_displacements, grouphccl_world_group)参数说明参数名输入/输出描述send_data输入待发送的数据TensorFlow的tensor类型。针对Ascend 950PR/Ascend 950DT支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64、bfp16。针对Atlas A3 训练系列产品/Atlas A3 推理系列产品支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64、bfp16。针对Atlas A2 训练系列产品/Atlas A2 推理系列产品支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64、bfp16。针对Atlas 训练系列产品支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64 。send_counts输入发送的数据量send_counts[i]表示本rank发给rank i的数据个数基本单位是send_data数据类型对应的字节数。例send_data的数据类型为int32send_counts[0]1,send_counts[1]2表示本rank给rank0发送1个int32类型的数据给rank1发送2个int32类型的数据。TensorFlow的tensor类型tensor支持的数据类型为int64。send_displacements输入发送数据的偏移量send_displacements[i]表示本rank发送给rank i的数据块相对于send_data的偏移量基本单位是send_data数据类型对应字节数。例- send_data的数据类型为int32。- send_counts[0]1,send_counts[1]2- send_displacements[0]0,send_displacements[1]1则表示本rank给rank0发送send_data上的第1个int32类型的数据给rank1发送send_data上第2个与第3个int32类型的数据。TensorFlow的tensor类型tensor支持的数据类型为int64。recv_counts输入接收的数据量recv_counts[i]表示本rank从rank i收到的数据量。使用方法与send_counts类似。TensorFlow的tensor类型。tensor支持的数据类型为int64。recv_displacements输入接收数据的偏移量recv_displacements[i]表示本rank发送给rank i数据块相对于recv_data的偏移量基本单位是recv_data_type的字节数。使用方法与send_displacements类似。TensorFlow的tensor类型。tensor支持的数据类型为int64。group输入group名称可以为用户自定义group或者hccl_world_group。String类型最大长度为128字节含结束符。返回值对输入tensor执行完all_to_all_v操作之后的结果tensor。约束说明调用该接口的rank必须在当前接口入参group定义的范围内不在此范围内的rank调用该接口会失败。针对Atlas 训练系列产品alltoallv的通信域需要满足如下约束集群组网下单Server 1p、2p通信域要在同一个cluster内Server内0-3卡和4-7卡各为一个cluster单Server 4p、8p和多Server通信域中rank要以cluster为基本单位并且Server间cluster选取要一致。alltoallv操作的性能与NPU之间共享数据的缓存区大小有关当通信数据量超过缓存区大小时性能将出现明显下降。若业务中alltoallv通信数据量较大建议通过配置环境变量HCCL_BUFFSIZE适当增大缓存区大小以提升通信性能关于环境变量HCCL_BUFFSIZE的介绍可参见《环境变量参考》。针对Atlas 训练系列产品如果是单Server场景要求网卡的状态是“up”否则此接口会执行失败。调用示例from npu_bridge.hccl import hccl_ops send_data_tensor tf.random_uniform((1, 3), minval1, maxval10, dtypetf.float32) send_counts_tensor tf.constant([3,3],dtypetf.int64) send_displacements_tensor tf.constant([0,0],dtypetf.int64) recv_counts_tensor tf.constant([3,3],dtypetf.int64) recv_displacements_tensor tf.constant([0,0],dtypetf.int64) result hccl_ops.all_to_all_v(send_data_tensor,send_counts_tensor,send_displacements_tensor,recv_counts_tensor,recv_displacements_tensor)【免费下载链接】tensorflowAscend TensorFlow Adapter项目地址: https://gitcode.com/cann/tensorflow创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
华为CANN/tensorflow HCCL AlltoAllV算子
alltoallv【免费下载链接】tensorflowAscend TensorFlow Adapter项目地址: https://gitcode.com/cann/tensorflow功能说明集合通信算子AlltoAllV操作接口向通信域内所有rank发送数据数据量可以定制并从所有rank接收数据。函数原型def all_to_all_v(send_data, send_counts, send_displacements, recv_counts, recv_displacements, grouphccl_world_group)参数说明参数名输入/输出描述send_data输入待发送的数据TensorFlow的tensor类型。针对Ascend 950PR/Ascend 950DT支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64、bfp16。针对Atlas A3 训练系列产品/Atlas A3 推理系列产品支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64、bfp16。针对Atlas A2 训练系列产品/Atlas A2 推理系列产品支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64、bfp16。针对Atlas 训练系列产品支持数据类型int8、uint8、int16、uint16、int32、uint32、int64、uint64、float16、float32、float64 。send_counts输入发送的数据量send_counts[i]表示本rank发给rank i的数据个数基本单位是send_data数据类型对应的字节数。例send_data的数据类型为int32send_counts[0]1,send_counts[1]2表示本rank给rank0发送1个int32类型的数据给rank1发送2个int32类型的数据。TensorFlow的tensor类型tensor支持的数据类型为int64。send_displacements输入发送数据的偏移量send_displacements[i]表示本rank发送给rank i的数据块相对于send_data的偏移量基本单位是send_data数据类型对应字节数。例- send_data的数据类型为int32。- send_counts[0]1,send_counts[1]2- send_displacements[0]0,send_displacements[1]1则表示本rank给rank0发送send_data上的第1个int32类型的数据给rank1发送send_data上第2个与第3个int32类型的数据。TensorFlow的tensor类型tensor支持的数据类型为int64。recv_counts输入接收的数据量recv_counts[i]表示本rank从rank i收到的数据量。使用方法与send_counts类似。TensorFlow的tensor类型。tensor支持的数据类型为int64。recv_displacements输入接收数据的偏移量recv_displacements[i]表示本rank发送给rank i数据块相对于recv_data的偏移量基本单位是recv_data_type的字节数。使用方法与send_displacements类似。TensorFlow的tensor类型。tensor支持的数据类型为int64。group输入group名称可以为用户自定义group或者hccl_world_group。String类型最大长度为128字节含结束符。返回值对输入tensor执行完all_to_all_v操作之后的结果tensor。约束说明调用该接口的rank必须在当前接口入参group定义的范围内不在此范围内的rank调用该接口会失败。针对Atlas 训练系列产品alltoallv的通信域需要满足如下约束集群组网下单Server 1p、2p通信域要在同一个cluster内Server内0-3卡和4-7卡各为一个cluster单Server 4p、8p和多Server通信域中rank要以cluster为基本单位并且Server间cluster选取要一致。alltoallv操作的性能与NPU之间共享数据的缓存区大小有关当通信数据量超过缓存区大小时性能将出现明显下降。若业务中alltoallv通信数据量较大建议通过配置环境变量HCCL_BUFFSIZE适当增大缓存区大小以提升通信性能关于环境变量HCCL_BUFFSIZE的介绍可参见《环境变量参考》。针对Atlas 训练系列产品如果是单Server场景要求网卡的状态是“up”否则此接口会执行失败。调用示例from npu_bridge.hccl import hccl_ops send_data_tensor tf.random_uniform((1, 3), minval1, maxval10, dtypetf.float32) send_counts_tensor tf.constant([3,3],dtypetf.int64) send_displacements_tensor tf.constant([0,0],dtypetf.int64) recv_counts_tensor tf.constant([3,3],dtypetf.int64) recv_displacements_tensor tf.constant([0,0],dtypetf.int64) result hccl_ops.all_to_all_v(send_data_tensor,send_counts_tensor,send_displacements_tensor,recv_counts_tensor,recv_displacements_tensor)【免费下载链接】tensorflowAscend TensorFlow Adapter项目地址: https://gitcode.com/cann/tensorflow创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考