Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
1c57d554
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看板
提交
1c57d554
编写于
9月 23, 2020
作者:
M
MrChengmo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ps_graph support ps-gpu
上级
4efcb9df
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
34 addition
and
20 deletion
+34
-20
python/paddle/distributed/fleet/base/distributed_strategy.py
python/paddle/distributed/fleet/base/distributed_strategy.py
+13
-13
python/paddle/distributed/fleet/base/role_maker.py
python/paddle/distributed/fleet/base/role_maker.py
+17
-7
python/paddle/distributed/fleet/meta_optimizers/parameter_server_graph_optimizer.py
...fleet/meta_optimizers/parameter_server_graph_optimizer.py
+4
-0
未找到文件。
python/paddle/distributed/fleet/base/distributed_strategy.py
浏览文件 @
1c57d554
...
@@ -259,7 +259,7 @@ class DistributedStrategy(object):
...
@@ -259,7 +259,7 @@ class DistributedStrategy(object):
def
a_sync
(
self
,
flag
):
def
a_sync
(
self
,
flag
):
if
isinstance
(
flag
,
bool
):
if
isinstance
(
flag
,
bool
):
self
.
strategy
.
a_sync
=
flag
self
.
strategy
.
a_sync
=
flag
self
.
a_sync_configs
=
{
"k_steps"
:
0
}
self
.
a_sync_configs
=
{
"k_steps"
:
0
,
"worker_device"
:
'cpu'
}
else
:
else
:
raise
ValueError
(
raise
ValueError
(
"The type of `flag` is invalid, expected type is bool, but received %s"
.
"The type of `flag` is invalid, expected type is bool, but received %s"
.
...
...
python/paddle/distributed/fleet/base/role_maker.py
浏览文件 @
1c57d554
...
@@ -681,8 +681,12 @@ class PaddleCloudRoleMaker(RoleMakerBase):
...
@@ -681,8 +681,12 @@ class PaddleCloudRoleMaker(RoleMakerBase):
else
:
else
:
self
.
_worker_endpoints
=
[]
self
.
_worker_endpoints
=
[]
trainers_num
=
int
(
os
.
environ
[
"PADDLE_TRAINERS_NUM"
])
trainers_num
=
os
.
getenv
(
"PADDLE_TRAINERS_NUM"
,
None
)
training_role
=
os
.
environ
[
"TRAINING_ROLE"
]
assert
trainers_num
!=
None
trainers_num
=
int
(
trainers_num
)
training_role
=
os
.
getenv
(
"TRAINING_ROLE"
,
None
)
assert
training_role
!=
None
if
training_role
not
in
[
"TRAINER"
,
"PSERVER"
,
"HETER_TRAINER"
]:
if
training_role
not
in
[
"TRAINER"
,
"PSERVER"
,
"HETER_TRAINER"
]:
raise
ValueError
(
raise
ValueError
(
...
@@ -716,19 +720,25 @@ class PaddleCloudRoleMaker(RoleMakerBase):
...
@@ -716,19 +720,25 @@ class PaddleCloudRoleMaker(RoleMakerBase):
if
training_role
==
"TRAINER"
:
if
training_role
==
"TRAINER"
:
role
=
Role
.
WORKER
role
=
Role
.
WORKER
current_id
=
int
(
os
.
environ
[
"PADDLE_TRAINER_ID"
])
current_id
=
os
.
getenv
(
"PADDLE_TRAINER_ID"
,
None
)
assert
current_id
!=
None
current_id
=
int
(
current_id
)
if
len
(
self
.
_worker_endpoints
)
>
0
:
if
len
(
self
.
_worker_endpoints
)
>
0
:
self
.
_cur_endpoint
=
self
.
_worker_endpoints
[
current_id
]
self
.
_cur_endpoint
=
self
.
_worker_endpoints
[
current_id
]
elif
training_role
==
"PSERVER"
:
elif
training_role
==
"PSERVER"
:
role
=
Role
.
SERVER
role
=
Role
.
SERVER
port
=
os
.
environ
[
"PADDLE_PORT"
]
port
=
os
.
getenv
(
"PADDLE_PORT"
,
None
)
ip
=
os
.
environ
[
"POD_IP"
]
assert
port
!=
None
ip
=
os
.
getenv
(
"POD_IP"
,
None
)
assert
ip
!=
None
self
.
_cur_endpoint
=
ip
+
":"
+
port
self
.
_cur_endpoint
=
ip
+
":"
+
port
current_id
=
self
.
_server_endpoints
.
index
(
self
.
_cur_endpoint
)
current_id
=
self
.
_server_endpoints
.
index
(
self
.
_cur_endpoint
)
elif
training_role
==
"HETER_TRAINER"
:
elif
training_role
==
"HETER_TRAINER"
:
role
=
Role
.
HETER_WORKER
role
=
Role
.
HETER_WORKER
cur_ip
=
os
.
environ
[
"POD_IP"
]
cur_port
=
os
.
getenv
(
"PADDLE_PORT"
,
None
)
cur_port
=
os
.
environ
[
"PADDLE_PORT"
]
assert
port
!=
None
cur_ip
=
os
.
getenv
(
"POD_IP"
,
None
)
assert
cur_ip
!=
None
curr_endpoint
=
":"
.
join
([
cur_ip
,
cur_port
])
curr_endpoint
=
":"
.
join
([
cur_ip
,
cur_port
])
current_id
=
heter_trainer_eplist
.
index
(
curr_endpoint
)
current_id
=
heter_trainer_eplist
.
index
(
curr_endpoint
)
else
:
else
:
...
...
python/paddle/distributed/fleet/meta_optimizers/parameter_server_graph_optimizer.py
浏览文件 @
1c57d554
...
@@ -31,6 +31,10 @@ class ParameterServerGraphOptimizer(ParameterServerOptimizer):
...
@@ -31,6 +31,10 @@ class ParameterServerGraphOptimizer(ParameterServerOptimizer):
if
k_steps
<
0
:
if
k_steps
<
0
:
return
False
return
False
device
=
self
.
user_defined_strategy
.
a_sync_configs
[
"worker_device"
]
if
device
.
upper
()
!=
'CPU'
:
return
False
if
self
.
role_maker
.
_is_server
():
if
self
.
role_maker
.
_is_server
():
return
False
return
False
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录