Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindinsight
提交
e49220cb
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看板
提交
e49220cb
编写于
6月 12, 2020
作者:
Y
yelihua
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix bug of step tag analyser
上级
3ac9a48c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
19 addition
and
23 deletion
+19
-23
mindinsight/profiler/parser/step_trace_parser.py
mindinsight/profiler/parser/step_trace_parser.py
+19
-23
未找到文件。
mindinsight/profiler/parser/step_trace_parser.py
浏览文件 @
e49220cb
...
@@ -65,7 +65,8 @@ class StepTraceParser:
...
@@ -65,7 +65,8 @@ class StepTraceParser:
summary_info
[
'total_steps'
]
=
len
(
self
.
_result
)
-
1
summary_info
[
'total_steps'
]
=
len
(
self
.
_result
)
-
1
print
(
'
\n
Step trace summary info (unit: syscnt):'
)
print
(
'
\n
Step trace summary info (unit: syscnt):'
)
print
(
summary_info
)
print
(
summary_info
)
print
(
'
\n
The step trace parse result saves under ${summary_dir}/profiler/%s'
%
self
.
output_file
)
print
(
'
\n
The step trace parse result saves under ${summary_dir}/profiler/%s'
%
self
.
output_file
)
def
parse_and_save
(
self
):
def
parse_and_save
(
self
):
"""Parse step trace files and save the result."""
"""Parse step trace files and save the result."""
...
@@ -131,10 +132,6 @@ class StepTraceParser:
...
@@ -131,10 +132,6 @@ class StepTraceParser:
self
.
_construct_event_info
(
next_event
,
event_info
)
self
.
_construct_event_info
(
next_event
,
event_info
)
if
event_info
.
get
(
'end'
):
if
event_info
.
get
(
'end'
):
yield
event_info
yield
event_info
event_info
=
{
'start'
:
event_info
.
get
(
'end'
),
'reduce'
:
{}
}
def
_get_trace_struct
(
self
,
bin_info
):
def
_get_trace_struct
(
self
,
bin_info
):
"""Translate event info to StepTraceStruct."""
"""Translate event info to StepTraceStruct."""
...
@@ -146,7 +143,7 @@ class StepTraceParser:
...
@@ -146,7 +143,7 @@ class StepTraceParser:
def
_construct_event_info
(
self
,
next_event
,
event_info
):
def
_construct_event_info
(
self
,
next_event
,
event_info
):
"""Construct event info according to next_event."""
"""Construct event info according to next_event."""
min_job_id
=
255
min_job_id
=
255
step_flag
:
bool
=
lambda
tag
:
tag
>
min_job_id
step_flag
:
bool
=
lambda
tag
:
tag
>
min_job_id
or
tag
==
0
end_flag
:
bool
=
lambda
tag
:
tag
==
min_job_id
end_flag
:
bool
=
lambda
tag
:
tag
==
min_job_id
fp_flag
:
bool
=
lambda
tag
:
tag
==
1
fp_flag
:
bool
=
lambda
tag
:
tag
==
1
bp_flag
:
bool
=
lambda
tag
:
tag
==
2
bp_flag
:
bool
=
lambda
tag
:
tag
==
2
...
@@ -154,11 +151,10 @@ class StepTraceParser:
...
@@ -154,11 +151,10 @@ class StepTraceParser:
def
_on_step_event
():
def
_on_step_event
():
"""Handle step event."""
"""Handle step event."""
self
.
_validate_tag_id
(
tag_id
)
self
.
_validate_tag_id
(
tag_id
)
if
event_info
.
get
(
'start'
):
start_time
=
event_info
.
get
(
'end'
,
'-'
)
event_info
[
'end'
]
=
sys_count
event_info
.
clear
()
else
:
event_info
[
'start'
]
=
start_time
event_info
[
'start'
]
=
sys_count
event_info
[
'reduce'
]
=
{}
event_info
[
'reduce'
]
=
{}
def
_on_reduce_event
():
def
_on_reduce_event
():
"""Handle reduce event."""
"""Handle reduce event."""
...
@@ -198,7 +194,8 @@ class StepTraceParser:
...
@@ -198,7 +194,8 @@ class StepTraceParser:
if
not
(
start_time
and
end_time
and
fp_time
and
bp_time
):
if
not
(
start_time
and
end_time
and
fp_time
and
bp_time
):
log
.
warning
(
"The step %d is missing basic time."
,
self
.
_step_num
)
log
.
warning
(
"The step %d is missing basic time."
,
self
.
_step_num
)
return
return
if
start_time
==
'-'
:
start_time
=
fp_time
row_data
=
{
row_data
=
{
'step_num'
:
self
.
_step_num
,
'step_num'
:
self
.
_step_num
,
'start_point'
:
start_time
,
'start_point'
:
start_time
,
...
@@ -215,7 +212,7 @@ class StepTraceParser:
...
@@ -215,7 +212,7 @@ class StepTraceParser:
# save the row data
# save the row data
if
not
self
.
_header
:
if
not
self
.
_header
:
self
.
_header
=
list
(
row_data
.
keys
())
self
.
_header
=
list
(
row_data
.
keys
())
row_data_list
=
[
row_data
[
header_name
]
for
header_name
in
self
.
_header
]
row_data_list
=
[
row_data
.
get
(
header_name
,
0
)
for
header_name
in
self
.
_header
]
self
.
_result
.
append
(
row_data_list
)
self
.
_result
.
append
(
row_data_list
)
@
staticmethod
@
staticmethod
...
@@ -236,20 +233,19 @@ class StepTraceParser:
...
@@ -236,20 +233,19 @@ class StepTraceParser:
def
_record_average_info
(
self
):
def
_record_average_info
(
self
):
"""Calculate average info."""
"""Calculate average info."""
result_size
=
len
(
self
.
_result
)
result_size
=
len
(
self
.
_result
)
if
result_size
<
2
:
return
# calculate average data for each column in result data
# calculate average data for each column in result data
average_data
=
[
0
]
*
len
(
self
.
_header
)
average_data
=
[
0
]
*
len
(
self
.
_header
)
for
row_info
in
self
.
_result
[
1
:]:
if
result_size
>=
2
:
for
row_info
in
self
.
_result
[
1
:]:
average_data
=
[
Decimal
(
i
)
+
Decimal
(
j
)
for
i
,
j
in
zip
(
row_info
,
average_data
)
]
average_data
=
[
average_data
=
[
Decimal
(
i
)
+
Decimal
(
j
)
for
i
,
j
in
zip
(
row_info
,
average_data
)
round
((
item
/
(
result_size
-
1
)))
for
item
in
average_data
]
]
average_data
=
[
# change step num info in average_data to None
round
((
item
/
(
result_size
-
1
)))
for
item
in
average_data
step_num_index
=
self
.
_header
.
index
(
'step_num'
)
]
average_data
[
step_num_index
]
=
'-'
# change step num info in average_data to None
step_num_index
=
self
.
_header
.
index
(
'step_num'
)
average_data
[
step_num_index
]
=
'-'
self
.
_result
.
append
(
average_data
)
self
.
_result
.
append
(
average_data
)
log
.
info
(
"Finish add average info for step trace."
)
log
.
info
(
"Finish add average info for step trace."
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录