Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
a245ee66
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看板
提交
a245ee66
编写于
8月 21, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 21, 2020
浏览文件
操作
浏览文件
下载
差异文件
!4934 fix nccl kernel memory align bug
Merge pull request !4934 from zyli2020/bug_fix
上级
340f10c3
fcaf86f5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
7 deletion
+8
-7
mindspore/ccsrc/backend/kernel_compiler/gpu/nccl/nccl_gpu_kernel.h
.../ccsrc/backend/kernel_compiler/gpu/nccl/nccl_gpu_kernel.h
+4
-3
mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc
mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc
+4
-4
未找到文件。
mindspore/ccsrc/backend/kernel_compiler/gpu/nccl/nccl_gpu_kernel.h
浏览文件 @
a245ee66
...
...
@@ -122,6 +122,8 @@ class NcclGpuKernel : public GpuKernel {
}
bool
Init
(
const
CNodePtr
&
kernel_node
)
override
{
nccl_data_type_
=
kNcclDtypeMap
[
TypeIdLabel
(
AnfAlgo
::
GetInputDeviceDataType
(
kernel_node
,
0
))];
InferCommType
(
kernel_node
);
size_t
input_num
=
AnfAlgo
::
GetInputTensorNum
(
kernel_node
);
size_t
output_num
=
AnfAlgo
::
GetOutputTensorNum
(
kernel_node
);
for
(
size_t
i
=
0
;
i
<
input_num
;
++
i
)
{
...
...
@@ -130,7 +132,7 @@ class NcclGpuKernel : public GpuKernel {
for
(
size_t
j
=
0
;
j
<
shape
.
size
();
j
++
)
{
size
*=
IntToSize
(
shape
[
j
]);
}
size_t
aligned_size
=
AlignMemorySize
(
size
);
size_t
aligned_size
=
(
nccl_kernel_type_
!=
NCCL_ALL_REDUCE
)
?
size
:
AlignMemorySize
(
size
);
input_size_list_
.
push_back
(
aligned_size
);
input_size_
+=
aligned_size
;
}
...
...
@@ -140,12 +142,11 @@ class NcclGpuKernel : public GpuKernel {
for
(
size_t
j
=
0
;
j
<
shape
.
size
();
j
++
)
{
size
*=
IntToSize
(
shape
[
j
]);
}
size_t
aligned_size
=
AlignMemorySize
(
size
);
size_t
aligned_size
=
(
nccl_kernel_type_
!=
NCCL_ALL_REDUCE
)
?
size
:
AlignMemorySize
(
size
);
output_size_list_
.
push_back
(
aligned_size
);
output_size_
+=
aligned_size
;
}
InferCommType
(
kernel_node
);
group_name_
=
GetAttr
<
std
::
string
>
(
kernel_node
,
kAttrGroup
);
MS_LOG
(
INFO
)
<<
AnfAlgo
::
GetCNodeName
(
kernel_node
)
<<
" for group "
<<
group_name_
;
auto
comm_stream_attr
=
AnfAlgo
::
GetCNodePrimitive
(
kernel_node
)
->
GetAttr
(
"stream_id"
);
...
...
mindspore/ccsrc/runtime/device/gpu/gpu_device_address.cc
浏览文件 @
a245ee66
...
...
@@ -40,8 +40,8 @@ bool GPUDeviceAddress::SyncDeviceToHost(const std::vector<int> &, size_t size, T
return
ret
;
}
if
(
size
!=
size_
)
{
// nccl kernel input and outpu
memory size is aligned, may lead to sync memory size is inconformity
MS_LOG
(
INFO
)
<<
"Sync memory size is incon
formity
, host size: "
<<
size
<<
", device size "
<<
size_
;
// nccl kernel input and outpu
t device address is aligned, may lead to host size is not equal to device size
MS_LOG
(
INFO
)
<<
"Sync memory size is incon
sistent
, host size: "
<<
size
<<
", device size "
<<
size_
;
}
return
GPUDeviceManager
::
GetInstance
().
CopyDeviceMemToHost
(
host_ptr
,
ptr_
,
size
);
}
...
...
@@ -51,8 +51,8 @@ bool GPUDeviceAddress::SyncHostToDevice(const std::vector<int> &, size_t size, T
auto
&
stream
=
GPUDeviceManager
::
GetInstance
().
default_stream
();
MS_EXCEPTION_IF_NULL
(
stream
);
if
(
size
!=
size_
)
{
// nccl kernel input and outpu
memory size is aligned, may lead to sync memory size is inconformity
MS_LOG
(
INFO
)
<<
"Sync memory size is incon
formity
, host size: "
<<
size
<<
", device size "
<<
size_
;
// nccl kernel input and outpu
t device address is aligned, may lead to host size is not equal to device size
MS_LOG
(
INFO
)
<<
"Sync memory size is incon
sistent
, host size: "
<<
size
<<
", device size "
<<
size_
;
}
if
(
!
GPUDeviceManager
::
GetInstance
().
CopyHostMemToDeviceAsync
(
ptr_
,
host_ptr
,
size
,
stream
))
{
MS_LOG
(
ERROR
)
<<
"CopyHostMemToDeviceAsync failed"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录