Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
ca08360c
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
332
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ca08360c
编写于
6月 30, 2020
作者:
J
jiweibo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update nameing conventions. test=develop
上级
281d7c34
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
9 addition
and
9 deletion
+9
-9
lite/api/cxx_api.h
lite/api/cxx_api.h
+3
-3
lite/api/cxx_api_impl.cc
lite/api/cxx_api_impl.cc
+6
-6
未找到文件。
lite/api/cxx_api.h
浏览文件 @
ca08360c
...
...
@@ -242,11 +242,11 @@ class CxxPaddleApiImpl : public lite_api::PaddlePredictor {
#ifdef LITE_WITH_CUDA
// Cuda related environment initialization, including setting stream pointers,
// initializing synchronization events, setting predictor_id, etc.
void
CudaEnvInit
(
std
::
vector
<
std
::
string
>*
passes
);
void
InitCudaEnv
(
std
::
vector
<
std
::
string
>*
passes
);
// Due to the asynchronous nature of cuda kernel execution, synchronization is
// required before setting input and getting output.
void
InputSync
();
void
OutputSync
();
void
SyncInputs
();
void
SyncOutputs
();
#endif
private:
...
...
lite/api/cxx_api_impl.cc
浏览文件 @
ca08360c
...
...
@@ -43,7 +43,7 @@ void CxxPaddleApiImpl::Init(const lite_api::CxxConfig &config) {
// otherwise skip this step.
for
(
auto
&
p
:
places
)
{
if
(
p
.
target
==
TARGET
(
kCUDA
))
{
CudaEnvInit
(
&
passes
);
InitCudaEnv
(
&
passes
);
break
;
}
}
...
...
@@ -88,7 +88,7 @@ void CxxPaddleApiImpl::Init(const lite_api::CxxConfig &config) {
}
#ifdef LITE_WITH_CUDA
void
CxxPaddleApiImpl
::
CudaEnvInit
(
std
::
vector
<
std
::
string
>
*
passes
)
{
void
CxxPaddleApiImpl
::
InitCudaEnv
(
std
::
vector
<
std
::
string
>
*
passes
)
{
Env
<
TARGET
(
kCUDA
)
>::
Init
();
// init two streams for each predictor.
...
...
@@ -131,7 +131,7 @@ void CxxPaddleApiImpl::CudaEnvInit(std::vector<std::string> *passes) {
TargetWrapperCuda
::
CreateEventWithFlags
(
&
input_event_
);
}
void
CxxPaddleApiImpl
::
InputSync
()
{
void
CxxPaddleApiImpl
::
SyncInputs
()
{
TargetWrapperCuda
::
RecordEvent
(
input_event_
,
*
io_stream_
);
if
(
multi_stream_
)
{
for
(
int
i
=
0
;
i
<
lite
::
kMaxStream
;
++
i
)
{
...
...
@@ -142,7 +142,7 @@ void CxxPaddleApiImpl::InputSync() {
}
}
void
CxxPaddleApiImpl
::
OutputSync
()
{
void
CxxPaddleApiImpl
::
SyncOutputs
()
{
if
(
multi_stream_
)
{
for
(
size_t
i
=
0
;
i
<
output_events_
.
size
();
++
i
)
{
TargetWrapperCuda
::
RecordEvent
(
output_events_
[
i
],
*
exec_streams_
[
i
]);
...
...
@@ -193,13 +193,13 @@ void CxxPaddleApiImpl::Run() {
lite
::
DeviceInfo
::
Global
().
SetRunMode
(
mode_
,
threads_
);
#endif
#ifdef LITE_WITH_CUDA
InputSync
();
SyncInputs
();
#endif
raw_predictor_
->
Run
();
#ifdef LITE_WITH_CUDA
OutputSync
();
SyncOutputs
();
#endif
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录