Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
oneflow
提交
18fed2f4
O
oneflow
项目概览
Oneflow-Inc
/
oneflow
上一次同步 2 年多
通知
13
Star
2733
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oneflow
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
18fed2f4
编写于
4月 24, 2018
作者:
S
ShawnXuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
function ok
Former-commit-id: 82b74cd7dedbfd2cecc7212671af0030ce1a7779
上级
9bc4aee7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
40 deletion
+25
-40
oneflow/core/actor/actor.cpp
oneflow/core/actor/actor.cpp
+1
-1
oneflow/core/job/act_event_analysis.cpp
oneflow/core/job/act_event_analysis.cpp
+23
-38
oneflow/core/job/runtime.cpp
oneflow/core/job/runtime.cpp
+1
-1
未找到文件。
oneflow/core/actor/actor.cpp
浏览文件 @
18fed2f4
...
...
@@ -3,7 +3,7 @@
namespace
oneflow
{
void
Actor
::
LogMsgEvent
(
ActorMsg
&
msg
)
{
if
(
!
Global
<
RuntimeCtx
>::
Get
()
->
is_experiment_phase
())
{
if
(
Global
<
RuntimeCtx
>::
Get
()
->
is_experiment_phase
())
{
if
(
msg
.
msg_type
()
==
ActorMsgType
::
kRegstMsg
)
{
// get nanoseconds, e.g. 1505840189520477525 = 1505840189.520477525 sec
int64_t
start
=
...
...
oneflow/core/job/act_event_analysis.cpp
浏览文件 @
18fed2f4
...
...
@@ -6,44 +6,29 @@
#include "oneflow/core/job/event_report_util.h"
namespace
oneflow
{
std
::
string
GetLastUpRegstTime
(
const
std
::
vector
<
int64_t
>&
regsts
,
const
HashMap
<
std
::
string
,
RegstEvent
>&
regst_events
,
const
int64_t
actor_id
,
const
int64_t
act_id
)
{
// key: regst_desc_id _ actor_id _ act_id
std
::
string
GetLastRegstTime
(
const
std
::
vector
<
int64_t
>&
regsts
,
const
std
::
list
<
MsgEvent
>&
msg_events
,
const
ActEvent
&
act_event
,
const
double
time_diff
)
{
int64_t
id
=
-
1
;
double
time
=
0.0
;
for
(
int64_t
regst_desc_id
:
regsts
)
{
std
::
string
key
=
std
::
to_string
(
regst_desc_id
)
+
"_"
+
std
::
to_string
(
actor_id
)
+
"_"
+
std
::
to_string
(
act_id
);
auto
re
=
regst_events
.
find
(
key
);
if
(
re
==
regst_events
.
end
())
return
",,"
;
if
(
re
->
second
.
from_producer_time
>
time
)
{
time
=
re
->
second
.
from_producer_time
;
id
=
regst_desc_id
;
for
(
auto
msg
:
msg_events
)
{
if
(
msg
.
dst_actor_id
()
==
act_event
.
actor_id
()
&&
msg
.
info
().
find
(
"from"
)
!=
std
::
string
::
npos
&&
msg
.
regst_desc_id
()
==
regst_desc_id
&&
msg
.
time
()
<
act_event
.
start_time
())
{
if
(
msg
.
time
()
>
time
)
{
time
=
msg
.
time
();
id
=
regst_desc_id
;
}
}
}
}
return
std
::
to_string
(
id
)
+
","
+
Time2String
(
time
)
+
","
;
}
std
::
string
GetLastDownRegstTime
(
const
std
::
vector
<
int64_t
>&
regsts
,
const
HashMap
<
std
::
string
,
RegstEvent
>&
regst_events
,
const
int64_t
actor_id
,
const
int64_t
act_id
)
{
// key: regst_desc_id _ actor_id _ act_id
int64_t
id
=
-
1
;
double
time
=
0.0
;
for
(
int64_t
regst_desc_id
:
regsts
)
{
std
::
string
key
=
std
::
to_string
(
regst_desc_id
)
+
"_"
+
std
::
to_string
(
actor_id
)
+
"_"
+
std
::
to_string
(
act_id
);
auto
re
=
regst_events
.
find
(
key
);
if
(
re
==
regst_events
.
end
())
return
",,"
;
if
(
re
->
second
.
from_consumer_time
>
time
)
{
time
=
re
->
second
.
from_consumer_time
;
id
=
regst_desc_id
;
}
}
return
std
::
to_string
(
id
)
+
","
+
Time2String
(
time
)
+
","
;
if
(
id
==
-
1
)
return
",,"
;
return
std
::
to_string
(
id
)
+
",'"
+
Time2String
(
time
-
time_diff
)
+
","
;
}
void
ActEventAnalysis
(
const
std
::
string
&
plan_filepath
,
const
std
::
string
&
act_event_filepath
,
const
std
::
string
&
time_diff_filepath
,
...
...
@@ -56,10 +41,10 @@ void ActEventAnalysis(const std::string& plan_filepath,
actor_id2consumed_regsts
);
std
::
vector
<
double
>
machine_time_diffs
;
GetMachineTimeDiff
(
time_diff_filepath
,
machine_time_diffs
);
HashMap
<
std
::
string
,
RegstEvent
>
regst_events
;
Msg2RegstEvents
(
msg_event_filepath
,
regst_events
,
time_diff_filepath
);
Plan
plan
;
ParseProtoFromTextFile
(
plan_filepath
,
&
plan
);
auto
msg_events
=
of_make_unique
<
std
::
list
<
MsgEvent
>>
();
LoadEvents
<
MsgEvent
>
(
msg_event_filepath
,
msg_events
.
get
());
std
::
ofstream
out_stream
(
report_filepath
);
out_stream
<<
"actor,type,machine,thrd,stream,act_id,push_time,start_time,"
"stop_time,"
...
...
@@ -84,10 +69,10 @@ void ActEventAnalysis(const std::string& plan_filepath,
out_stream
<<
Time2String
(
event
.
stop_time
()
-
event
.
start_time
())
+
","
;
out_stream
<<
Time2HumanReadable
(
event
.
stop_time
()
-
event
.
start_time
())
+
","
;
out_stream
<<
GetLast
UpRegstTime
(
actor_id2produc
ed_regsts
[
actor_id
],
regst_events
,
actor_id
,
event
.
act_id
()
);
out_stream
<<
GetLast
DownRegstTime
(
actor_id2consum
ed_regsts
[
actor_id
],
regst_events
,
actor_id
,
event
.
act_id
()
);
out_stream
<<
GetLast
RegstTime
(
actor_id2consum
ed_regsts
[
actor_id
],
*
msg_events
,
event
,
time_diff
);
out_stream
<<
GetLast
RegstTime
(
actor_id2produc
ed_regsts
[
actor_id
],
*
msg_events
,
event
,
time_diff
);
out_stream
<<
"
\n
"
;
}
out_stream
.
close
();
...
...
oneflow/core/job/runtime.cpp
浏览文件 @
18fed2f4
...
...
@@ -75,11 +75,11 @@ Runtime::Runtime(const Plan& plan, bool is_experiment_phase) {
void
Runtime
::
NewAllGlobal
(
const
Plan
&
plan
,
bool
is_experiment_phase
)
{
const
JobDesc
*
job_desc
=
Global
<
JobDesc
>::
Get
();
int64_t
piece_num
=
0
;
Global
<
MsgEventLogger
>::
New
();
if
(
is_experiment_phase
)
{
piece_num
=
job_desc
->
piece_num_of_experiment_phase
();
Global
<
ActEventLogger
>::
New
();
Global
<
KernelEventLogger
>::
New
();
Global
<
MsgEventLogger
>::
New
();
}
else
{
if
(
job_desc
->
IsTrain
())
{
piece_num
=
job_desc
->
NumOfPiecesInBatch
()
*
job_desc
->
TotalBatchNum
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录