Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
0815c0f1
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0815c0f1
编写于
2月 10, 2018
作者:
Y
Yang Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add assign op
上级
f2129b19
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
24 addition
and
12 deletion
+24
-12
python/paddle/v2/fluid/backward.py
python/paddle/v2/fluid/backward.py
+24
-12
未找到文件。
python/paddle/v2/fluid/backward.py
浏览文件 @
0815c0f1
...
@@ -228,8 +228,6 @@ def _callback_lookup_(op):
...
@@ -228,8 +228,6 @@ def _callback_lookup_(op):
self
.
param_grad_names
=
param_grad_names
self
.
param_grad_names
=
param_grad_names
def
__call__
(
self
,
block
,
context
):
def
__call__
(
self
,
block
,
context
):
# move to parallel_do.py
# # TODO(tonyyang-svail): insert nccl init
if
not
self
.
has_inserted_nccl_init
:
if
not
self
.
has_inserted_nccl_init
:
global_block
=
block
.
program
.
global_block
()
global_block
=
block
.
program
.
global_block
()
op_desc
=
global_block
.
desc
.
append_op
()
op_desc
=
global_block
.
desc
.
append_op
()
...
@@ -250,16 +248,30 @@ def _callback_lookup_(op):
...
@@ -250,16 +248,30 @@ def _callback_lookup_(op):
for
o_param
in
current_op_desc
.
output_names
():
for
o_param
in
current_op_desc
.
output_names
():
for
o_argu
in
current_op_desc
.
output
(
o_param
):
for
o_argu
in
current_op_desc
.
output
(
o_param
):
if
o_argu
in
self
.
param_grad_names
:
if
o_argu
in
self
.
param_grad_names
:
# print("reduce", o_argu)
# # print("reduce", o_argu)
op_desc
=
block
.
desc
.
append_op
()
# op_desc = block.desc.append_op()
op_desc
.
set_type
(
"ncclAllReduce"
)
# op_desc.set_type("ncclAllReduce")
op_desc
.
set_input
(
"X"
,
[
o_argu
])
# op_desc.set_input("X", [o_argu])
# FIXME(tonyyang-svail):
#
# Looks like nccl_com has been changed to nccl_com_0
# # FIXME(tonyyang-svail):
op_desc
.
set_input
(
"Communicator"
,
[
'nccl_com_0'
])
# # Looks like nccl_com has been changed to nccl_com_0
out_var
=
block
.
create_var
()
# op_desc.set_input("Communicator", ['nccl_com_0'])
op_desc
.
set_output
(
"Out"
,
[
out_var
.
name
])
# out_var = block.create_var()
op_desc
.
set_attr
(
"reduction"
,
"ncclSum"
)
# op_desc.set_output("Out", [out_var.name])
# op_desc.set_attr("reduction", "ncclSum")
allreduce_out_name
=
o_argu
+
"__nccl_all_reduce__"
op_desc
=
_create_op_desc_
(
"ncclAllReduce"
,
{
"X"
:
[
o_argu
],
"Communicator"
:
[
'nccl_com_0'
]
},
{
"Out"
:
[
allreduce_out_name
]},
{
"reduction"
:
"ncclSum"
})
block
.
desc
.
append_op
().
copy_from
(
op_desc
)
op_desc
=
_create_op_desc_
(
"assign"
,
{
"X"
:
[
allreduce_out_name
]},
{
"Out"
:
[
o_argu
]},
{})
block
.
desc
.
append_op
().
copy_from
(
op_desc
)
return
ParallelDoCallBack
(
param_grad_names
)
return
ParallelDoCallBack
(
param_grad_names
)
else
:
else
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录