Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
e665655c
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看板
提交
e665655c
编写于
9月 23, 2020
作者:
M
mapingshuo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move _wait to end
上级
21a276b6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
3 deletion
+18
-3
python/paddle/distributed/fleet/meta_optimizers/common.py
python/paddle/distributed/fleet/meta_optimizers/common.py
+6
-0
python/paddle/distributed/fleet/meta_optimizers/zero_optimizer.py
...addle/distributed/fleet/meta_optimizers/zero_optimizer.py
+12
-3
未找到文件。
python/paddle/distributed/fleet/meta_optimizers/common.py
浏览文件 @
e665655c
...
...
@@ -99,6 +99,12 @@ class CollectiveHelper(object):
OP_ROLE_KEY
:
OpRole
.
Forward
})
def
_wait
(
self
,
current_endpoint
,
endpoints
,
wait_port
):
assert
(
wait_port
)
other_endpoints
=
endpoints
[:]
other_endpoints
.
remove
(
current_endpoint
)
wait_server_ready
(
other_endpoints
)
def
_broadcast_params
(
self
):
block
=
self
.
startup_program
.
global_block
()
ring_id
=
-
1
...
...
python/paddle/distributed/fleet/meta_optimizers/zero_optimizer.py
浏览文件 @
e665655c
...
...
@@ -196,6 +196,7 @@ class ZeroOptimizer(MetaOptimizerBase):
core
.
VarDesc
.
VarType
.
BOOL
:
1
,
core
.
VarDesc
.
VarType
.
UINT8
:
1
,
}
self
.
_collective_helper
=
None
def
_get_var_size
(
self
,
param
):
"""
...
...
@@ -778,11 +779,12 @@ class ZeroOptimizer(MetaOptimizerBase):
print
(
"work idx: "
,
self
.
role_maker
.
_worker_index
())
endpoints
=
self
.
role_maker
.
_get_trainer_endpoints
()
current_endpoint
=
endpoints
[
self
.
role_maker
.
_worker_index
()]
collective_helper
=
CollectiveHelper
(
self
.
role_maker
,
self
.
_nrings
)
self
.
_collective_helper
=
CollectiveHelper
(
self
.
role_maker
,
self
.
_nrings
)
for
ring_id
in
range
(
self
.
_nrings
):
collective_helper
.
_init_communicator
(
self
.
_
collective_helper
.
_init_communicator
(
self
.
_startup_program
,
current_endpoint
,
endpoints
,
self
.
role_maker
.
_worker_index
(),
ring_id
,
'6174'
)
self
.
role_maker
.
_worker_index
(),
ring_id
,
None
)
startup_block
=
self
.
_startup_program
.
global_block
()
startup_block
.
_sync_with_cpp
()
...
...
@@ -794,6 +796,12 @@ class ZeroOptimizer(MetaOptimizerBase):
self
.
_fp16_params
,
self
.
_broadcast_vars
,
self
.
_fp16_to_params
=
self
.
_find_broadcast_params
(
self
.
_params
,
self
.
_param2device
)
def
_wait
(
self
,
):
endpoints
=
self
.
role_maker
.
_get_trainer_endpoints
()
current_endpoint
=
endpoints
[
self
.
role_maker
.
_worker_index
()]
if
self
.
role_maker
.
_worker_index
()
==
0
:
self
.
_collective_helper
.
_wait
(
current_endpoint
,
endpoints
,
'6174'
)
def
minimize_impl
(
self
,
loss
,
startup_program
=
None
,
...
...
@@ -855,6 +863,7 @@ class ZeroOptimizer(MetaOptimizerBase):
# check op dependecy for broadcast
self
.
_check_broadcast
(
main_block
)
self
.
_wait
()
return
optimize_ops
,
params_grads
def
_check_broadcast
(
self
,
block
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录