Skip to content

Commit e0310be

Browse files
committed
add stream.all_reduce
1 parent a9d33f7 commit e0310be

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

docs/api/paddle/distributed/Overview_cn.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,17 @@ paddle.distributed.fleet 是分布式训练的统一入口 API,用于配置分
8787
" :ref:`scatter <cn_api_distributed_scatter>` ", "分发 tensor 到每个进程"
8888
" :ref:`split <cn_api_distributed_split>` ", "切分参数到多个设备"
8989
" :ref:`barrier <cn_api_distributed_barrier>` ", "同步路障,进行阻塞操作,实现组内所有进程的同步"
90+
91+
.. _05:
92+
93+
高级集合通信算法 API
94+
::::::::::::::::::::::
95+
96+
在集群上,对多设备的进程组的参数数据 tensor 进行计算处理。
97+
98+
.. csv-table::
99+
:header: "API 名称", "API 功能"
100+
:widths: 20, 50
101+
102+
103+
" :ref:`all_reduce <cn_api_distributed_stream_all_reduce>` ", "组规约,规约进程组内的 tensor,结果广播至每个进程"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.. _cn_api_distributed_stream_all_reduce:
2+
3+
all_reduce
4+
-------------------------------
5+
6+
7+
.. py:function:: paddle.distributed.stream.all_reduce(tensor, op=ReduceOp.SUM, group=None, sync_op=True, use_calc_stream=False)
8+
9+
和 paddle.distributed.all_reduce 的语义相同,进程组内的所有进程在指定 tensor 上所特定的归约操作 (如 sum,reduce 等)。
10+
11+
12+
参数
13+
:::::::::
14+
- tensor (Tensor) - 操作的输入 Tensor,同时也会将归约结果返回至此 Tensor 中。Tensor 的数据类型为:float16、float32、float64、int32、int64。
15+
- op (ReduceOp.SUM|ReduceOp.MAX|ReduceOp.MIN|ReduceOp.PROD,可选) - 归约的具体操作,比如求和,取最大值,取最小值和求乘积,默认为求和归约。
16+
- group (Group,可选) - 在指定通信组中做通信,是可选参数,默认使用全局通信组。
17+
- sync_op (bool, 可选) - 表示做同步或者异步通信,默认进行同步通信。
18+
- use_calc_stream (bool, 可选) - 表示是否在计算流上做通信,默认在通信流上进行通信。
19+
20+
返回
21+
:::::::::
22+
返回一个 task 对象。
23+
24+
警告
25+
:::::::::
26+
该 API 目前只支持在动态图下使用
27+
28+
代码示例
29+
:::::::::
30+
COPY-FROM: paddle.distributed.communication.stream.all_reduce

0 commit comments

Comments
 (0)