Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
c797aded
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c797aded
编写于
5月 28, 2018
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
append table grad to grad_to_block_id
上级
9f4b66f6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
13 addition
and
6 deletion
+13
-6
paddle/fluid/operators/listen_and_serv_op.cc
paddle/fluid/operators/listen_and_serv_op.cc
+1
-0
python/paddle/fluid/transpiler/distribute_transpiler.py
python/paddle/fluid/transpiler/distribute_transpiler.py
+12
-6
未找到文件。
paddle/fluid/operators/listen_and_serv_op.cc
浏览文件 @
c797aded
...
@@ -207,6 +207,7 @@ static void AsyncUpdateThread(
...
@@ -207,6 +207,7 @@ static void AsyncUpdateThread(
while
(
!
exit_flag
)
{
while
(
!
exit_flag
)
{
const
detail
::
ReceivedMessage
v
=
queue
->
Pop
();
const
detail
::
ReceivedMessage
v
=
queue
->
Pop
();
auto
recv_var_name
=
v
.
first
;
auto
recv_var_name
=
v
.
first
;
VLOG
(
4
)
<<
"async update "
<<
recv_var_name
;
auto
var
=
v
.
second
->
GetVar
();
auto
var
=
v
.
second
->
GetVar
();
if
(
var
==
nullptr
)
{
if
(
var
==
nullptr
)
{
LOG
(
ERROR
)
<<
"Can not find server side var: "
<<
recv_var_name
;
LOG
(
ERROR
)
<<
"Can not find server side var: "
<<
recv_var_name
;
...
...
python/paddle/fluid/transpiler/distribute_transpiler.py
浏览文件 @
c797aded
...
@@ -476,7 +476,7 @@ class DistributeTranspiler:
...
@@ -476,7 +476,7 @@ class DistributeTranspiler:
if
self
.
has_distributed_lookup_table
:
if
self
.
has_distributed_lookup_table
:
pserver_index
=
self
.
pserver_endpoints
.
index
(
endpoint
)
pserver_index
=
self
.
pserver_endpoints
.
index
(
endpoint
)
table_opt_block
=
self
.
_create_table_optimize_block
(
table_opt_block
=
self
.
_create_table_optimize_block
(
pserver_index
,
pserver_program
,
pre_block_idx
)
pserver_index
,
pserver_program
,
pre_block_idx
,
grad_to_block_id
)
prefetch_block
=
self
.
_create_prefetch_block
(
prefetch_block
=
self
.
_create_prefetch_block
(
pserver_index
,
pserver_program
,
table_opt_block
)
pserver_index
,
pserver_program
,
table_opt_block
)
...
@@ -688,7 +688,7 @@ class DistributeTranspiler:
...
@@ -688,7 +688,7 @@ class DistributeTranspiler:
return
prefetch_block
return
prefetch_block
def
_create_table_optimize_block
(
self
,
pserver_index
,
pserver_program
,
def
_create_table_optimize_block
(
self
,
pserver_index
,
pserver_program
,
pre_block_idx
):
pre_block_idx
,
grad_to_block_id
):
def
_clone_var
(
block
,
var
,
persistable
=
True
):
def
_clone_var
(
block
,
var
,
persistable
=
True
):
assert
isinstance
(
var
,
Variable
)
assert
isinstance
(
var
,
Variable
)
return
block
.
create_var
(
return
block
.
create_var
(
...
@@ -743,10 +743,13 @@ class DistributeTranspiler:
...
@@ -743,10 +743,13 @@ class DistributeTranspiler:
outputs
=
{
"Out"
:
[
grad_var
]})
outputs
=
{
"Out"
:
[
grad_var
]})
else
:
else
:
# in async_mode, for table gradient, it also need to be splited to each parameter server
# in async_mode, for table gradient, it also need to be splited to each parameter server
old_name
=
grad_var
.
name
origin_grad_name
=
grad_var
.
name
new_name
=
old_name
+
".pserver_"
+
str
(
pserver_index
)
splited_grad_name
=
self
.
table_grad_list
[
pserver_index
].
name
grad_var
=
pserver_program
.
global_block
().
rename_var
(
old_name
,
if
not
splited_grad_name
.
startswith
(
origin_grad_name
):
new_name
)
raise
ValueError
(
"origin_grad_var: "
+
splited_grad_name
+
" grad_var:"
+
grad_var
.
name
)
grad_var
=
pserver_program
.
global_block
().
rename_var
(
origin_grad_name
,
splited_grad_name
)
lr_var
=
pserver_program
.
global_block
().
vars
[
table_opt_op
.
input
(
lr_var
=
pserver_program
.
global_block
().
vars
[
table_opt_op
.
input
(
"LearningRate"
)[
0
]]
"LearningRate"
)[
0
]]
...
@@ -762,6 +765,9 @@ class DistributeTranspiler:
...
@@ -762,6 +765,9 @@ class DistributeTranspiler:
outputs
=
outputs
,
outputs
=
outputs
,
attrs
=
table_opt_op
.
attrs
)
attrs
=
table_opt_op
.
attrs
)
# add table parameter gradient and it's block id to grad_to_block_id
grad_to_block_id
.
append
(
grad_var
.
name
+
":"
+
str
(
table_opt_block
.
idx
))
return
table_opt_block
return
table_opt_block
# ====================== private transpiler functions =====================
# ====================== private transpiler functions =====================
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录