Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Oneflow-Inc
oneflow
提交
a77d1ebe
O
oneflow
项目概览
Oneflow-Inc
/
oneflow
上一次同步 接近 3 年
通知
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,发现更多精彩内容 >>
提交
a77d1ebe
编写于
12月 30, 2019
作者:
X
Xinqi Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
SyncDevice
上级
3a30230d
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
24 addition
and
24 deletion
+24
-24
oneflow/core/device/cpu_device_context.h
oneflow/core/device/cpu_device_context.h
+1
-0
oneflow/core/device/cuda_device_context.h
oneflow/core/device/cuda_device_context.h
+2
-0
oneflow/core/device/device_context.h
oneflow/core/device/device_context.h
+1
-0
oneflow/core/kernel/input_kernel.cpp
oneflow/core/kernel/input_kernel.cpp
+19
-2
oneflow/core/kernel/input_kernel.h
oneflow/core/kernel/input_kernel.h
+0
-22
oneflow/core/kernel/return_kernel.cpp
oneflow/core/kernel/return_kernel.cpp
+1
-0
未找到文件。
oneflow/core/device/cpu_device_context.h
浏览文件 @
a77d1ebe
...
...
@@ -13,6 +13,7 @@ class CpuDeviceCtx final : public DeviceCtx {
std
::
unique_ptr
<
DeviceCtx
>
Copy
()
const
{
return
std
::
unique_ptr
<
DeviceCtx
>
(
new
CpuDeviceCtx
());
}
void
SyncDevice
()
override
{}
void
AddCallBack
(
std
::
function
<
void
()
>
callback
)
const
override
{
callback
();
}
private:
...
...
oneflow/core/device/cuda_device_context.h
浏览文件 @
a77d1ebe
...
...
@@ -29,6 +29,8 @@ class CudaDeviceCtx : public DeviceCtx {
}
const
cudnnHandle_t
&
cudnn_handle
()
const
override
{
return
*
(
cuda_handler_
->
cudnn_handle
());
}
void
SyncDevice
()
override
{
CudaCheck
(
cudaStreamSynchronize
(
cuda_stream
()));
}
void
AddCallBack
(
std
::
function
<
void
()
>
callback
)
const
override
{
cuda_handler_
->
AddCallBack
(
callback
);
}
...
...
oneflow/core/device/device_context.h
浏览文件 @
a77d1ebe
...
...
@@ -19,6 +19,7 @@ class DeviceCtx {
virtual
const
ncclComm_t
&
nccl_handle
()
const
{
UNIMPLEMENTED
();
}
#endif
virtual
void
SyncDevice
()
{
UNIMPLEMENTED
();
}
virtual
void
AddCallBack
(
std
::
function
<
void
()
>
)
const
=
0
;
protected:
...
...
oneflow/core/kernel/input_kernel.cpp
浏览文件 @
a77d1ebe
#include "oneflow/core/kernel/
input_
kernel.h"
#include "oneflow/core/kernel/kernel.h"
namespace
oneflow
{
namespace
{
template
<
DeviceType
device_type
>
class
InputKernel
final
:
public
KernelIf
<
device_type
>
{
public:
OF_DISALLOW_COPY_AND_MOVE
(
InputKernel
);
InputKernel
()
=
default
;
~
InputKernel
()
=
default
;
private:
void
Forward
(
const
KernelCtx
&
ctx
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
BnInOp2Blob
)
const
override
{}
};
}
// namespace
ADD_DEVICE_TYPE_KERNEL_CREATOR
(
OperatorConf
::
kInputConf
,
InputKernel
);
}
}
// namespace oneflow
oneflow/core/kernel/input_kernel.h
已删除
100644 → 0
浏览文件 @
3a30230d
#ifndef ONEFLOW_CORE_KERNEL_INPUT_KERNEL_H_
#define ONEFLOW_CORE_KERNEL_INPUT_KERNEL_H_
#include "oneflow/core/kernel/kernel.h"
namespace
oneflow
{
template
<
DeviceType
device_type
>
class
InputKernel
final
:
public
KernelIf
<
device_type
>
{
public:
OF_DISALLOW_COPY_AND_MOVE
(
InputKernel
);
InputKernel
()
=
default
;
~
InputKernel
()
=
default
;
private:
void
Forward
(
const
KernelCtx
&
ctx
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
BnInOp2Blob
)
const
override
{}
};
}
// namespace oneflow
#endif // ONEFLOW_CORE_KERNEL_INPUT_KERNEL_H_
oneflow/core/kernel/return_kernel.cpp
浏览文件 @
a77d1ebe
...
...
@@ -6,6 +6,7 @@ template<DeviceType device_type>
void
ReturnKernel
<
device_type
>::
ForwardDataContent
(
const
KernelCtx
&
ctx
,
std
::
function
<
Blob
*
(
const
std
::
string
&
)
>
BnInOp2Blob
)
const
{
BnInOp2Blob
(
"out"
)
->
CopyDataContentFrom
(
ctx
.
device_ctx
,
BnInOp2Blob
(
"in"
));
ctx
.
device_ctx
->
SyncDevice
();
}
ADD_DEVICE_TYPE_KERNEL_CREATOR
(
OperatorConf
::
kReturnConf
,
ReturnKernel
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录