mindspore/docs/api/api_python/ops/mindspore.ops.AlltoAll.rst

44 lines
1.9 KiB
ReStructuredText
Raw Normal View History

mindspore.ops.AlltoAll
======================
2022-09-08 15:23:05 +08:00
.. py:class:: mindspore.ops.AlltoAll(split_count, split_dim, concat_dim, group=GlobalComm.WORLD_COMM_GROUP)
AlltoAll是一个集合通信函数。
AlltoAll将输入数据在特定的维度切分成特定的块数blocks并按顺序发送给其他rank。一般有两个阶段
2022-09-09 14:31:17 +08:00
- 分发阶段:在每个进程上,操作数沿着 `split_dim` 拆分为 `split_count` 个块blocks且分发到指定的rank上例如第i块被发送到第i个rank上。
- 聚合阶段每个rank沿着 `concat_dimension` 拼接接收到的数据。
.. note::
2022-11-08 10:26:50 +08:00
聚合阶段所有进程中的Tensor必须具有相同的shape和格式。
要求全连接配网方式每台设备具有相同的vlan idip和mask在同一子网请查看 `详细信息 <https://www.mindspore.cn/tutorials/experts/zh-CN/master/parallel/communicate_ops.html#注意事项>`_
参数:
- **split_count** (int) - 在每个进程上将块blocks拆分为 `split_count` 个。
- **split_dim** (int) - 在每个进程上,沿着 `split_dim` 维度进行拆分。
- **concat_dim** (int) - 在每个进程上,沿着 `concat_dimension` 拼接接收到的块blocks
- **group** (str) - AlltoAll的通信域。默认值"GlobalComm.WORLD_COMM_GROUP"。
2022-10-08 17:22:10 +08:00
输入:
- **input_x** (Tensor) - shape为 :math:`(x_1, x_2, ..., x_R)`
2022-10-08 17:22:10 +08:00
输出:
2022-09-27 16:28:21 +08:00
Tensor设输入的shape是 :math:`(x_1, x_2, ..., x_R)`则输出的shape为 :math:`(y_1, y_2, ..., y_R)`,其中:
:math:`y_{split\_dim} = x_{split\_dim} / split\_count`
:math:`y_{concat\_dim} = x_{concat\_dim} * split\_count`
:math:`y_other = x_other`.
异常:
- **TypeError** - 如果 `group` 不是字符串。
2022-11-08 10:26:50 +08:00
样例:
.. note::
.. include:: mindspore.ops.comm_note.rst
该样例需要在8卡环境下运行。