Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
oneflow
提交
ecf7b2d0
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 搜索 >>
提交
ecf7b2d0
编写于
3月 25, 2017
作者:
W
willzhang4a58
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
start,stop -> source,sink
上级
c3621c61
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
38 addition
and
38 deletion
+38
-38
oneflow/graph/chain_graph.cpp
oneflow/graph/chain_graph.cpp
+1
-1
oneflow/graph/comp_transfm_graph.cpp
oneflow/graph/comp_transfm_graph.cpp
+2
-2
oneflow/graph/graph.h
oneflow/graph/graph.h
+31
-31
oneflow/graph/logical_graph.cpp
oneflow/graph/logical_graph.cpp
+1
-1
oneflow/graph/stage_graph.cpp
oneflow/graph/stage_graph.cpp
+1
-1
oneflow/graph/task_graph.cpp
oneflow/graph/task_graph.cpp
+2
-2
未找到文件。
oneflow/graph/chain_graph.cpp
浏览文件 @
ecf7b2d0
...
...
@@ -270,7 +270,7 @@ void ChainGraph::Init(const LogicalGraph* logical_graph) {
}
}
// Post processing
UpdateS
tartAndStop
();
UpdateS
ourceAndSink
();
CollectInputAndOutputLbns
();
}
...
...
oneflow/graph/comp_transfm_graph.cpp
浏览文件 @
ecf7b2d0
...
...
@@ -15,7 +15,7 @@ void CompTransfmGraph::FwBuildGraph() {
}
FwAddCloneOp
();
FwSetRelatedTaskEdges
(
lbn2producer
,
extern_in_lbn2consumers
);
UpdateS
tartAndStop
();
UpdateS
ourceAndSink
();
}
void
CompTransfmGraph
::
FwBuildFromUserOps
(
...
...
@@ -136,7 +136,7 @@ void CompTransfmGraph::FwSetRelatedTaskEdges(
void
CompTransfmGraph
::
BpBuildGraph
()
{
const
TransfmGraph
*
fw_graph
=
task_node
()
->
GetFwNode
()
->
transfm_graph
();
const
TransfmNode
*
cp_in_node
=
fw_graph
->
s
tart
_node
().
SoleOutEdge
()
->
dst_node
();
const
TransfmNode
*
cp_in_node
=
fw_graph
->
s
ource
_node
().
SoleOutEdge
()
->
dst_node
();
std
::
unordered_map
<
const
TransfmNode
*
,
TransfmNode
*>
fw_node2bp_node
;
// Copy Nodes
for
(
const
std
::
unique_ptr
<
TransfmNode
>&
fw_node
:
fw_graph
->
nodes
())
{
...
...
oneflow/graph/graph.h
浏览文件 @
ecf7b2d0
...
...
@@ -10,10 +10,10 @@ namespace oneflow {
template
<
typename
NodeType
,
typename
EdgeType
>
class
Graph
{
public:
// Topologically ergodic all nodes except s
tart_node_,stop
_node_
// Topologically ergodic all nodes except s
ource_node_,sink
_node_
class
Iterator
;
class
ConstIterator
;
// Reverse Topologically ergodic all nodes except s
tart_node_,stop
_node_
// Reverse Topologically ergodic all nodes except s
ource_node_,sink
_node_
class
ReverseIterator
;
class
ConstReverseIterator
;
...
...
@@ -21,8 +21,8 @@ class Graph {
Graph
()
=
default
;
virtual
~
Graph
()
=
default
;
const
NodeType
&
s
tart_node
()
const
{
return
start
_node_
;
}
const
NodeType
&
s
top_node
()
const
{
return
stop
_node_
;
}
const
NodeType
&
s
ource_node
()
const
{
return
source
_node_
;
}
const
NodeType
&
s
ink_node
()
const
{
return
sink
_node_
;
}
Iterator
begin
();
Iterator
end
();
...
...
@@ -46,14 +46,14 @@ class Graph {
}
bool
IsFirstNode
(
const
NodeType
*
node
)
const
{
return
node
->
SoleInEdge
()
->
src_node
()
==
&
s
tart
_node_
;
return
node
->
SoleInEdge
()
->
src_node
()
==
&
s
ource
_node_
;
}
bool
IsLastNode
(
const
NodeType
*
node
)
const
{
return
node
->
SoleOutEdge
()
->
dst_node
()
==
&
s
top
_node_
;
return
node
->
SoleOutEdge
()
->
dst_node
()
==
&
s
ink
_node_
;
}
protected:
void
UpdateS
tartAndStop
();
void
UpdateS
ourceAndSink
();
// Register
void
RegisterNode
(
NodeType
*
new_node
)
{
...
...
@@ -83,12 +83,12 @@ class Graph {
}
private:
NodeType
s
tart
_node_
;
NodeType
s
top
_node_
;
std
::
vector
<
std
::
unique_ptr
<
EdgeType
>>
s
tart
_edges_
;
std
::
vector
<
std
::
unique_ptr
<
EdgeType
>>
s
top
_edges_
;
NodeType
s
ource
_node_
;
NodeType
s
ink
_node_
;
std
::
vector
<
std
::
unique_ptr
<
EdgeType
>>
s
ource
_edges_
;
std
::
vector
<
std
::
unique_ptr
<
EdgeType
>>
s
ink
_edges_
;
// manage nodes,edges that are not related to s
tart,stop
// manage nodes,edges that are not related to s
ource,sink
std
::
vector
<
std
::
unique_ptr
<
NodeType
>>
nodes_
;
std
::
vector
<
std
::
unique_ptr
<
EdgeType
>>
edges_
;
};
...
...
@@ -101,9 +101,9 @@ class Graph<NodeType, EdgeType>::Iterator final {
Iterator
()
=
default
;
~
Iterator
()
=
default
;
void
Init
(
NodeType
*
s
tart
_node
)
{
void
Init
(
NodeType
*
s
ource
_node
)
{
bfs_queue_
=
std
::
queue
<
NodeType
*>
();
bfs_queue_
.
push
(
s
tart
_node
);
bfs_queue_
.
push
(
s
ource
_node
);
}
NodeType
&
operator
*
();
...
...
@@ -148,9 +148,9 @@ class Graph<NodeType, EdgeType>::ReverseIterator final {
ReverseIterator
()
=
default
;
~
ReverseIterator
()
=
default
;
void
Init
(
NodeType
*
s
top
_node
)
{
void
Init
(
NodeType
*
s
ink
_node
)
{
bfs_queue_
=
std
::
queue
<
NodeType
*>
();
bfs_queue_
.
push
(
s
top
_node
);
bfs_queue_
.
push
(
s
ink
_node
);
}
NodeType
&
operator
*
();
...
...
@@ -189,21 +189,21 @@ class Graph<NodeType, EdgeType>::ConstReverseIterator final {
};
template
<
typename
NodeType
,
typename
EdgeType
>
void
Graph
<
NodeType
,
EdgeType
>::
UpdateS
tartAndStop
()
{
s
tart
_node_
.
DisconnectAllEdges
();
s
top
_node_
.
DisconnectAllEdges
();
s
tart
_edges_
.
clear
();
s
top
_edges_
.
clear
();
void
Graph
<
NodeType
,
EdgeType
>::
UpdateS
ourceAndSink
()
{
s
ource
_node_
.
DisconnectAllEdges
();
s
ink
_node_
.
DisconnectAllEdges
();
s
ource
_edges_
.
clear
();
s
ink
_edges_
.
clear
();
for
(
const
std
::
unique_ptr
<
NodeType
>&
node
:
nodes_
)
{
if
(
node
->
in_edges
().
empty
())
{
EdgeType
*
s
tart
_edge
=
new
EdgeType
;
s
tart_edges_
.
emplace_back
(
start
_edge
);
Connect
(
&
s
tart_node_
,
start
_edge
,
node
.
get
());
EdgeType
*
s
ource
_edge
=
new
EdgeType
;
s
ource_edges_
.
emplace_back
(
source
_edge
);
Connect
(
&
s
ource_node_
,
source
_edge
,
node
.
get
());
}
if
(
node
->
out_edges
().
empty
())
{
EdgeType
*
s
top
_edge
=
new
EdgeType
;
s
top_edges_
.
emplace_back
(
stop
_edge
);
Connect
(
node
.
get
(),
s
top_edge
,
&
stop
_node_
);
EdgeType
*
s
ink
_edge
=
new
EdgeType
;
s
ink_edges_
.
emplace_back
(
sink
_edge
);
Connect
(
node
.
get
(),
s
ink_edge
,
&
sink
_node_
);
}
}
}
...
...
@@ -211,13 +211,13 @@ void Graph<NodeType, EdgeType>::UpdateStartAndStop() {
template
<
typename
NodeType
,
typename
EdgeType
>
auto
Graph
<
NodeType
,
EdgeType
>::
begin
()
->
Iterator
{
Iterator
ret
;
ret
.
Init
(
&
s
tart
_node_
);
ret
.
Init
(
&
s
ource
_node_
);
return
++
ret
;
}
template
<
typename
NodeType
,
typename
EdgeType
>
auto
Graph
<
NodeType
,
EdgeType
>::
end
()
->
Iterator
{
Iterator
ret
;
ret
.
Init
(
&
s
top
_node_
);
ret
.
Init
(
&
s
ink
_node_
);
return
ret
;
}
...
...
@@ -237,13 +237,13 @@ auto Graph<NodeType, EdgeType>::cend() const -> ConstIterator {
template
<
typename
NodeType
,
typename
EdgeType
>
auto
Graph
<
NodeType
,
EdgeType
>::
rbegin
()
->
ReverseIterator
{
ReverseIterator
ret
;
ret
.
Init
(
&
s
top
_node_
);
ret
.
Init
(
&
s
ink
_node_
);
return
++
ret
;
}
template
<
typename
NodeType
,
typename
EdgeType
>
auto
Graph
<
NodeType
,
EdgeType
>::
rend
()
->
ReverseIterator
{
ReverseIterator
ret
;
ret
.
Init
(
&
s
tart
_node_
);
ret
.
Init
(
&
s
ource
_node_
);
return
ret
;
}
...
...
oneflow/graph/logical_graph.cpp
浏览文件 @
ecf7b2d0
...
...
@@ -32,7 +32,7 @@ void LogicalGraph::BuildGraphStruct(const DLNetConf& dl_net_conf) {
}
lbn2node
.
clear
();
// Post Processing
UpdateS
tartAndStop
();
UpdateS
ourceAndSink
();
}
void
LogicalGraph
::
FillNodeWithParallelDesc
(
const
Strategy
&
strategy_conf
)
{
...
...
oneflow/graph/stage_graph.cpp
浏览文件 @
ecf7b2d0
...
...
@@ -74,7 +74,7 @@ void StageGraph::Init(std::unique_ptr<const ChainGraph>&& chain_graph) {
}
}
// Post processing
UpdateS
tartAndStop
();
UpdateS
ourceAndSink
();
}
}
// namespace oneflow
oneflow/graph/task_graph.cpp
浏览文件 @
ecf7b2d0
...
...
@@ -35,7 +35,7 @@ void TaskGraph::BuildWithoutTransfm(
InitCompTaskNodes
(
*
stage_graph
,
id_map
,
&
stage2task_nodes
);
InitBoxingTaskNodes
(
*
stage_graph
,
id_map
,
&
stage2task_nodes
);
ConnectTaskNodes
(
*
stage_graph
,
&
stage2task_nodes
);
UpdateS
tartAndStop
();
UpdateS
ourceAndSink
();
if
(
job_need_bp
)
{
BuildBpStruct
();
}
...
...
@@ -222,7 +222,7 @@ void TaskGraph::BuildBpStruct() {
std
::
vector
<
TaskNode
*>
turning_node_vec
;
GenerateRelatedBpNodes
(
&
turning_node_vec
);
BackwardConnect
(
turning_node_vec
);
UpdateS
tartAndStop
();
UpdateS
ourceAndSink
();
}
void
TaskGraph
::
GenerateRelatedBpNodes
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录