Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
59dd97af
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
59dd97af
编写于
6月 26, 2023
作者:
R
Ruibiao Chen
提交者:
GitHub
6月 26, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Share workqueue cross-interpretercores (#54780)
* Share workqueue cross-interpretercores * Fix UT
上级
05bd4a89
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
26 addition
and
7 deletion
+26
-7
paddle/fluid/framework/new_executor/standalone_executor.cc
paddle/fluid/framework/new_executor/standalone_executor.cc
+13
-3
paddle/fluid/framework/new_executor/standalone_executor.h
paddle/fluid/framework/new_executor/standalone_executor.h
+2
-1
test/standalone_executor/test_standalone_executor_multi_micro_batch.py
...ne_executor/test_standalone_executor_multi_micro_batch.py
+11
-3
未找到文件。
paddle/fluid/framework/new_executor/standalone_executor.cc
浏览文件 @
59dd97af
...
...
@@ -72,12 +72,11 @@ StandaloneExecutor::StandaloneExecutor(const platform::Place& place,
auto
kernel_program
=
paddle
::
dialect
::
PdOpLowerToKernelPass
(
base_program
.
get
());
interpretercores_
.
emplace_back
(
std
::
make_unique
<
InterpreterCore
>
(
interpretercores_
.
emplace_back
(
std
::
make_shared
<
InterpreterCore
>
(
place_
,
std
::
move
(
kernel_program
),
scope_
,
execution_config
));
}
else
{
interpretercores_
.
emplace_back
(
std
::
make_
unique
<
InterpreterCore
>
(
place_
,
std
::
make_
shared
<
InterpreterCore
>
(
place_
,
program
->
Block
(
0
),
micro_batch_scopes_
[
micro_batch_id
],
execution_config
));
...
...
@@ -100,6 +99,17 @@ paddle::framework::FetchList StandaloneExecutor::Run(
}
const
auto
&
jobs
=
plan_
.
JobList
();
if
(
!
is_interpretercore_build_result_shared_
)
{
for
(
size_t
job_idx
=
1
;
job_idx
<
jobs
.
size
();
++
job_idx
)
{
interpretercores_
[
job_idx
]
->
ShareWorkQueueFrom
(
interpretercores_
[
0
]);
// TODO(Ruibiao): Share other build result, e.g., kernel choosing, data
// transfer, op dependency, thread scheduling, GC, event analyzer, and so
// on.
}
is_interpretercore_build_result_shared_
=
true
;
}
for
(
size_t
job_idx
=
0
;
job_idx
<
jobs
.
size
();
++
job_idx
)
{
const
auto
&
job
=
jobs
[
job_idx
];
const
std
::
string
&
job_type
=
job
->
Type
();
...
...
paddle/fluid/framework/new_executor/standalone_executor.h
浏览文件 @
59dd97af
...
...
@@ -42,11 +42,12 @@ class StandaloneExecutor {
paddle
::
framework
::
FetchList
Run
(
const
std
::
vector
<
std
::
string
>&
feed_names
);
private:
bool
is_interpretercore_build_result_shared_
{
false
};
const
platform
::
Place
place_
;
const
interpreter
::
Plan
plan_
;
std
::
vector
<
framework
::
Scope
*>
micro_batch_scopes_
;
std
::
vector
<
std
::
unique
_ptr
<
InterpreterCore
>>
interpretercores_
;
std
::
vector
<
std
::
shared
_ptr
<
InterpreterCore
>>
interpretercores_
;
Scope
*
scope_
;
};
...
...
test/standalone_executor/test_standalone_executor_multi_micro_batch.py
浏览文件 @
59dd97af
...
...
@@ -13,6 +13,7 @@
# limitations under the License.
import
platform
import
unittest
import
numpy
as
np
...
...
@@ -214,6 +215,15 @@ class TestEncorderMulitMicroBatchRun(unittest.TestCase):
return
res
def
check_result
(
self
,
expected_result
,
actual_result
):
# FIXME(Ruibiao): The output result of Encorder layers is unstable in some case.
if
self
.
place
.
is_cpu_place
()
or
platform
.
system
().
lower
()
==
"windows"
:
np
.
testing
.
assert_allclose
(
expected_result
,
actual_result
,
atol
=
1e-6
,
rtol
=
1e-6
)
else
:
np
.
testing
.
assert_equal
(
expected_result
,
actual_result
)
def
test_multi_micro_batch_run
(
self
):
last_res
=
None
...
...
@@ -222,9 +232,7 @@ class TestEncorderMulitMicroBatchRun(unittest.TestCase):
res
=
self
.
run_train
(
split
,
micro_batch_num
)
if
last_res
:
for
i
in
range
(
len
(
res
)):
np
.
testing
.
assert_allclose
(
last_res
[
i
],
res
[
i
],
atol
=
1e-6
,
rtol
=
1e-6
)
self
.
check_result
(
last_res
[
i
],
res
[
i
])
last_res
=
res
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录