Skip to content

Commit eb284d1

Browse files
authored
Add collective communication API docs (#5534)
* docs: broadcast_object_list & scatter_object_list * docs: get_backend & is_available
1 parent 274d2a2 commit eb284d1

File tree

5 files changed

+99
-1
lines changed

5 files changed

+99
-1
lines changed

docs/api/paddle/distributed/Overview_cn.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ Fleet 分布式高层 API
4848
:header: "API 名称", "API 功能"
4949
:widths: 20, 50
5050

51-
51+
" :ref:`is_available <cn_api_distributed_is_available>` ", "检查分布式环境是否可用"
5252
" :ref:`init_parallel_env <cn_api_distributed_init_parallel_env>` ", "初始化并行训练环境,支持动态图模式"
5353
" :ref:`launch <cn_api_distributed_launch>` ", "启动分布式训练进程,支持集合通信及参数服务器架构"
5454
" :ref:`spawn <cn_api_distributed_spawn>` ", "启动分布式训练进程,仅支持集合通信架构"
5555
" :ref:`get_rank <cn_api_distributed_get_rank>` ", "获取当前进程的 rank 值"
5656
" :ref:`get_world_size <cn_api_distributed_get_world_size>` ", "获取当前进程数"
5757
" :ref:`new_group <cn_api_distributed_new_group>` ", "创建分布式通信组"
5858
" :ref:`destroy_process_group <cn_api_distributed_destroy_process_group>` ", "销毁分布式通信组"
59+
" :ref:`get_backend <cn_api_distributed_get_backend>` ", "获取指定分布式通信组后端的名称"
5960

6061
.. _03:
6162

@@ -89,7 +90,9 @@ Fleet 分布式高层 API
8990
" :ref:`alltoall <cn_api_distributed_alltoall>` ", "将一组 tensor 分发到每个进程并进行聚合"
9091
" :ref:`alltoall_single <cn_api_distributed_alltoall_single>` ", "将一个 tensor 分发到每个进程并进行聚合"
9192
" :ref:`broadcast <cn_api_distributed_broadcast>` ", "将一个 tensor 发送到每个进程"
93+
" :ref:`broadcast_object_list <cn_api_distributed_broadcast_object_list>` ", "将一组 object 发送到每个进程"
9294
" :ref:`scatter <cn_api_distributed_scatter>` ", "将一组 tensor 分发到每个进程"
95+
" :ref:`scatter_object_list <cn_api_distributed_scatter_object_list>` ", "将一组 object 分发到每个进程"
9396
" :ref:`reduce_scatter <cn_api_distributed_reduce_scatter>` ", "规约一组 tensor,随后将规约结果分发到每个进程"
9497
" :ref:`isend <cn_api_distributed_isend>` ", "异步发送一个 tensor 到指定进程"
9598
" :ref:`irecv <cn_api_distributed_irecv>` ", "异步接收一个来自指定进程的 tensor"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. _cn_api_distributed_broadcast_object_list:
2+
3+
broadcast_object_list
4+
-------------------------------
5+
6+
7+
.. py:function:: paddle.distributed.broadcast_object_list(object_list, src, group=None)
8+
9+
将一个 picklable 对象发送到每个进程。
10+
过程与 ``broadcast`` 类似,但可以传入自定义的 python 对象。
11+
12+
.. note::
13+
该 API 只支持动态图模式。
14+
15+
参数
16+
:::::::::
17+
- **object_list** (List[Any]) - 在目标进程上为待广播的 object 列表,在其他进程上为用于接收广播结果的 object 列表。
18+
- **src** (int) - 目标进程的 rank,该进程传入的 object 列表将被发送到其他进程上。
19+
- **group** (Group,可选) - 执行该操作的进程组实例(通过 ``new_group`` 创建)。默认为 None,即使用全局默认进程组。
20+
21+
返回
22+
:::::::::
23+
无返回值。
24+
25+
代码示例
26+
:::::::::
27+
COPY-FROM: paddle.distributed.broadcast_object_list
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. _cn_api_distributed_get_backend:
2+
3+
get_backend
4+
-------------------------------
5+
6+
.. py:function:: paddle.distributed.get_backend(group=None)
7+
8+
获取指定分布式通信组后端的名称。
9+
10+
参数
11+
:::::::::
12+
- **group** (Group,可选) - 指定的通信组。默认为 None,即使用全局默认进程组。
13+
14+
返回
15+
:::::::::
16+
``str``,通信组后端的名称。
17+
18+
代码示例
19+
::::::::::::
20+
COPY-FROM: paddle.distributed.get_backend
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.. _cn_api_distributed_is_available:
2+
3+
is_available
4+
-------------------------------
5+
6+
.. py:function:: paddle.distributed.is_available()
7+
8+
检查分布式环境是否可用。
9+
10+
参数
11+
:::::::::
12+
13+
14+
返回
15+
:::::::::
16+
``bool``,如果分布式环境可用,返回 True;反之返回 False。
17+
18+
代码示例
19+
:::::::::
20+
COPY-FROM: paddle.distributed.is_available
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _cn_api_distributed_scatter_object_list:
2+
3+
scatter_object_list
4+
-------------------------------
5+
6+
7+
.. py:function:: paddle.distributed.scatter_object_list(out_object_list, in_object_list, src=0, group=None)
8+
9+
将一组来自指定进程的 picklable 对象分发到每个进程
10+
过程与 ``scatter`` 类似,但可以传入自定义的 python 对象。
11+
12+
.. note::
13+
该 API 只支持动态图模式。
14+
15+
参数
16+
:::::::::
17+
- **out_object_list** (List[Any]) - 用于接收数据的 object 列表。
18+
- **in_object_list** (List[Any],可选) - 将被分发的 object 列表。默认为 None,因为 rank != src 的进程上的该参数将被忽略。
19+
- **src** (int,可选) - 目标进程的 rank,该进程的 object 列表将被分发到其他进程中。默认为 0,即分发 rank=0 的进程上的 object 列表。
20+
- **group** (Group,可选) - 执行该操作的进程组实例(通过 ``new_group`` 创建)。默认为 None,即使用全局默认进程组。
21+
22+
返回
23+
:::::::::
24+
无返回值。
25+
26+
代码示例
27+
:::::::::
28+
COPY-FROM: paddle.distributed.scatter_object_list

0 commit comments

Comments
 (0)