Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
720590c9
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看板
未验证
提交
720590c9
编写于
4月 07, 2020
作者:
W
Wilber
提交者:
GitHub
4月 07, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
solve cuda_x86_xpu compile problem. test=develop (#3353)
上级
c3d78a6e
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
36 deletion
+41
-36
lite/CMakeLists.txt
lite/CMakeLists.txt
+26
-32
lite/api/cxx_api_impl.cc
lite/api/cxx_api_impl.cc
+9
-2
lite/core/context.h
lite/core/context.h
+5
-1
lite/core/device_info.h
lite/core/device_info.h
+1
-1
未找到文件。
lite/CMakeLists.txt
浏览文件 @
720590c9
...
...
@@ -108,59 +108,53 @@ if (LITE_WITH_PYTHON)
add_dependencies
(
publish_inference publish_inference_python_light_demo
)
endif
()
if
(
LITE_WITH_CUDA OR LITE_WITH_X86
)
add_custom_target
(
publish_inference_cxx_lib
${
TARGET
}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/bin"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_SOURCE_DIR
}
/lite/api/paddle_*.h"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/libpaddle_api_full_bundled.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/libpaddle_api_light_bundled.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/lite/api/*.so"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
)
add_custom_target
(
publish_inference_third_party
${
TARGET
}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/third_party"
COMMAND cp -r
"
${
CMAKE_BINARY_DIR
}
/third_party/install/*"
"
${
INFER_LITE_PUBLISH_ROOT
}
/third_party"
)
add_dependencies
(
publish_inference_cxx_lib bundle_full_api
)
add_dependencies
(
publish_inference_cxx_lib bundle_light_api
)
add_dependencies
(
publish_inference_cxx_lib paddle_full_api_shared
)
add_dependencies
(
publish_inference_cxx_lib paddle_light_api_shared
)
add_dependencies
(
publish_inference publish_inference_cxx_lib
)
add_dependencies
(
publish_inference publish_inference_third_party
)
endif
()
if
(
LITE_WITH_X86
)
add_custom_target
(
publish_inference_x86_cxx_lib
${
TARGET
}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/bin"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_SOURCE_DIR
}
/lite/api/paddle_*.h"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/libpaddle_api_full_bundled.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/libpaddle_api_light_bundled.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/lite/api/*.so"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/lite/api/test_model_bin"
"
${
INFER_LITE_PUBLISH_ROOT
}
/bin"
)
add_dependencies
(
publish_inference_x86_cxx_lib bundle_full_api
)
add_dependencies
(
publish_inference_x86_cxx_lib bundle_light_api
)
add_dependencies
(
publish_inference_x86_cxx_lib test_model_bin
)
add_dependencies
(
publish_inference_x86_cxx_lib paddle_full_api_shared
)
add_dependencies
(
publish_inference_x86_cxx_lib paddle_light_api_shared
)
add_dependencies
(
publish_inference publish_inference_x86_cxx_lib
)
add_custom_target
(
publish_inference_x86_cxx_demos
${
TARGET
}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/third_party"
COMMAND cp -r
"
${
CMAKE_BINARY_DIR
}
/third_party/install/*"
"
${
INFER_LITE_PUBLISH_ROOT
}
/third_party"
COMMAND cp -r
"
${
CMAKE_BINARY_DIR
}
/third_party/eigen3"
"
${
INFER_LITE_PUBLISH_ROOT
}
/third_party"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/demo/cxx"
)
add_dependencies
(
publish_inference_x86_cxx_lib publish_inference_x86_cxx_demos
)
add_dependencies
(
publish_inference_x86_cxx_demos paddle_full_api_shared eigen3
)
add_dependencies
(
publish_inference publish_inference_x86_cxx_lib
)
add_dependencies
(
publish_inference publish_inference_x86_cxx_demos
)
endif
()
if
(
LITE_WITH_CUDA
)
add_custom_target
(
publish_inference_cuda_cxx_lib
${
TARGET
}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/bin"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_SOURCE_DIR
}
/lite/api/paddle_*.h"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/include"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/libpaddle_api_full_bundled.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/libpaddle_api_light_bundled.a"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
COMMAND cp
"
${
CMAKE_BINARY_DIR
}
/lite/api/*.so"
"
${
INFER_LITE_PUBLISH_ROOT
}
/cxx/lib"
)
add_dependencies
(
publish_inference_cuda_cxx_lib bundle_full_api
)
add_dependencies
(
publish_inference_cuda_cxx_lib bundle_light_api
)
add_dependencies
(
publish_inference_cuda_cxx_lib paddle_full_api_shared
)
add_dependencies
(
publish_inference_cuda_cxx_lib paddle_light_api_shared
)
add_dependencies
(
publish_inference publish_inference_cuda_cxx_lib
)
add_custom_target
(
publish_inference_cuda_cxx_demos
${
TARGET
}
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/third_party"
COMMAND cp -r
"
${
CMAKE_BINARY_DIR
}
/third_party/install/*"
"
${
INFER_LITE_PUBLISH_ROOT
}
/third_party"
COMMAND mkdir -p
"
${
INFER_LITE_PUBLISH_ROOT
}
/demo/cxx"
COMMAND cp -r
"
${
CMAKE_SOURCE_DIR
}
/lite/demo/cxx/cuda_demo/*"
"
${
INFER_LITE_PUBLISH_ROOT
}
/demo/cxx"
)
add_dependencies
(
publish_inference_cuda_cxx_lib publish_inference_cuda_cxx_demos
)
add_dependencies
(
publish_inference_cuda_cxx_demos paddle_full_api_shared
)
endif
(
LITE_WITH_CUDA
)
add_dependencies
(
publish_inference publish_inference_cuda_cxx_demos
)
endif
(
LITE_WITH_CUDA
)
if
(
LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND LITE_WITH_ARM
)
if
(
NOT LITE_ON_TINY_PUBLISH
)
# add cxx lib
...
...
lite/api/cxx_api_impl.cc
浏览文件 @
720590c9
...
...
@@ -31,10 +31,17 @@ namespace lite {
void
CxxPaddleApiImpl
::
Init
(
const
lite_api
::
CxxConfig
&
config
)
{
config_
=
config
;
auto
places
=
config
.
valid_places
();
#ifdef LITE_WITH_CUDA
Env
<
TARGET
(
kCUDA
)
>::
Init
();
// if kCUDA is included in valid places, it should be initialized first,
// otherwise skip this step.
for
(
auto
&
p
:
places
)
{
if
(
p
.
target
==
TARGET
(
kCUDA
))
{
Env
<
TARGET
(
kCUDA
)
>::
Init
();
break
;
}
}
#endif
auto
places
=
config
.
valid_places
();
std
::
vector
<
std
::
string
>
passes
{};
auto
use_layout_preprocess_pass
=
config
.
model_dir
().
find
(
"OPENCL_PRE_PRECESS"
);
...
...
lite/core/context.h
浏览文件 @
720590c9
...
...
@@ -181,7 +181,11 @@ class Context<TargetType::kCUDA> {
Env
<
TargetType
::
kCUDA
>::
Global
();
// NOTE: InitOnce should only be used by ContextScheduler
void
InitOnce
()
{
cublas_fp32_
=
std
::
make_shared
<
lite
::
cuda
::
Blas
<
float
>>
();
if
(
devs
.
size
()
>
0
)
{
cublas_fp32_
=
std
::
make_shared
<
lite
::
cuda
::
Blas
<
float
>>
();
}
else
{
LOG
(
INFO
)
<<
"No cuda device(s) found, CUDAContext init failed."
;
}
}
void
Init
(
int
dev_id
,
int
exec_stream_id
=
0
,
int
io_stream_id
=
0
)
{
CHECK_GT
(
devs
.
size
(),
0UL
)
...
...
lite/core/device_info.h
浏览文件 @
720590c9
...
...
@@ -142,7 +142,7 @@ class Env {
// Get device count
count
=
API
::
num_devices
();
if
(
count
==
0
)
{
CHECK
(
false
)
<<
"No device
found!"
;
LOG
(
INFO
)
<<
"No "
<<
TargetToStr
(
Type
)
<<
" device(s)
found!"
;
}
else
{
LOG
(
INFO
)
<<
"Found "
<<
count
<<
" device(s)"
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录