Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OPTHREE
Paddle
提交
621d3e0b
P
Paddle
项目概览
OPTHREE
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
621d3e0b
编写于
1月 11, 2020
作者:
W
wangchaochaohu
提交者:
GitHub
1月 11, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the bug of profile update (#22207)
* fix the bug of profile update test=develop
上级
443a713c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
17 addition
and
10 deletion
+17
-10
paddle/fluid/framework/operator.cc
paddle/fluid/framework/operator.cc
+4
-4
paddle/fluid/platform/profiler.cc
paddle/fluid/platform/profiler.cc
+13
-6
未找到文件。
paddle/fluid/framework/operator.cc
浏览文件 @
621d3e0b
...
...
@@ -167,7 +167,7 @@ void OperatorBase::Run(const Scope& scope, const platform::Place& place) {
}
{
platform
::
RecordEvent
record_event
(
Type
()
+
"_op"
);
platform
::
RecordEvent
record_event
(
Type
());
RunImpl
(
scope
,
place
);
}
...
...
@@ -950,7 +950,7 @@ void OperatorWithKernel::RunImpl(const Scope& scope,
std
::
vector
<
std
::
string
>
transfered_inplace_vars
;
Scope
*
transfer_scope
=
nullptr
;
{
platform
::
RecordEvent
record_event
(
"prepare_data"
);
platform
::
RecordEvent
record_event
(
"prepare_data
_inner_op
"
);
transfer_scope
=
PrepareData
(
scope
,
*
kernel_type_
,
&
transfered_inplace_vars
,
runtime_ctx
);
}
...
...
@@ -963,7 +963,7 @@ void OperatorWithKernel::RunImpl(const Scope& scope,
}
if
(
!
all_kernels_must_compute_runtime_shape_
)
{
platform
::
RecordEvent
record_event
(
"infer_shape"
);
platform
::
RecordEvent
record_event
(
"infer_shape
_inner_op
"
);
RuntimeInferShapeContext
infer_shape_ctx
(
*
this
,
*
runtime_ctx
);
this
->
InferShape
(
&
infer_shape_ctx
);
}
...
...
@@ -975,7 +975,7 @@ void OperatorWithKernel::RunImpl(const Scope& scope,
// TODO(panyx0718): ExecutionContext should only depend on RuntimeContext
// not Scope. Imperative mode only pass inputs and get outputs.
{
platform
::
RecordEvent
record_event
(
"compute"
);
platform
::
RecordEvent
record_event
(
"compute
_inner_op
"
);
(
*
kernel_func_
)(
ExecutionContext
(
*
this
,
exec_scope
,
*
dev_ctx
,
*
runtime_ctx
,
kernel_configs
));
}
...
...
paddle/fluid/platform/profiler.cc
浏览文件 @
621d3e0b
...
...
@@ -372,12 +372,13 @@ void PrintProfiler(const std::vector<std::vector<EventItem>> &events_table,
std
::
vector
<
std
::
vector
<
EventItem
>>
child_table
;
std
::
vector
<
EventItem
>
table
;
bool
do_next
=
false
;
std
::
string
op_end_str
=
"_op"
;
std
::
string
op_end_str
=
"
inner
_op"
;
for
(
auto
it
=
child_map
.
begin
();
it
!=
child_map
.
end
();
it
++
)
{
if
(
it
->
first
==
event_item
.
name
)
{
table
.
push_back
(
it
->
second
);
do_next
=
it
->
second
.
name
.
rfind
(
op_end_str
)
==
(
it
->
second
.
name
.
length
()
-
op_end_str
.
length
());
if
(
!
do_next
)
do_next
=
!
(
it
->
second
.
name
.
rfind
(
op_end_str
)
==
(
it
->
second
.
name
.
length
()
-
op_end_str
.
length
()));
}
}
child_table
.
push_back
(
table
);
...
...
@@ -579,6 +580,7 @@ void ParseEvents(const std::vector<std::vector<Event>> &events,
std
::
vector
<
EventItem
>
event_items
;
std
::
vector
<
EventItem
>
main_event_items
;
std
::
unordered_map
<
std
::
string
,
int
>
event_idx
;
std
::
multimap
<
std
::
string
,
EventItem
>
sub_child_map
;
for
(
size_t
j
=
0
;
j
<
(
*
analyze_events
)[
i
].
size
();
j
++
)
{
Event
analyze_event
=
(
*
analyze_events
)[
i
][
j
];
...
...
@@ -599,7 +601,7 @@ void ParseEvents(const std::vector<std::vector<Event>> &events,
(
cname
[
fname
.
length
()]
==
'/'
&&
cname
.
rfind
(
'/'
)
==
fname
.
length
());
if
(
condition
)
{
child_map
.
insert
(
sub_
child_map
.
insert
(
std
::
pair
<
std
::
string
,
EventItem
>
(
fname
,
event_items
[
k
]));
child_index
[
k
]
=
1
;
}
...
...
@@ -618,9 +620,9 @@ void ParseEvents(const std::vector<std::vector<Event>> &events,
item
.
ave_time
=
item
.
total_time
/
item
.
calls
;
item
.
ratio
=
item
.
total_time
/
total
;
}
for
(
auto
it
=
child_map
.
begin
();
it
!=
child_map
.
end
();
it
++
)
{
for
(
auto
it
=
sub_child_map
.
begin
();
it
!=
sub_
child_map
.
end
();
it
++
)
{
it
->
second
.
ratio
=
it
->
second
.
total_time
/
total
;
it
->
second
.
ave_time
=
it
->
second
.
ave
_time
/
it
->
second
.
calls
;
it
->
second
.
ave_time
=
it
->
second
.
total
_time
/
it
->
second
.
calls
;
}
// sort
...
...
@@ -636,6 +638,11 @@ void ParseEvents(const std::vector<std::vector<Event>> &events,
<<
"
\'
, which will be ignored in profiling report."
;
++
rit
;
}
for
(
auto
it
=
sub_child_map
.
begin
();
it
!=
sub_child_map
.
end
();
it
++
)
{
child_map
.
insert
(
std
::
pair
<
std
::
string
,
EventItem
>
(
it
->
first
,
it
->
second
));
}
}
// Print report
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录