Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
566bbf0c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
566bbf0c
编写于
8月 15, 2022
作者:
R
Ruibiao Chen
提交者:
GitHub
8月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update FLAGS for standalone executor (#45127)
* Update FLAGS for standalone executor * Update FLAGS_FORCE_USE_PROGRAM_CACHE
上级
9aecf286
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
19 deletion
+45
-19
python/paddle/fluid/executor.py
python/paddle/fluid/executor.py
+45
-19
未找到文件。
python/paddle/fluid/executor.py
浏览文件 @
566bbf0c
...
...
@@ -394,19 +394,9 @@ def _to_name_str(var):
def
_is_enable_standalone_executor
():
"""
Whether to use experimental executor `StandaloneExecutor`.
"""
flag
=
False
from
..distributed.fleet
import
fleet
# use standalone_executor by default if not distributed
if
fleet
.
_role_maker
is
None
and
framework
.
_enable_standalone_executor_
is
None
:
framework
.
_enable_standalone_executor_
=
1
if
framework
.
_enable_standalone_executor_
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]:
flag
=
True
return
flag
return
framework
.
_enable_standalone_executor_
is
None
or
framework
.
_enable_standalone_executor_
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]
def
_prepare_fleet_executor
():
...
...
@@ -1289,6 +1279,17 @@ class Executor(object):
# [-0.44514108 -0.2345845 ]]
"""
# Temporary FLAGS, just for testing the performance of program cache
force_use_program_cache
=
os
.
environ
.
get
(
'FLAGS_FORCE_USE_PROGRAM_CACHE'
,
None
)
if
force_use_program_cache
is
not
None
:
use_program_cache
=
force_use_program_cache
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]
warnings
.
warn
(
f
"use_program_cache is force set to
{
use_program_cache
}
by FLAGS_FORCE_USE_PROGRAM_CACHE"
,
UserWarning
)
try
:
res
=
self
.
_run_impl
(
program
=
program
,
feed
=
feed
,
...
...
@@ -1399,45 +1400,70 @@ class Executor(object):
place
,
core
.
CustomPlace
):
return
False
use_standalone_executor_for_compiled_program
=
os
.
environ
.
get
(
'FLAGS_CONVERT_GRAPH_TO_PROGRAM'
,
None
)
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]
# Only support fleet when 'FLAGS_CONVERT_GRAPH_TO_PROGRAM' is set to true
from
paddle.distributed.fleet
import
fleet
if
fleet
.
_role_maker
is
not
None
and
not
use_standalone_executor_for_compiled_program
:
warnings
.
warn
(
"Standalone executor is not used for fleet"
,
UserWarning
)
return
False
compiled
=
isinstance
(
program
,
compiler
.
CompiledProgram
)
if
compiled
:
# Unsupported case 1 : the CompiledProgram is constructed by Graph
if
program
.
_program
is
None
:
warnings
.
warn
(
"Standalone executor is not used for Graph"
,
UserWarning
)
return
False
# Unsupported case 2: data parallel
if
program
.
_is_data_parallel
and
len
(
program
.
_get_places
(
place
,
program
.
_places
))
!=
1
:
warnings
.
warn
(
"Standalone executor is not used for data parallel"
,
UserWarning
)
return
False
# Unsupported case 3 : parallel graph
if
core
.
globals
()[
'FLAGS_enable_parallel_graph'
]
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]:
warnings
.
warn
(
"Standalone executor is not used for parallel graph"
,
UserWarning
)
return
False
# Unsupported case 4: inference
if
program
.
_is_inference
:
warnings
.
warn
(
"Standalone executor is not used for inference"
,
UserWarning
)
return
False
# Unsupported case 5: CUDA Graph
if
program
.
_build_strategy
is
not
None
and
program
.
_build_strategy
.
allow_cuda_graph_capture
:
warnings
.
warn
(
"Standalone executor is not used for CUDA Graph"
,
UserWarning
)
return
False
# Unsupported case 6: distributed
if
program
.
_build_strategy
is
not
None
and
(
program
.
_build_strategy
.
is_distribution
or
program
.
_build_strategy
.
num_trainers
>
1
):
warnings
.
warn
(
"Standalone executor is not used for distribution"
,
UserWarning
)
return
False
# Unsupported case 6 : disabled by FLAGS_CONVERT_GRAPH_TO_PROGRAM
if
os
.
environ
.
get
(
'FLAGS_CONVERT_GRAPH_TO_PROGRAM'
,
None
)
not
in
[
1
,
'1'
,
True
,
'True'
,
'true'
]:
return
False
return
True
return
use_standalone_executor_for_compiled_program
else
:
if
isinstance
(
program
.
_graph
,
compiler
.
CompiledProgram
):
warnings
.
warn
(
"Standalone executor is not used for Graph"
,
UserWarning
)
return
False
assert
isinstance
(
program
,
Program
)
return
True
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录