Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
c3e1d257
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2292
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c3e1d257
编写于
4月 12, 2022
作者:
L
liutiexing
提交者:
GitHub
4月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update Profiler (#41638)
上级
c055b50c
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
14 addition
and
11 deletion
+14
-11
paddle/fluid/platform/profiler/CMakeLists.txt
paddle/fluid/platform/profiler/CMakeLists.txt
+0
-0
paddle/fluid/platform/profiler/dump/test_serialization_logger.cc
...fluid/platform/profiler/dump/test_serialization_logger.cc
+2
-2
paddle/fluid/platform/profiler/event_node.h
paddle/fluid/platform/profiler/event_node.h
+7
-4
paddle/fluid/platform/profiler/event_python.cc
paddle/fluid/platform/profiler/event_python.cc
+1
-1
paddle/fluid/platform/profiler/event_python.h
paddle/fluid/platform/profiler/event_python.h
+2
-2
paddle/fluid/platform/profiler/profiler_test.cc
paddle/fluid/platform/profiler/profiler_test.cc
+2
-2
未找到文件。
paddle/fluid/platform/profiler/CMakeLists.txt
100755 → 100644
浏览文件 @
c3e1d257
文件模式从 100755 更改为 100644
paddle/fluid/platform/profiler/dump/test_serialization_logger.cc
浏览文件 @
c3e1d257
...
...
@@ -152,7 +152,7 @@ TEST(SerializationLoggerTest, dump_case1) {
TEST
(
DeserializationReaderTest
,
restore_case0
)
{
DeserializationReader
reader
(
"test_serialization_logger_case0.pb"
);
auto
profiler_result
=
reader
.
Parse
();
auto
&
tree
=
profiler_result
->
GetNodeTrees
();
auto
tree
=
profiler_result
->
GetNodeTrees
();
std
::
map
<
uint64_t
,
std
::
vector
<
HostTraceEventNode
*>>
nodes
=
tree
->
Traverse
(
true
);
EXPECT_EQ
(
nodes
[
10
].
size
(),
4u
);
...
...
@@ -179,7 +179,7 @@ TEST(DeserializationReaderTest, restore_case0) {
TEST
(
DeserializationReaderTest
,
restore_case1
)
{
DeserializationReader
reader
(
"test_serialization_logger_case1.pb"
);
auto
profiler_result
=
reader
.
Parse
();
auto
&
tree
=
profiler_result
->
GetNodeTrees
();
auto
tree
=
profiler_result
->
GetNodeTrees
();
std
::
map
<
uint64_t
,
std
::
vector
<
HostTraceEventNode
*>>
nodes
=
tree
->
Traverse
(
true
);
EXPECT_EQ
(
nodes
[
10
].
size
(),
1u
);
...
...
paddle/fluid/platform/profiler/event_node.h
浏览文件 @
c3e1d257
...
...
@@ -103,7 +103,7 @@ class CudaRuntimeTraceEventNode {
device_node_ptrs_
.
push_back
(
node
);
}
void
LogMe
(
BaseLogger
*
logger
)
{
logger
->
LogRuntimeTraceEventNode
(
*
this
);
}
std
::
vector
<
DeviceTraceEventNode
*>&
GetDeviceTraceEventNodes
()
{
const
std
::
vector
<
DeviceTraceEventNode
*>&
GetDeviceTraceEventNodes
()
const
{
return
device_node_ptrs_
;
}
...
...
@@ -139,8 +139,11 @@ class HostTraceEventNode {
void
AddCudaRuntimeNode
(
CudaRuntimeTraceEventNode
*
node
)
{
runtime_node_ptrs_
.
push_back
(
node
);
}
std
::
vector
<
HostTraceEventNode
*>&
GetChildren
()
{
return
children_
;
}
std
::
vector
<
CudaRuntimeTraceEventNode
*>&
GetRuntimeTraceEventNodes
()
{
const
std
::
vector
<
HostTraceEventNode
*>&
GetChildren
()
const
{
return
children_
;
}
const
std
::
vector
<
CudaRuntimeTraceEventNode
*>&
GetRuntimeTraceEventNodes
()
const
{
return
runtime_node_ptrs_
;
}
void
LogMe
(
BaseLogger
*
logger
)
{
logger
->
LogHostTraceEventNode
(
*
this
);
}
...
...
@@ -188,7 +191,7 @@ class NodeTrees {
void
HandleTrees
(
std
::
function
<
void
(
HostTraceEventNode
*
)
>
,
std
::
function
<
void
(
CudaRuntimeTraceEventNode
*
)
>
,
std
::
function
<
void
(
DeviceTraceEventNode
*
)
>
);
std
::
map
<
uint64_t
,
HostTraceEventNode
*>
GetNodeTrees
()
{
const
std
::
map
<
uint64_t
,
HostTraceEventNode
*>&
GetNodeTrees
()
const
{
return
thread_event_trees_map_
;
}
std
::
map
<
uint64_t
,
std
::
vector
<
HostTraceEventNode
*>>
Traverse
(
bool
bfs
)
const
;
...
...
paddle/fluid/platform/profiler/event_python.cc
浏览文件 @
c3e1d257
...
...
@@ -81,7 +81,7 @@ HostPythonNode* ProfilerResult::CopyTree(HostTraceEventNode* root) {
ProfilerResult
::
ProfilerResult
(
std
::
unique_ptr
<
NodeTrees
>
tree
,
const
ExtraInfo
&
extra_info
)
:
tree_
(
std
::
move
(
tree
)),
extra_info_
(
extra_info
)
{
:
tree_
(
tree
.
release
(
)),
extra_info_
(
extra_info
)
{
if
(
tree_
!=
nullptr
)
{
std
::
map
<
uint64_t
,
HostTraceEventNode
*>
nodetrees
=
tree_
->
GetNodeTrees
();
for
(
auto
it
=
nodetrees
.
begin
();
it
!=
nodetrees
.
end
();
++
it
)
{
...
...
paddle/fluid/platform/profiler/event_python.h
浏览文件 @
c3e1d257
...
...
@@ -82,11 +82,11 @@ class ProfilerResult {
void
Save
(
const
std
::
string
&
file_name
,
const
std
::
string
format
=
std
::
string
(
"json"
));
std
::
unique_ptr
<
NodeTrees
>&
GetNodeTrees
()
{
return
tree_
;
}
std
::
shared_ptr
<
NodeTrees
>
GetNodeTrees
()
{
return
tree_
;
}
private:
std
::
map
<
uint64_t
,
HostPythonNode
*>
thread_event_trees_map_
;
std
::
unique
_ptr
<
NodeTrees
>
tree_
;
std
::
shared
_ptr
<
NodeTrees
>
tree_
;
ExtraInfo
extra_info_
;
HostPythonNode
*
CopyTree
(
HostTraceEventNode
*
root
);
};
...
...
paddle/fluid/platform/profiler/profiler_test.cc
浏览文件 @
c3e1d257
...
...
@@ -46,7 +46,7 @@ TEST(ProfilerTest, TestHostTracer) {
3
);
}
auto
profiler_result
=
profiler
->
Stop
();
auto
&
nodetree
=
profiler_result
->
GetNodeTrees
();
auto
nodetree
=
profiler_result
->
GetNodeTrees
();
std
::
set
<
std
::
string
>
host_events
;
for
(
const
auto
pair
:
nodetree
->
Traverse
(
true
))
{
for
(
const
auto
evt
:
pair
.
second
)
{
...
...
@@ -79,7 +79,7 @@ TEST(ProfilerTest, TestCudaTracer) {
hipStreamSynchronize
(
stream
);
#endif
auto
profiler_result
=
profiler
->
Stop
();
auto
&
nodetree
=
profiler_result
->
GetNodeTrees
();
auto
nodetree
=
profiler_result
->
GetNodeTrees
();
std
::
vector
<
std
::
string
>
runtime_events
;
for
(
const
auto
pair
:
nodetree
->
Traverse
(
true
))
{
for
(
const
auto
host_node
:
pair
.
second
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录