Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
8b24bd4f
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
8b24bd4f
编写于
2月 14, 2018
作者:
Y
Yang Yang(Tony)
提交者:
GitHub
2月 14, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update parallel_do.md
上级
16a8def1
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
4 addition
and
3 deletion
+4
-3
doc/design/parallel_do.md
doc/design/parallel_do.md
+4
-3
未找到文件。
doc/design/parallel_do.md
浏览文件 @
8b24bd4f
...
@@ -13,7 +13,7 @@ AddInput(kParameters, "Parameters are duplicated over different devices")
...
@@ -13,7 +13,7 @@ AddInput(kParameters, "Parameters are duplicated over different devices")
AddInput
(
kPlaces
,
"Devices used for parallel processing"
);
AddInput
(
kPlaces
,
"Devices used for parallel processing"
);
AddOutput
(
kOutputs
,
"Outputs needed to be merged from different devices"
).
AsDuplicable
();
AddOutput
(
kOutputs
,
"Outputs needed to be merged from different devices"
).
AsDuplicable
();
AddOutput
(
kParallelScopes
,
AddOutput
(
kParallelScopes
,
"
Container for all local variables in forward pass.
"
);
"
Scopes for all local variables in forward pass. One scope for each device
"
);
AddAttr
<
framework
::
BlockDesc
*>
(
kParallelBlock
,
AddAttr
<
framework
::
BlockDesc
*>
(
kParallelBlock
,
"List of operaters to be executed in parallel"
);
"List of operaters to be executed in parallel"
);
```
```
...
@@ -33,6 +33,7 @@ In the backward pass
...
@@ -33,6 +33,7 @@ In the backward pass
|||| Compute backward pass in parallel
|||| Compute backward pass in parallel
| accumulate param@grad from different devices to the first device
| accumulate param@grad from different devices to the first device
| Merge input@grad from different devices
| Merge input@grad from different devices
| Copy param@grad to the place of parallel_do_op
```
```
This implementation allows to write mixed device program like this
This implementation allows to write mixed device program like this
...
@@ -47,7 +48,7 @@ pd = ParallelDo(gpu_places)
...
@@ -47,7 +48,7 @@ pd = ParallelDo(gpu_places)
with
pd
.
do
():
with
pd
.
do
():
read_input
(
feature
)
read_input
(
feature
)
prediction
=
my_net
(
feature
)
prediction
=
my_net
(
feature
)
write_output
(
activa
tion
)
write_output
(
predic
tion
)
prediction
=
pd
()
prediction
=
pd
()
loss
=
cross_entropy
(
prediction
,
label
)
loss
=
cross_entropy
(
prediction
,
label
)
```
```
...
@@ -98,7 +99,7 @@ looks like this.
...
@@ -98,7 +99,7 @@ looks like this.
```
python
```
python
pd
=
ParallelDo
(
gpu_places
)
pd
=
ParallelDo
(
gpu_places
)
with
pd
.
do
():
with
pd
.
do
():
feature
=
pre_fetch
(
gpu_places
)
feature
=
get_data_from_prefetch_queue
(
gpu_places
)
prediction
=
my_net
(
feature
)
prediction
=
my_net
(
feature
)
write_output
(
activation
)
write_output
(
activation
)
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录