Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
7907b6a9
P
Paddle
项目概览
机器未来
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7907b6a9
编写于
4月 22, 2018
作者:
Q
qiaolongfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
split optimization ops on pserver to independenty blocks
上级
d89a3068
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
15 deletion
+25
-15
python/paddle/fluid/distribute_transpiler.py
python/paddle/fluid/distribute_transpiler.py
+25
-15
未找到文件。
python/paddle/fluid/distribute_transpiler.py
浏览文件 @
7907b6a9
...
...
@@ -25,6 +25,8 @@ LOOKUP_TABLE_TYPE = "lookup_table"
LOOKUP_TABLE_GRAD_TYPE
=
"lookup_table_grad"
RPC_CLIENT_VAR_NAME
=
"RPC_CLIENT_VAR"
GLOBAL_BLOCK_IDX
=
0
class
VarBlock
:
def
__init__
(
self
,
varname
,
offset
,
size
):
...
...
@@ -368,8 +370,8 @@ class DistributeTranspiler:
else
:
recv_inputs
.
append
(
single_trainer_var
)
# step3
optimize_block
=
pserver_program
.
create_block
(
0
)
optimize_block
=
None
# step 4
# Create a union-find data structure from optimize ops,
# If two ops are connected, we could add these two ops
...
...
@@ -415,29 +417,34 @@ class DistributeTranspiler:
else
:
self
.
_append_pserver_non_opt_ops
(
block
,
op
)
append_block
=
optimize_block
# append lr decay ops to the child block if exists
lr_decay_block
=
None
lr_ops
=
self
.
_get_lr_ops
()
if
len
(
lr_ops
)
>
0
:
lr_decay_block
=
pserver_program
.
create_block
(
GLOBAL_BLOCK_IDX
)
for
_
,
op
in
enumerate
(
lr_ops
):
self
.
_append_pserver_non_opt_ops
(
append_block
,
op
)
append_block
=
pserver_program
.
create_block
(
append_block
.
idx
)
self
.
_append_pserver_non_opt_ops
(
lr_decay_block
,
op
)
# append op to the current block
per_opt_block
=
append_block
per_opt_block
=
None
pre_block_idx
=
GLOBAL_BLOCK_IDX
if
lr_decay_block
is
not
None
:
pre_block_idx
=
lr_decay_block
.
idx
for
idx
,
opt_op
in
enumerate
(
opt_op_on_pserver
):
per_opt_block
=
pserver_program
.
create_block
(
pre_block_idx
)
if
optimize_block
is
None
:
optimize_block
=
per_opt_block
for
_
,
op
in
enumerate
(
self
.
optimize_ops
):
# optimizer is connected to itself
if
ufind
.
is_connected
(
op
,
opt_op
)
and
\
op
not
in
global_ops
:
if
ufind
.
is_connected
(
op
,
opt_op
)
and
op
not
in
global_ops
:
__append_optimize_op__
(
op
,
per_opt_block
)
if
idx
==
len
(
opt_op_on_pserver
)
-
1
and
global_ops
:
per_opt_block
=
pserver_program
.
create_block
(
append_block
.
idx
)
# append global ops
opt_state_block
=
None
if
global_ops
:
opt_state_block
=
pserver_program
.
create_block
(
per_opt_block
.
idx
)
for
glb_op
in
global_ops
:
__append_optimize_op__
(
glb_op
,
per_opt
_block
)
__append_optimize_op__
(
glb_op
,
opt_state
_block
)
# NOT USED: single block version:
#
...
...
@@ -451,10 +458,11 @@ class DistributeTranspiler:
prefetch_block
=
None
if
self
.
has_distributed_lookup_table
:
pserver_index
=
self
.
pserver_endpoints
.
index
(
endpoint
)
self
.
_create_table_optimize_block
(
pserver_index
,
pserver_program
,
append_block
)
table_opt_block
=
self
.
_create_table_optimize_block
(
pserver_index
,
pserver_program
,
opt_state_block
or
pserver_program
.
global_block
())
prefetch_block
=
self
.
_create_prefetch_block
(
pserver_index
,
pserver_program
,
optimize
_block
)
pserver_index
,
pserver_program
,
table_opt
_block
)
# NOTE: if has_distributed_lookup_table is False, then prefetch_block will
# not be executed, so it's safe to use optimize_block to hold the place
...
...
@@ -724,6 +732,8 @@ class DistributeTranspiler:
outputs
=
outputs
,
attrs
=
table_opt_op
.
attrs
)
return
table_opt_block
# ====================== private transpiler functions =====================
def
_create_vars_from_blocklist
(
self
,
program
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录