Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
27e85625
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
27e85625
编写于
8月 19, 2019
作者:
K
kh2se2013
提交者:
gongweibao
8月 19, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add python coverage launch when WITH_COVERAGE=ON (#19264)
add python coverage launch when WITH_COVERAGE=ON
上级
af0fbd90
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
5 deletion
+34
-5
python/paddle/fluid/tests/unittests/test_dist_base.py
python/paddle/fluid/tests/unittests/test_dist_base.py
+34
-5
未找到文件。
python/paddle/fluid/tests/unittests/test_dist_base.py
浏览文件 @
27e85625
...
@@ -495,7 +495,14 @@ class TestDistBase(unittest.TestCase):
...
@@ -495,7 +495,14 @@ class TestDistBase(unittest.TestCase):
def
start_pserver
(
self
,
model_file
,
check_error_log
,
required_envs
):
def
start_pserver
(
self
,
model_file
,
check_error_log
,
required_envs
):
ps0_ep
,
ps1_ep
=
self
.
_ps_endpoints
.
split
(
","
)
ps0_ep
,
ps1_ep
=
self
.
_ps_endpoints
.
split
(
","
)
ps_cmd
=
"%s %s --role pserver --endpoints %s --trainer_id 0 --current_endpoint %s --trainers %d --update_method pserver"
ps_cmd
=
"%s"
if
os
.
getenv
(
'WITH_COVERAGE'
,
'OFF'
)
==
'ON'
:
required_envs
[
'COVERAGE_FILE'
]
=
os
.
getenv
(
'COVERAGE_FILE'
,
''
)
ps_cmd
+=
" -m coverage run --branch -p"
ps_cmd
+=
" %s --role pserver --endpoints %s --trainer_id 0 --current_endpoint %s --trainers %d --update_method pserver"
ps0_cmd
=
ps_cmd
%
\
ps0_cmd
=
ps_cmd
%
\
(
self
.
_python_interp
,
model_file
,
self
.
_ps_endpoints
,
ps0_ep
,
(
self
.
_python_interp
,
model_file
,
self
.
_ps_endpoints
,
ps0_ep
,
self
.
_trainers
)
self
.
_trainers
)
...
@@ -534,8 +541,14 @@ class TestDistBase(unittest.TestCase):
...
@@ -534,8 +541,14 @@ class TestDistBase(unittest.TestCase):
batch_size
=
DEFAULT_BATCH_SIZE
,
batch_size
=
DEFAULT_BATCH_SIZE
,
batch_merge_repeat
=
1
):
batch_merge_repeat
=
1
):
cmd
=
"%s %s --role trainer --lr %f"
%
(
self
.
_python_interp
,
model
,
cmd
=
self
.
_python_interp
self
.
_lr
)
if
os
.
getenv
(
'WITH_COVERAGE'
,
'OFF'
)
==
'ON'
:
envs
[
'COVERAGE_FILE'
]
=
os
.
getenv
(
'COVERAGE_FILE'
,
''
)
cmd
+=
" -m coverage run --branch -p"
cmd
+=
" %s --role trainer --lr %f"
%
(
model
,
self
.
_lr
)
if
batch_size
!=
DEFAULT_BATCH_SIZE
:
if
batch_size
!=
DEFAULT_BATCH_SIZE
:
cmd
+=
" --batch_size %d"
%
batch_size
cmd
+=
" --batch_size %d"
%
batch_size
if
batch_merge_repeat
>
1
:
if
batch_merge_repeat
>
1
:
...
@@ -587,7 +600,14 @@ class TestDistBase(unittest.TestCase):
...
@@ -587,7 +600,14 @@ class TestDistBase(unittest.TestCase):
ps0_ep
,
ps1_ep
=
self
.
_ps_endpoints
.
split
(
","
)
ps0_ep
,
ps1_ep
=
self
.
_ps_endpoints
.
split
(
","
)
tr_cmd
=
"%s %s --role trainer --endpoints %s --trainer_id %d --current_endpoint %s --trainers %d --update_method pserver --lr %f"
tr_cmd
=
"%s"
if
os
.
getenv
(
'WITH_COVERAGE'
,
'OFF'
)
==
'ON'
:
envs
[
'COVERAGE_FILE'
]
=
os
.
getenv
(
'COVERAGE_FILE'
,
''
)
tr_cmd
+=
" -m coverage run --branch -p"
tr_cmd
+=
" %s --role trainer --endpoints %s --trainer_id %d --current_endpoint %s --trainers %d --update_method pserver --lr %f"
tr0_cmd
=
tr_cmd
%
\
tr0_cmd
=
tr_cmd
%
\
(
self
.
_python_interp
,
model
,
self
.
_ps_endpoints
,
(
self
.
_python_interp
,
model
,
self
.
_ps_endpoints
,
0
,
ps0_ep
,
self
.
_trainers
,
self
.
_lr
)
0
,
ps0_ep
,
self
.
_trainers
,
self
.
_lr
)
...
@@ -663,7 +683,13 @@ class TestDistBase(unittest.TestCase):
...
@@ -663,7 +683,13 @@ class TestDistBase(unittest.TestCase):
def
_get_nccl2_trainer_cmd
(
self
,
model
,
ep
,
update_method
,
trainer_id
,
def
_get_nccl2_trainer_cmd
(
self
,
model
,
ep
,
update_method
,
trainer_id
,
trainer_num
):
trainer_num
):
env
=
{}
env
=
{}
tr_cmd
=
"%s -u %s --role trainer --endpoints %s --trainer_id %d --current_endpoint %s --update_method %s --lr %f"
tr_cmd
=
"%s -u"
if
os
.
getenv
(
'WITH_COVERAGE'
,
'OFF'
)
==
'ON'
:
tr_cmd
+=
" -m coverage run --branch -p"
tr_cmd
+=
" %s --role trainer --endpoints %s --trainer_id %d --current_endpoint %s --update_method %s --lr %f"
tr_cmd
=
tr_cmd
%
\
tr_cmd
=
tr_cmd
%
\
(
self
.
_python_interp
,
model
,
self
.
_ps_endpoints
,
(
self
.
_python_interp
,
model
,
self
.
_ps_endpoints
,
trainer_id
,
ep
,
update_method
,
self
.
_lr
)
trainer_id
,
ep
,
update_method
,
self
.
_lr
)
...
@@ -702,6 +728,9 @@ class TestDistBase(unittest.TestCase):
...
@@ -702,6 +728,9 @@ class TestDistBase(unittest.TestCase):
if
self
.
_gpu_fleet_api
:
if
self
.
_gpu_fleet_api
:
tr_cmd
+=
" --gpu_fleet_api"
tr_cmd
+=
" --gpu_fleet_api"
if
os
.
getenv
(
'WITH_COVERAGE'
,
'OFF'
)
==
'ON'
:
env
[
'COVERAGE_FILE'
]
=
os
.
getenv
(
'COVERAGE_FILE'
,
''
)
return
tr_cmd
,
env
return
tr_cmd
,
env
def
_run_cluster_nccl2
(
self
,
model
,
envs
,
nccl2_reduce_layer
,
def
_run_cluster_nccl2
(
self
,
model
,
envs
,
nccl2_reduce_layer
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录