Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
75ca84d2
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看板
提交
75ca84d2
编写于
5月 14, 2020
作者:
Y
Yi Huaijie
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
INFO user when set_strategy not under [semi_]auto_parallel mode
上级
298a7848
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
0 deletion
+35
-0
mindspore/ccsrc/parallel/ops_info/ops_utils.h
mindspore/ccsrc/parallel/ops_info/ops_utils.h
+1
-0
mindspore/ccsrc/parallel/step_parallel.cc
mindspore/ccsrc/parallel/step_parallel.cc
+33
-0
mindspore/ops/primitive.py
mindspore/ops/primitive.py
+1
-0
未找到文件。
mindspore/ccsrc/parallel/ops_info/ops_utils.h
浏览文件 @
75ca84d2
...
...
@@ -48,6 +48,7 @@ constexpr double INF = 1e20;
constexpr
char
AUTO_PARALLEL_RUN_ONCE_ONLY
[]
=
"auto_parallel_run_once_only"
;
constexpr
char
SEMI_AUTO_PARALLEL_RUN_ONCE_ONLY
[]
=
"semi_auto_parallel_run_once_only"
;
constexpr
char
CHECK_SET_STRATEGY_VALID_ONCE_ONLY
[]
=
"check_set_strategy_valid_once_only"
;
constexpr
char
STRATEGY
[]
=
"strategy"
;
constexpr
char
GEN_STRATEGY
[]
=
"gen_strategy"
;
constexpr
char
REDUCE_OP_SUM
[]
=
"sum"
;
...
...
mindspore/ccsrc/parallel/step_parallel.cc
浏览文件 @
75ca84d2
...
...
@@ -333,6 +333,28 @@ bool StrategyFound(std::unordered_map<std::string, ValuePtr> attrs) {
return
!
((
iter
==
attrs
.
end
())
||
(
iter
->
second
->
type_name
()
==
NONE
));
}
bool
HasStrategy
(
const
FuncGraphPtr
&
root
)
{
AnfNodePtr
ret
=
root
->
get_return
();
MS_EXCEPTION_IF_NULL
(
ret
);
std
::
vector
<
AnfNodePtr
>
all_nodes
=
DeepScopedGraphSearch
(
ret
);
for
(
auto
&
node
:
all_nodes
)
{
auto
cnode
=
node
->
cast
<
CNodePtr
>
();
if
((
cnode
==
nullptr
)
||
!
IsValueNode
<
Primitive
>
(
cnode
->
input
(
0
)))
{
continue
;
}
ValueNodePtr
prim_anf_node
=
cnode
->
input
(
0
)
->
cast
<
ValueNodePtr
>
();
PrimitivePtr
prim
=
GetValueNode
<
PrimitivePtr
>
(
prim_anf_node
);
auto
attrs
=
prim
->
attrs
();
if
(
StrategyFound
(
attrs
))
{
return
true
;
}
}
return
false
;
}
bool
IsCommunicationOp
(
const
PrimitivePtr
&
prim
)
{
MS_EXCEPTION_IF_NULL
(
prim
);
return
(
COMMUNICATION_OPS
.
find
(
prim
->
name
())
!=
COMMUNICATION_OPS
.
end
());
...
...
@@ -2225,6 +2247,14 @@ bool StepParallel(const FuncGraphPtr &root, const opt::OptimizerPtr &optimizer)
// control whether use model_parallel mode
if
(
!
root
->
has_flag
(
AUTO_PARALLEL
)
||
((
parallel_mode
!=
AUTO_PARALLEL
)
&&
(
parallel_mode
!=
SEMI_AUTO_PARALLEL
))
||
(
root
->
has_flag
(
SEMI_AUTO_PARALLEL_RUN_ONCE_ONLY
)))
{
if
(
!
root
->
has_flag
(
CHECK_SET_STRATEGY_VALID_ONCE_ONLY
))
{
if
(
HasStrategy
(
root
))
{
MS_LOG
(
INFO
)
<<
"strategies ignored in "
<<
parallel_mode
<<
", set_strategy() only valid in [semi_]auto_parallel."
;
}
root
->
flags
()[
CHECK_SET_STRATEGY_VALID_ONCE_ONLY
]
=
true
;
}
return
changes
;
}
...
...
@@ -2282,6 +2312,9 @@ bool StepParallel(const FuncGraphPtr &root, const opt::OptimizerPtr &optimizer)
root
->
flags
()[
SEMI_AUTO_PARALLEL_RUN_ONCE_ONLY
]
=
true
;
res
->
results
()[
pipeline
::
kStepParallelGraph
]
=
root
;
// in auto parallel mode, no need to check if stategies set
root
->
flags
()[
CHECK_SET_STRATEGY_VALID_ONCE_ONLY
]
=
true
;
(
void
)
gettimeofday
(
&
end_time
,
nullptr
);
uint64_t
time
=
kUSecondInSecond
*
static_cast
<
uint64_t
>
(
end_time
.
tv_sec
-
start_time
.
tv_sec
);
time
+=
static_cast
<
uint64_t
>
(
end_time
.
tv_usec
-
start_time
.
tv_usec
);
...
...
mindspore/ops/primitive.py
浏览文件 @
75ca84d2
...
...
@@ -111,6 +111,7 @@ class Primitive(Primitive_):
Note:
Valid only in semi auto parallel or auto parallel mode.
In other parallel modes, strategies will be ignored if set.
Args:
strategy (tuple): Strategy describes the distributed parallel mode of the current primitive.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录