Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
83ff625d
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看板
提交
83ff625d
编写于
6月 12, 2020
作者:
K
kswang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sync data for cpu
上级
2a2dd7d3
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
8 deletion
+20
-8
mindspore/ccsrc/device/cpu/cpu_kernel_runtime.cc
mindspore/ccsrc/device/cpu/cpu_kernel_runtime.cc
+4
-0
mindspore/ccsrc/session/gpu_session.cc
mindspore/ccsrc/session/gpu_session.cc
+8
-6
mindspore/ccsrc/vm/transform.cc
mindspore/ccsrc/vm/transform.cc
+8
-2
未找到文件。
mindspore/ccsrc/device/cpu/cpu_kernel_runtime.cc
浏览文件 @
83ff625d
...
...
@@ -192,8 +192,12 @@ void CPUKernelRuntime::BindInputOutput(const session::KernelGraph *kernel_graph,
if
(
item
->
isa
<
Parameter
>
())
{
auto
address
=
AnfAlgo
::
GetMutableOutputAddr
(
item
,
0
);
auto
tensor
=
inputs
[
input_idx
];
auto
tensor_address
=
tensor
->
device_address
();
MS_EXCEPTION_IF_NULL
(
address
);
MS_EXCEPTION_IF_NULL
(
tensor
);
if
(
tensor_address
!=
nullptr
&&
tensor_address
!=
address
)
{
(
void
)
tensor
->
data_sync
();
}
std
::
vector
<
int
>
data_shape
=
tensor
->
shape
();
size_t
tensor_size
=
std
::
accumulate
(
data_shape
.
begin
(),
data_shape
.
end
(),
type_size
,
std
::
multiplies
<
size_t
>
());
if
(
tensor
->
data_type
()
==
kNumberTypeFloat32
||
tensor
->
data_type
()
==
kNumberTypeInt32
)
{
...
...
mindspore/ccsrc/session/gpu_session.cc
浏览文件 @
83ff625d
...
...
@@ -103,17 +103,19 @@ void GPUSession::LoadInputData(const std::shared_ptr<KernelGraph> &kernel_graph,
if
(
input_node
->
isa
<
Parameter
>
()
&&
AnfAlgo
::
OutputAddrExist
(
input_node
,
0
))
{
auto
pk_node
=
input_node
->
cast
<
ParameterPtr
>
();
auto
device_address
=
AnfAlgo
::
GetMutableOutputAddr
(
pk_node
,
0
);
auto
tensor_address
=
tensor
->
device_address
();
bool
need_sync
=
false
;
if
(
ms_context
->
enable_pynative_infer
())
{
if
(
tensor
->
device_address
().
get
()
==
nullptr
||
tensor
->
device_address
()
!=
device_address
)
{
if
(
tensor
_address
.
get
()
==
nullptr
||
tensor_address
!=
device_address
)
{
need_sync
=
true
;
}
}
else
{
if
(
tensor
->
is_dirty
())
{
}
else
if
(
tensor
->
is_dirty
())
{
need_sync
=
true
;
}
else
if
(
tensor_address
!=
device_address
)
{
if
(
tensor_address
->
DeviceType
()
==
device_address
->
DeviceType
())
{
AnfAlgo
::
SetOutputAddr
(
tensor_address
,
0
,
pk_node
.
get
());
}
else
{
need_sync
=
true
;
}
else
if
(
tensor
->
device_address
()
!=
device_address
)
{
AnfAlgo
::
SetOutputAddr
(
tensor
->
device_address
(),
0
,
pk_node
.
get
());
need_sync
=
false
;
}
}
if
(
need_sync
)
{
...
...
mindspore/ccsrc/vm/transform.cc
浏览文件 @
83ff625d
...
...
@@ -76,9 +76,15 @@ std::string GetCNodeTarget(const AnfNodePtr &node) {
return
default_target
;
}
auto
primitive
=
value
->
cast
<
PrimitivePtr
>
();
ValuePtr
att_target
=
primitive
->
GetAttr
(
"primitive_target"
);
auto
att_target
=
primitive
->
GetAttr
(
"primitive_target"
);
if
(
att_target
!=
nullptr
)
{
std
::
string
target
=
GetValue
<
std
::
string
>
(
att_target
);
if
(
!
att_target
->
isa
<
StringImm
>
())
{
MS_LOG
(
EXCEPTION
)
<<
"Only support string CPU|GPU|Ascend for primitive_target"
;
}
auto
target
=
GetValue
<
std
::
string
>
(
att_target
);
if
(
kTargetSet
.
find
(
target
)
==
kTargetSet
.
end
())
{
MS_LOG
(
EXCEPTION
)
<<
"Only support string CPU|GPU|Ascend for primitive_target"
;
}
return
target
;
}
return
default_target
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录