Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
611411b9
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
611411b9
编写于
2月 24, 2020
作者:
W
wangchaochaohu
提交者:
GitHub
2月 24, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fusion group profile support (#22718)
* add support for the driver api callback and fix the profiler name show bug
上级
163a3ddf
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
19 deletion
+28
-19
paddle/fluid/platform/device_tracer.cc
paddle/fluid/platform/device_tracer.cc
+8
-2
paddle/fluid/platform/profiler.cc
paddle/fluid/platform/profiler.cc
+20
-17
未找到文件。
paddle/fluid/platform/device_tracer.cc
浏览文件 @
611411b9
...
...
@@ -400,7 +400,7 @@ class DeviceTracerImpl : public DeviceTracer {
}
else
if
(
ret
!=
CUPTI_SUCCESS
)
{
fprintf
(
stderr
,
"Failed to create CUPTI subscriber.
\n
"
);
}
const
std
::
vector
<
int
>
cbids
{
const
std
::
vector
<
int
>
runtime_
cbids
{
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpy_v3020
,
CUPTI_RUNTIME_TRACE_CBID_cudaSetupArgument_v3020
,
CUPTI_RUNTIME_TRACE_CBID_cudaMemcpyAsync_v3020
,
...
...
@@ -414,9 +414,15 @@ class DeviceTracerImpl : public DeviceTracer {
CUPTI_RUNTIME_TRACE_CBID_cudaLaunchCooperativeKernelMultiDevice_v9000
#endif
};
for
(
auto
cbid
:
cbids
)
const
std
::
vector
<
int
>
driver_cbids
{
CUPTI_DRIVER_TRACE_CBID_cuLaunch
,
CUPTI_DRIVER_TRACE_CBID_cuLaunchGrid
,
CUPTI_DRIVER_TRACE_CBID_cuLaunchKernel
};
for
(
auto
cbid
:
runtime_cbids
)
CUPTI_CALL
(
dynload
::
cuptiEnableCallback
(
1
,
subscriber_
,
CUPTI_CB_DOMAIN_RUNTIME_API
,
cbid
));
for
(
auto
cbid
:
driver_cbids
)
CUPTI_CALL
(
dynload
::
cuptiEnableCallback
(
1
,
subscriber_
,
CUPTI_CB_DOMAIN_DRIVER_API
,
cbid
));
CUPTI_CALL
(
dynload
::
cuptiGetTimestamp
(
&
start_ns_
));
#endif // PADDLE_WITH_CUPTI
enabled_
=
true
;
...
...
paddle/fluid/platform/profiler.cc
浏览文件 @
611411b9
...
...
@@ -702,8 +702,7 @@ void ParseMemEvents(const std::vector<std::vector<MemEvent>> &events) {
}
void
DealWithShowName
()
{
std
::
unordered_map
<
std
::
string
,
int
>
prefix_name
;
std
::
vector
<
std
::
string
>
op_out_name
;
std
::
unordered_map
<
std
::
string
,
std
::
vector
<
std
::
string
>>
profiler_name_info
;
for
(
auto
it
=
g_all_event_lists
.
begin
();
it
!=
g_all_event_lists
.
end
();
++
it
)
{
for
(
auto
&
block
:
(
*
it
)
->
event_blocks
)
{
...
...
@@ -714,20 +713,25 @@ void DealWithShowName() {
std
::
string
prefix_str
=
event_name
.
substr
(
0
,
start
);
while
(
start
!=
std
::
string
::
npos
&&
end
!=
std
::
string
::
npos
)
{
auto
search_str
=
event_name
.
substr
(
start
,
end
-
start
+
1
);
auto
it
=
find
(
op_out_name
.
begin
(),
op_out_name
.
end
(),
search_str
);
std
::
string
replace_str
;
bool
prefix_find
=
true
;
if
(
prefix_name
.
find
(
prefix_str
)
==
prefix_name
.
end
())
{
prefix_find
=
false
;
prefix_name
[
prefix_str
]
=
0
;
std
::
string
replace_str
=
""
;
int
replace_index
=
0
;
auto
it
=
profiler_name_info
.
find
(
prefix_str
);
if
(
it
==
profiler_name_info
.
end
())
{
std
::
vector
<
std
::
string
>
op_name_vector
{
search_str
};
profiler_name_info
[
prefix_str
]
=
op_name_vector
;
}
else
{
auto
op_name_vector
=
it
->
second
;
auto
iter
=
find
(
op_name_vector
.
begin
(),
op_name_vector
.
end
(),
search_str
);
if
(
iter
==
op_name_vector
.
end
())
{
replace_index
=
it
->
second
.
size
();
it
->
second
.
push_back
(
search_str
);
}
else
{
replace_index
=
it
->
second
.
size
()
-
1
;
}
}
if
(
it
==
op_out_name
.
end
())
{
if
(
prefix_find
)
prefix_name
[
prefix_str
]
=
prefix_name
[
prefix_str
]
+
1
;
op_out_name
.
push_back
(
search_str
);
}
replace_str
=
std
::
to_string
(
prefix_name
[
prefix_str
]);
replace_str
=
std
::
to_string
(
replace_index
);
event_name
.
replace
(
start
,
end
-
start
+
1
,
replace_str
);
start
=
start
+
1
;
start
=
event_name
.
find
(
'%'
,
start
);
...
...
@@ -792,8 +796,7 @@ std::string OpName(const framework::VariableNameMap &name_map,
std
::
string
ret
=
type_name
+
"%"
;
for
(
auto
it
=
name_map
.
begin
();
it
!=
name_map
.
end
();
it
++
)
{
auto
name_outputs
=
it
->
second
;
if
(
!
name_outputs
.
empty
()
&&
type_name
.
length
()
<
name_outputs
[
0
].
length
())
{
if
(
!
name_outputs
.
empty
())
{
ret
=
ret
+
name_outputs
[
0
];
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录