Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
17a5e3ce
M
mindinsight
项目概览
MindSpore
/
mindinsight
通知
8
Star
4
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindinsight
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
17a5e3ce
编写于
6月 19, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 19, 2020
浏览文件
操作
浏览文件
下载
差异文件
!296 add the aicpu parser feature
Merge pull request !296 from 治愈系潇洒哥/master
上级
14e30680
e6cf3306
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
28 addition
and
33 deletion
+28
-33
mindinsight/profiler/parser/aicpu_data_parser.py
mindinsight/profiler/parser/aicpu_data_parser.py
+28
-33
未找到文件。
mindinsight/profiler/parser/aicpu_data_parser.py
浏览文件 @
17a5e3ce
...
@@ -22,11 +22,6 @@ from tabulate import tabulate
...
@@ -22,11 +22,6 @@ from tabulate import tabulate
from
mindinsight.profiler.common._utils
import
fwrite_format
,
get_file_join_name
from
mindinsight.profiler.common._utils
import
fwrite_format
,
get_file_join_name
from
mindinsight.profiler.common.log
import
logger
from
mindinsight.profiler.common.log
import
logger
_source_file_target
=
'DATA_PREPROCESS.dev.AICPU'
_dst_file_title
=
'title:DATA_PREPROCESS AICPU'
_dst_file_column_title
=
[
'serial_number'
,
'node_name'
,
'total_time(us)'
,
'dispatch_time(us)'
,
'RunV2_start'
,
'compute_start'
,
'memcpy_start'
,
'memcpy_end'
,
'RunV2_end'
]
class
DataPreProcessParser
:
class
DataPreProcessParser
:
"""
"""
...
@@ -38,15 +33,23 @@ class DataPreProcessParser:
...
@@ -38,15 +33,23 @@ class DataPreProcessParser:
"""
"""
_source_file_target
=
'DATA_PREPROCESS.dev.AICPU.'
_dst_file_title
=
'title:DATA_PREPROCESS AICPU'
_dst_file_column_title
=
[
'serial_number'
,
'node_type_name'
,
'total_time(us)'
,
'dispatch_time(us)'
,
'run_start'
,
'run_end'
]
def
__init__
(
self
,
input_path
,
output_filename
):
def
__init__
(
self
,
input_path
,
output_filename
):
self
.
_input_path
=
input_path
self
.
_input_path
=
input_path
self
.
_output_filename
=
output_filename
self
.
_output_filename
=
output_filename
self
.
_source_file_name
=
self
.
_
get_source_file
()
self
.
_source_file_name
=
self
.
get_source_file
()
def
_
get_source_file
(
self
):
def
get_source_file
(
self
):
"""Get log file name, which was created by ada service."""
"""Get log file name, which was created by ada service."""
file_name
=
get_file_join_name
(
self
.
_input_path
,
self
.
_source_file_target
)
return
get_file_join_name
(
self
.
_input_path
,
_source_file_target
)
if
not
file_name
:
data_path
=
os
.
path
.
join
(
self
.
_input_path
,
"data"
)
file_name
=
get_file_join_name
(
data_path
,
self
.
_source_file_target
)
return
file_name
def
execute
(
self
):
def
execute
(
self
):
"""Execute the parser, get result data, and write it to the output file."""
"""Execute the parser, get result data, and write it to the output file."""
...
@@ -62,41 +65,33 @@ class DataPreProcessParser:
...
@@ -62,41 +65,33 @@ class DataPreProcessParser:
node_list
=
list
()
node_list
=
list
()
ai_cpu_total_time_summary
=
0
ai_cpu_total_time_summary
=
0
#
node serial number
#
Node serial number.
serial_number
=
1
serial_number
=
1
for
i
in
range
(
len
(
ai_cpu_lines
)
-
1
):
for
i
in
range
(
len
(
ai_cpu_lines
)
-
1
):
node_line
=
ai_cpu_lines
[
i
]
node_line
=
ai_cpu_lines
[
i
]
thread_line
=
ai_cpu_lines
[
i
+
1
]
thread_line
=
ai_cpu_lines
[
i
+
1
]
if
"Node"
in
node_line
and
"Thread"
in
thread_line
:
if
"Node"
in
node_line
and
"Thread"
in
thread_line
:
# get the node data from node_line
# Get the node data from node_line
node_name
=
node_line
.
split
(
','
)[
0
].
split
(
':'
)[
-
1
]
node_type_name
=
node_line
.
split
(
','
)[
0
].
split
(
':'
)[
-
1
]
run_v2_start
=
node_line
.
split
(
','
)[
1
].
split
(
':'
)[
-
1
]
run_start
=
node_line
.
split
(
','
)[
1
].
split
(
':'
)[
-
1
]
compute_start
=
node_line
.
split
(
','
)[
2
].
split
(
':'
)[
-
1
]
run_end
=
node_line
.
split
(
','
)[
2
].
split
(
':'
)[
-
1
]
mercy_start
=
node_line
.
split
(
','
)[
3
].
split
(
':'
)[
-
1
]
mercy_end
=
node_line
.
split
(
','
)[
4
].
split
(
':'
)[
-
1
]
run_v2_end
=
node_line
.
split
(
','
)[
5
].
split
(
':'
)[
-
1
]
# get total_time and dispatch_time from thread line
total_time
=
thread_line
.
split
(
','
)[
-
1
].
split
(
'='
)[
-
1
].
split
()[
0
]
total_time
=
thread_line
.
split
(
','
)[
-
1
].
split
(
'='
)[
-
1
].
split
()[
0
]
dispatch_time
=
thread_line
.
split
(
','
)[
-
2
].
split
(
'='
)[
-
1
].
split
()[
0
]
dispatch_time
=
thread_line
.
split
(
','
)[
-
2
].
split
(
'='
)[
-
1
].
split
()[
0
]
node_list
.
append
([
serial_number
,
node_type_name
,
total_time
,
node_data
=
[
serial_number
,
node_name
,
total_time
,
dispatch_time
,
run_v2_start
,
compute_start
,
dispatch_time
,
run_start
,
run_end
])
mercy_start
,
mercy_end
,
run_v2_end
]
# Calculate the total time.
node_list
.
append
(
node_data
)
# calculate the total time
ai_cpu_total_time_summary
+=
int
(
total_time
)
ai_cpu_total_time_summary
+=
int
(
total_time
)
#
increase node serial number
#
Increase node serial number.
serial_number
+=
1
serial_number
+=
1
elif
"Node"
in
node_line
and
"Thread"
not
in
thread_line
:
elif
"Node"
in
node_line
and
"Thread"
not
in
thread_line
:
node_name
=
node_line
.
split
(
','
)[
0
].
split
(
':'
)[
-
1
]
node_type_name
=
node_line
.
split
(
','
)[
0
].
split
(
':'
)[
-
1
]
logger
.
warning
(
"The node:%s cannot find thread data"
,
node_name
)
logger
.
warning
(
"The node type:%s cannot find thread data"
,
node_type_name
)
node_list
.
append
([
"AI CPU Total Time(us):"
,
ai_cpu_total_time_summary
])
if
node_list
:
if
node_list
:
fwrite_format
(
self
.
_output_filename
,
data_source
=
_dst_file_title
,
is_print
=
True
,
node_list
.
append
([
"AI CPU Total Time(us):"
,
ai_cpu_total_time_summary
])
fwrite_format
(
self
.
_output_filename
,
data_source
=
self
.
_dst_file_title
,
is_print
=
True
,
is_start
=
True
)
is_start
=
True
)
fwrite_format
(
self
.
_output_filename
,
fwrite_format
(
self
.
_output_filename
,
data_source
=
tabulate
(
node_list
,
_dst_file_column_title
,
data_source
=
tabulate
(
node_list
,
self
.
_dst_file_column_title
,
tablefmt
=
'simple'
),
tablefmt
=
'simple'
),
is_start
=
True
,
is_print
=
True
)
is_start
=
True
,
is_print
=
True
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录