Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
64c0ba28
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
64c0ba28
编写于
8月 08, 2018
作者:
L
Luo Tao
提交者:
luotao1
8月 09, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix inference_lib_dist error
上级
e8aa6d12
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
43 addition
and
27 deletion
+43
-27
cmake/external/anakin.cmake
cmake/external/anakin.cmake
+30
-20
cmake/inference_lib.cmake
cmake/inference_lib.cmake
+1
-1
paddle/fluid/inference/api/CMakeLists.txt
paddle/fluid/inference/api/CMakeLists.txt
+12
-6
未找到文件。
cmake/external/anakin.cmake
浏览文件 @
64c0ba28
...
...
@@ -10,7 +10,35 @@ set(ANAKIN_LIBRARY ${ANAKIN_INSTALL_DIR})
SET
(
ANAKIN_SHARED_LIB
${
ANAKIN_LIBRARY
}
/libanakin.so
)
SET
(
ANAKIN_SABER_LIB
${
ANAKIN_LIBRARY
}
/libanakin_saber_common.so
)
include_directories
(
${
ANAKIN_INCLUDE
}
)
# A helper function used in Anakin, currently, to use it, one need to recursively include
# nearly all the header files.
function
(
fetch_include_recursively root_dir
)
if
(
IS_DIRECTORY
${
root_dir
}
)
include_directories
(
${
root_dir
}
)
endif
()
file
(
GLOB ALL_SUB RELATIVE
${
root_dir
}
${
root_dir
}
/*
)
foreach
(
sub
${
ALL_SUB
}
)
if
(
IS_DIRECTORY
${
root_dir
}
/
${
sub
}
)
fetch_include_recursively
(
${
root_dir
}
/
${
sub
}
)
endif
()
endforeach
()
endfunction
()
fetch_include_recursively
(
${
ANAKIN_INCLUDE
}
)
# A nother helper function used in Anakin.
function
(
target_fetch_include_recursively root_dir target_name
)
if
(
IS_DIRECTORY
${
root_dir
}
)
target_include_directories
(
${
target_name
}
PUBLIC
${
root_dir
}
)
endif
()
file
(
GLOB ALL_SUB RELATIVE
${
root_dir
}
${
root_dir
}
/*
)
foreach
(
sub
${
ALL_SUB
}
)
if
(
IS_DIRECTORY
${
root_dir
}
/
${
sub
}
)
target_include_directories
(
${
target_name
}
PUBLIC
${
root_dir
}
/
${
sub
}
)
endif
()
endforeach
()
endfunction
()
set
(
ANAKIN_COMPILE_EXTRA_FLAGS
-Wno-error=unused-but-set-variable -Wno-unused-but-set-variable
...
...
@@ -29,7 +57,7 @@ ExternalProject_Add(
extern_anakin
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/luotao1/Anakin"
GIT_TAG
"
20f6cb94a0f6ebbef0b45068b34baeb07242bac7
"
GIT_TAG
"
3957ae9263eaa0b1986758dac60a88852afb09be
"
PREFIX
${
ANAKIN_SOURCE_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DUSE_GPU_PLACE=YES
...
...
@@ -41,28 +69,10 @@ ExternalProject_Add(
${
EXTERNAL_OPTIONAL_ARGS
}
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
ANAKIN_INSTALL_DIR
}
)
# must manualy copy anakin_config.h to install dir.
execute_process
(
COMMAND bash -c
"cp
${
ANAKIN_INSTALL_DIR
}
/../../extern_anakin-build/anakin_config.h
${
ANAKIN_INSTALL_DIR
}
"
)
# A helper function used in Anakin, currently, to use it, one need to recursively include
# nearly all the header files.
function
(
fetch_include_recursively root_dir
)
if
(
IS_DIRECTORY
${
root_dir
}
)
include_directories
(
${
root_dir
}
)
endif
()
file
(
GLOB ALL_SUB RELATIVE
${
root_dir
}
${
root_dir
}
/*
)
foreach
(
sub
${
ALL_SUB
}
)
if
(
IS_DIRECTORY
${
root_dir
}
/
${
sub
}
)
fetch_include_recursively
(
${
root_dir
}
/
${
sub
}
)
endif
()
endforeach
()
endfunction
()
message
(
STATUS
"Anakin for inference is enabled"
)
message
(
STATUS
"Anakin is set INCLUDE:
${
ANAKIN_INCLUDE
}
LIBRARY:
${
ANAKIN_LIBRARY
}
"
)
add_dependencies
(
extern_anakin protobuf mklml
)
add_library
(
anakin SHARED IMPORTED GLOBAL
)
set_property
(
TARGET anakin PROPERTY IMPORTED_LOCATION
${
ANAKIN_SHARED_LIB
}
)
...
...
cmake/inference_lib.cmake
浏览文件 @
64c0ba28
...
...
@@ -143,7 +143,7 @@ if (WITH_ANAKIN AND WITH_GPU)
copy
(
anakin_inference_lib DEPS paddle_inference_api inference_anakin_api
SRCS
${
PADDLE_BINARY_DIR
}
/paddle/fluid/inference/api/libinference_anakin_api*
# compiled anakin api
${
PADDLE_BINARY_DIR
}
/third_party/install/anakin/*.tar.gz
# anakin release
${
ANAKIN_INSTALL_DIR
}
# anakin release
DSTS
${
dst_dir
}
/inference/anakin
${
dst_dir
}
/inference/anakin
)
list
(
APPEND inference_deps anakin_inference_lib
)
endif
()
...
...
paddle/fluid/inference/api/CMakeLists.txt
浏览文件 @
64c0ba28
...
...
@@ -61,18 +61,24 @@ inference_api_test(test_api_tensorrt_subgraph_engine SRC api_tensorrt_subgraph_e
endif
()
if
(
WITH_ANAKIN
)
# only needed in CI
fetch_include_recursively
(
${
ANAKIN_INCLUDE
}
)
# compile the libinference_anakin_api.a and anakin.so.
nv_library
(
inference_anakin_api SRCS api.cc api_anakin_engine.cc DEPS anakin
)
nv_library
(
inference_anakin_api_shared SHARED SRCS api.cc api_anakin_engine.cc DEPS anakin
)
target_compile_options
(
inference_anakin_api BEFORE PUBLIC
${
ANAKIN_COMPILE_EXTRA_FLAGS
}
)
target_compile_options
(
inference_anakin_api_shared BEFORE PUBLIC
${
ANAKIN_COMPILE_EXTRA_FLAGS
}
)
set
(
ANAKIN_DEPS_LIB
${
ANAKIN_SHARED_LIB
}
${
ANAKIN_SABER_LIB
}
${
CUDNN_LIBRARY
}
)
target_link_libraries
(
inference_anakin_api
${
ANAKIN_DEPS_LIB
}
)
target_link_libraries
(
inference_anakin_api_shared
${
ANAKIN_DEPS_LIB
}
)
function
(
anakin_target target_name
)
target_fetch_include_recursively
(
${
ANAKIN_INCLUDE
}
${
target_name
}
)
target_compile_options
(
${
target_name
}
BEFORE PUBLIC
${
ANAKIN_COMPILE_EXTRA_FLAGS
}
)
target_link_libraries
(
${
target_name
}
${
ANAKIN_DEPS_LIB
}
)
endfunction
()
anakin_target
(
inference_anakin_api
)
anakin_target
(
inference_anakin_api_shared
)
if
(
WITH_TESTING
)
set
(
ANAKIN_MODLE_URL
"http://paddle-inference-dist.bj.bcebos.com/mobilenet_v2.anakin.bin"
)
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/.timestamp
COMMAND cd
${
CMAKE_CURRENT_BINARY_DIR
}
&& wget --no-check-certificate
${
ANAKIN_MODLE_URL
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
)
cc_test
(
inference_anakin_test SRCS api_anakin_engine_tester.cc
ARGS --model=
/home/luotao02/download/anakin
/mobilenet_v2.anakin.bin
ARGS --model=
${
CMAKE_CURRENT_BINARY_DIR
}
/mobilenet_v2.anakin.bin
DEPS inference_anakin_api_shared dynload_cuda SERIAL
)
target_compile_options
(
inference_anakin_test BEFORE PUBLIC
${
ANAKIN_COMPILE_EXTRA_FLAGS
}
)
endif
(
WITH_TESTING
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录