Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
oneflow
提交
ccc3b389
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,发现更多精彩内容 >>
未验证
提交
ccc3b389
编写于
9月 01, 2018
作者:
J
Jinhui Yuan
提交者:
GitHub
9月 01, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix reduce_gather in case of enable_mem_sharing == false (#1186)
上级
28a6fc98
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
5 deletion
+8
-5
oneflow/core/actor/reduce_gather_compute_actor.cpp
oneflow/core/actor/reduce_gather_compute_actor.cpp
+2
-1
oneflow/core/actor/reduce_gather_compute_actor.h
oneflow/core/actor/reduce_gather_compute_actor.h
+1
-1
oneflow/core/kernel/reduce_gather_kernel.cpp
oneflow/core/kernel/reduce_gather_kernel.cpp
+5
-3
未找到文件。
oneflow/core/actor/reduce_gather_compute_actor.cpp
浏览文件 @
ccc3b389
...
...
@@ -3,7 +3,8 @@
namespace
oneflow
{
void
ReduceGatherCompActor
::
SetKernelCtxOther
(
void
**
other
)
{
other_val_
=
InBnId4RegstDescId
(
cur_processed_regst_desc_id
());
int64_t
in_bn_id
=
InBnId4RegstDescId
(
cur_processed_regst_desc_id
());
other_val_
=
std
::
make_pair
(
in_bn_id
,
EnableInplace
());
*
other
=
static_cast
<
void
*>
(
&
other_val_
);
}
...
...
oneflow/core/actor/reduce_gather_compute_actor.h
浏览文件 @
ccc3b389
...
...
@@ -15,7 +15,7 @@ class ReduceGatherCompActor final : public InputWiseCompActor {
void
VirtualCompActorInit
(
const
TaskProto
&
proto
)
override
{
InputWiseCompActor
::
Init
(
proto
);
}
void
SetKernelCtxOther
(
void
**
other
)
override
;
int64_t
other_val_
;
std
::
pair
<
int64_t
,
bool
>
other_val_
;
};
}
// namespace oneflow
...
...
oneflow/core/kernel/reduce_gather_kernel.cpp
浏览文件 @
ccc3b389
...
...
@@ -5,15 +5,17 @@ namespace oneflow {
template
<
DeviceType
device_type
>
void
ReduceGatherKernel
<
device_type
>::
ForwardDataContent
(
const
KernelCtx
&
ctx
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
BnInOp2Blob
)
const
{
if
(
device_type
==
DeviceType
::
kGPU
)
{
return
;
}
int64_t
in_bn_id
=
*
static_cast
<
int64_t
*>
(
ctx
.
other
);
const
auto
*
other_val
=
static_cast
<
std
::
pair
<
int64_t
,
bool
>*>
(
ctx
.
other
);
int64_t
in_bn_id
=
other_val
->
first
;
bool
is_inplace
=
other_val
->
second
;
if
(
is_inplace
)
{
return
;
}
Blob
*
out_blob
=
BnInOp2Blob
(
"out"
);
char
*
dst_cur_dptr
=
out_blob
->
mut_dptr
<
char
>
();
dst_cur_dptr
+=
this
->
kernel_conf
().
reduce_gather_conf
().
data_offset
().
Get
(
in_bn_id
);
Blob
*
in_blob
=
BnInOp2Blob
(
this
->
op_attribute
().
input_bns
().
Get
(
in_bn_id
));
size_t
in_byte_size
=
in_blob
->
ByteSizeOfDataContentField
();
Memcpy
<
DeviceType
::
kCPU
>
(
ctx
.
device_ctx
,
dst_cur_dptr
,
in_blob
->
dptr
<
char
>
(),
in_byte_size
);
Memcpy
<
device_type
>
(
ctx
.
device_ctx
,
dst_cur_dptr
,
in_blob
->
dptr
<
char
>
(),
in_byte_size
);
}
ADD_DEVICE_TYPE_KERNEL_CREATOR
(
OperatorConf
::
kReduceGatherConf
,
ReduceGatherKernel
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录