Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
364376e5
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看板
未验证
提交
364376e5
编写于
12月 06, 2021
作者:
L
Leo Chen
提交者:
GitHub
12月 06, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[new-exec] enable sequential run for debug (#37835)
* enable sequential_run for standalone_executor * add ut * fix ut
上级
dc0ec667
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
3 deletion
+28
-3
paddle/fluid/framework/new_executor/interpretercore_util.cc
paddle/fluid/framework/new_executor/interpretercore_util.cc
+17
-0
paddle/fluid/framework/new_executor/interpretercore_util.h
paddle/fluid/framework/new_executor/interpretercore_util.h
+1
-3
python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py
...d/tests/unittests/interpreter/test_standalone_executor.py
+10
-0
未找到文件。
paddle/fluid/framework/new_executor/interpretercore_util.cc
浏览文件 @
364376e5
...
...
@@ -20,9 +20,26 @@
#include "paddle/fluid/operators/controlflow/recurrent_op_helper.h"
#include "paddle/fluid/operators/controlflow/while_op_helper.h"
PADDLE_DEFINE_EXPORTED_bool
(
new_executor_sequential_run
,
false
,
"Enable sequential execution for standalone executor, used for debug"
);
namespace
paddle
{
namespace
framework
{
namespace
interpreter
{
void
AsyncWorkQueue
::
AddTask
(
const
OpFuncType
&
op_func_type
,
std
::
function
<
void
()
>
fn
)
{
// NOTE(zhiqiu): use thhe second queue of size of, so only one thread is used.
if
(
FLAGS_new_executor_sequential_run
)
{
VLOG
(
4
)
<<
"FLAGS_new_executor_sequential_run:"
<<
FLAGS_new_executor_sequential_run
;
queue_group_
->
AddTask
(
static_cast
<
size_t
>
(
OpFuncType
::
kQueueAsync
),
std
::
move
(
fn
));
}
else
{
queue_group_
->
AddTask
(
static_cast
<
size_t
>
(
op_func_type
),
std
::
move
(
fn
));
}
}
using
VariableIdMap
=
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
;
AtomicVectorSizeT
&
AsyncWorkQueue
::
PrepareAtomicDeps
(
...
...
paddle/fluid/framework/new_executor/interpretercore_util.h
浏览文件 @
364376e5
...
...
@@ -77,9 +77,7 @@ class AsyncWorkQueue {
// void WaitEmpty() { queue_group_->WaitQueueGroupEmpty(); }
void
AddTask
(
const
OpFuncType
&
op_func_type
,
std
::
function
<
void
()
>
fn
)
{
queue_group_
->
AddTask
(
static_cast
<
size_t
>
(
op_func_type
),
std
::
move
(
fn
));
}
void
AddTask
(
const
OpFuncType
&
op_func_type
,
std
::
function
<
void
()
>
fn
);
void
Cancel
()
{
queue_group_
->
Cancel
();
}
...
...
python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py
浏览文件 @
364376e5
...
...
@@ -130,6 +130,10 @@ class MultiStreamModelTestCase(unittest.TestCase):
for
gt
,
out
in
zip
(
ground_truths
,
res
):
self
.
assertEqual
(
gt
[
0
],
out
[
0
])
res_sequential
=
self
.
run_new_executor_sequential
()
for
gt
,
out
in
zip
(
ground_truths
,
res_sequential
):
self
.
assertEqual
(
gt
[
0
],
out
[
0
])
def
run_raw_executor
(
self
):
paddle
.
seed
(
2020
)
main_program
,
startup_program
,
fetch_list
=
build_program
()
...
...
@@ -158,6 +162,12 @@ class MultiStreamModelTestCase(unittest.TestCase):
np
.
array
(
inter_core
.
run
({},
fetch_list
).
_move_to_list
()[
0
]))
return
outs
def
run_new_executor_sequential
(
self
):
os
.
environ
[
'FLAGS_new_executor_sequential_run'
]
=
'1'
res
=
self
.
run_new_executor
()
del
os
.
environ
[
'FLAGS_new_executor_sequential_run'
]
return
res
class
SwitchExecutorInterfaceTestCase
(
MultiStreamModelTestCase
):
def
run_new_executor
(
self
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录