Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
2f7c5f7a
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
2f7c5f7a
编写于
5月 20, 2020
作者:
H
hongxing
提交者:
Sheng
5月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix edge bug
上级
9c8e750c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
18 addition
and
18 deletion
+18
-18
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_parse_graph.cc
.../ccsrc/parallel/auto_parallel/rec_core/rec_parse_graph.cc
+8
-1
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_partition.cc
...re/ccsrc/parallel/auto_parallel/rec_core/rec_partition.cc
+9
-16
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_partition.h
...ore/ccsrc/parallel/auto_parallel/rec_core/rec_partition.h
+1
-1
未找到文件。
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_parse_graph.cc
浏览文件 @
2f7c5f7a
...
...
@@ -220,11 +220,18 @@ std::shared_ptr<Graph> EliminateGraph(const std::shared_ptr<Graph> graph,
}
}
std
::
shared_ptr
<
Graph
>
new_graph
(
new
Graph
);
for
(
size_t
i
=
0
;
i
<
(
size_t
)
graph
->
nodes
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
graph
->
nodes
.
size
();
i
++
)
{
if
(
index_list
->
at
(
i
)
>
SIZE_MAX
/
2
)
{
continue
;
}
new_graph
->
nodes
.
push_back
(
graph
->
nodes
[
i
]);
for
(
size_t
j
=
0
;
j
<
new_graph
->
nodes
[
index_list
->
at
(
i
)].
node_in
.
size
();
j
++
)
{
new_graph
->
nodes
[
index_list
->
at
(
i
)].
node_in
[
j
]
=
index_list
->
at
(
new_graph
->
nodes
[
index_list
->
at
(
i
)].
node_in
[
j
]);
}
for
(
size_t
j
=
0
;
j
<
new_graph
->
nodes
[
index_list
->
at
(
i
)].
node_out
.
size
();
j
++
)
{
new_graph
->
nodes
[
index_list
->
at
(
i
)].
node_out
[
j
]
=
index_list
->
at
(
new_graph
->
nodes
[
index_list
->
at
(
i
)].
node_out
[
j
]);
}
}
return
new_graph
;
}
...
...
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_partition.cc
浏览文件 @
2f7c5f7a
...
...
@@ -232,7 +232,7 @@ Status PartitionForAllDevices(const size_t num_device, const double device_memor
}
}
if
(
DevicesMemoryControl
(
device_memory
,
graph
)
!=
SUCCESS
)
{
if
(
DevicesMemoryControl
(
num_device
,
device_memory
,
graph
)
!=
SUCCESS
)
{
return
FAILED
;
}
else
{
return
SUCCESS
;
...
...
@@ -257,16 +257,15 @@ Graph::NodeType ApplyStrToTensor(Graph::NodeType Node) {
return
Node
;
}
Status
DevicesMemoryControl
(
const
double
device_memory
,
std
::
shared_ptr
<
Graph
>
graph
)
{
Status
DevicesMemoryControl
(
const
size_t
num_device
,
const
double
device_memory
,
std
::
shared_ptr
<
Graph
>
graph
)
{
MS_EXCEPTION_IF_NULL
(
graph
);
uint64_t
iter_nodes
=
graph
->
nodes
.
size
();
double
used_memory
=
0.0
;
for
(
uint64_t
i_node
=
0
;
i_node
<
iter_nodes
;
i_node
++
)
{
if
(
graph
->
nodes
[
i_node
].
info
==
0
)
{
Graph
::
NodeType
&
Node
=
graph
->
nodes
[
i_node
];
double
used_memory
=
0.0
;
for
(
int
index
=
0
;
index
<
2
;
index
++
)
{
used_memory
+=
Node
.
apply
.
arguments
[
index
].
tensor_str
.
str_n
*
Node
.
apply
.
arguments
[
index
].
tensor_shape
.
shape_n
*
Node
.
apply
.
arguments
[
index
].
tensor_str
.
str_c
*
Node
.
apply
.
arguments
[
index
].
tensor_shape
.
shape_c
*
...
...
@@ -274,21 +273,15 @@ Status DevicesMemoryControl(const double device_memory, std::shared_ptr<Graph> g
Node
.
apply
.
arguments
[
index
].
tensor_str
.
str_w
*
Node
.
apply
.
arguments
[
index
].
tensor_shape
.
shape_w
*
GetDataTypeSize
(
Node
.
apply
.
arguments
[
index
].
tensor_type
);
}
used_memory
+=
Node
.
tensor_parm
.
tensor_str
.
str_n
*
Node
.
tensor_parm
.
tensor_shape
.
shape_n
*
Node
.
tensor_parm
.
tensor_str
.
str_c
*
Node
.
tensor_parm
.
tensor_shape
.
shape_c
*
Node
.
tensor_parm
.
tensor_str
.
str_h
*
Node
.
tensor_parm
.
tensor_shape
.
shape_h
*
Node
.
tensor_parm
.
tensor_str
.
str_w
*
Node
.
tensor_parm
.
tensor_shape
.
shape_w
*
GetDataTypeSize
(
Node
.
tensor_parm
.
tensor_type
);
if
(
device_memory
<
used_memory
)
{
MS_LOG
(
EXCEPTION
)
<<
"Failure: Out of memory!"
;
return
FAILED
;
}
}
}
return
SUCCESS
;
if
(
device_memory
<
(
used_memory
/
num_device
))
{
MS_LOG
(
EXCEPTION
)
<<
"Failure: Out of memory!"
;
return
FAILED
;
}
else
{
return
SUCCESS
;
}
}
size_t
GetDataTypeSize
(
const
TensorType
&
type
)
{
...
...
mindspore/ccsrc/parallel/auto_parallel/rec_core/rec_partition.h
浏览文件 @
2f7c5f7a
...
...
@@ -44,7 +44,7 @@ Status PartitionForAllDevices(const size_t num_device, const double device_memor
Graph
::
NodeType
ApplyStrToTensor
(
Graph
::
NodeType
Node
);
Status
DevicesMemoryControl
(
const
double
device_memory
,
std
::
shared_ptr
<
Graph
>
graph
);
Status
DevicesMemoryControl
(
const
size_t
num_device
,
const
double
device_memory
,
std
::
shared_ptr
<
Graph
>
graph
);
size_t
GetDataTypeSize
(
const
TensorType
&
type
);
}
// namespace parallel
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录