Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
a0b68bc1
S
Serving
项目概览
PaddlePaddle
/
Serving
1 年多 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a0b68bc1
编写于
9月 23, 2019
作者:
W
wangguibao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
binary_inference_lib
上级
864c6ac6
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
164 addition
and
52 deletion
+164
-52
CMakeLists.txt
CMakeLists.txt
+1
-0
cmake/external/cudnn.cmake
cmake/external/cudnn.cmake
+102
-0
cmake/paddlepaddle.cmake
cmake/paddlepaddle.cmake
+50
-44
demo-serving/CMakeLists.txt
demo-serving/CMakeLists.txt
+5
-2
demo-serving/op/classify_op.h
demo-serving/op/classify_op.h
+1
-1
demo-serving/op/ctr_prediction_op.h
demo-serving/op/ctr_prediction_op.h
+1
-1
demo-serving/op/reader_op.h
demo-serving/op/reader_op.h
+1
-1
demo-serving/op/text_classification_op.h
demo-serving/op/text_classification_op.h
+1
-1
inferencer-fluid-cpu/include/fluid_cpu_engine.h
inferencer-fluid-cpu/include/fluid_cpu_engine.h
+1
-1
inferencer-fluid-gpu/include/fluid_gpu_engine.h
inferencer-fluid-gpu/include/fluid_gpu_engine.h
+1
-1
未找到文件。
CMakeLists.txt
浏览文件 @
a0b68bc1
...
...
@@ -75,6 +75,7 @@ include(generic)
include
(
flags
)
if
(
NOT CLIENT_ONLY
)
include
(
external/cudnn
)
include
(
paddlepaddle
)
include
(
external/opencv
)
endif
()
...
...
cmake/external/cudnn.cmake
0 → 100644
浏览文件 @
a0b68bc1
if
(
NOT WITH_GPU
)
return
()
endif
()
if
(
WIN32
)
set
(
CUDNN_ROOT
${
CUDA_TOOLKIT_ROOT_DIR
}
)
else
(
WIN32
)
set
(
CUDNN_ROOT
"/usr"
CACHE PATH
"CUDNN ROOT"
)
endif
(
WIN32
)
find_path
(
CUDNN_INCLUDE_DIR cudnn.h
PATHS
${
CUDNN_ROOT
}
${
CUDNN_ROOT
}
/include
$ENV{CUDNN_ROOT} $ENV{CUDNN_ROOT}/include
${
CUDA_TOOLKIT_INCLUDE
}
NO_DEFAULT_PATH
)
get_filename_component
(
__libpath_hist
${
CUDA_CUDART_LIBRARY
}
PATH
)
set
(
TARGET_ARCH
"x86_64"
)
if
(
NOT
${
CMAKE_SYSTEM_PROCESSOR
}
)
set
(
TARGET_ARCH
${
CMAKE_SYSTEM_PROCESSOR
}
)
endif
()
list
(
APPEND CUDNN_CHECK_LIBRARY_DIRS
${
CUDNN_ROOT
}
${
CUDNN_ROOT
}
/lib64
${
CUDNN_ROOT
}
/lib
${
CUDNN_ROOT
}
/lib/
${
TARGET_ARCH
}
-linux-gnu
${
CUDNN_ROOT
}
/local/cuda-
${
CUDA_VERSION
}
/targets/
${
TARGET_ARCH
}
-linux/lib/
$ENV{CUDNN_ROOT}
$ENV{CUDNN_ROOT}/lib64
$ENV{CUDNN_ROOT}/lib
/usr/lib
${
CUDA_TOOLKIT_ROOT_DIR
}
${
CUDA_TOOLKIT_ROOT_DIR
}
/lib/x64
)
set
(
CUDNN_LIB_NAME
""
)
if
(
LINUX
)
set
(
CUDNN_LIB_NAME
"libcudnn.so"
)
endif
(
LINUX
)
if
(
WIN32
)
# only support cudnn7
set
(
CUDNN_LIB_NAME
"cudnn.lib"
"cudnn64_7.dll"
)
endif
(
WIN32
)
if
(
APPLE
)
set
(
CUDNN_LIB_NAME
"libcudnn.dylib"
"libcudnn.so"
)
endif
(
APPLE
)
find_library
(
CUDNN_LIBRARY NAMES
${
CUDNN_LIB_NAME
}
# libcudnn_static.a
PATHS
${
CUDNN_CHECK_LIBRARY_DIRS
}
${
CUDNN_INCLUDE_DIR
}
${
__libpath_hist
}
NO_DEFAULT_PATH
DOC
"Path to cuDNN library."
)
if
(
CUDNN_INCLUDE_DIR AND CUDNN_LIBRARY
)
set
(
CUDNN_FOUND ON
)
else
()
set
(
CUDNN_FOUND OFF
)
endif
()
if
(
CUDNN_FOUND
)
file
(
READ
${
CUDNN_INCLUDE_DIR
}
/cudnn.h CUDNN_VERSION_FILE_CONTENTS
)
get_filename_component
(
CUDNN_LIB_PATH
${
CUDNN_LIBRARY
}
DIRECTORY
)
string
(
REGEX MATCH
"define CUDNN_VERSION +([0-9]+)"
CUDNN_VERSION
"
${
CUDNN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define CUDNN_VERSION +([0-9]+)"
"
\\
1"
CUDNN_VERSION
"
${
CUDNN_VERSION
}
"
)
if
(
"
${
CUDNN_VERSION
}
"
STREQUAL
"2000"
)
message
(
STATUS
"Current cuDNN version is v2. "
)
else
()
string
(
REGEX MATCH
"define CUDNN_MAJOR +([0-9]+)"
CUDNN_MAJOR_VERSION
"
${
CUDNN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define CUDNN_MAJOR +([0-9]+)"
"
\\
1"
CUDNN_MAJOR_VERSION
"
${
CUDNN_MAJOR_VERSION
}
"
)
string
(
REGEX MATCH
"define CUDNN_MINOR +([0-9]+)"
CUDNN_MINOR_VERSION
"
${
CUDNN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define CUDNN_MINOR +([0-9]+)"
"
\\
1"
CUDNN_MINOR_VERSION
"
${
CUDNN_MINOR_VERSION
}
"
)
string
(
REGEX MATCH
"define CUDNN_PATCHLEVEL +([0-9]+)"
CUDNN_PATCHLEVEL_VERSION
"
${
CUDNN_VERSION_FILE_CONTENTS
}
"
)
string
(
REGEX REPLACE
"define CUDNN_PATCHLEVEL +([0-9]+)"
"
\\
1"
CUDNN_PATCHLEVEL_VERSION
"
${
CUDNN_PATCHLEVEL_VERSION
}
"
)
if
(
NOT CUDNN_MAJOR_VERSION
)
set
(
CUDNN_VERSION
"???"
)
else
()
add_definitions
(
"-DPADDLE_CUDNN_BINVER=
\"
${
CUDNN_MAJOR_VERSION
}
\"
"
)
math
(
EXPR CUDNN_VERSION
"
${
CUDNN_MAJOR_VERSION
}
* 1000 +
${
CUDNN_MINOR_VERSION
}
* 100 +
${
CUDNN_PATCHLEVEL_VERSION
}
"
)
endif
()
message
(
STATUS
"Current cuDNN header is
${
CUDNN_INCLUDE_DIR
}
/cudnn.h. "
"Current cuDNN version is v
${
CUDNN_MAJOR_VERSION
}
.
${
CUDNN_MINOR_VERSION
}
. "
)
endif
()
endif
()
cmake/paddlepaddle.cmake
浏览文件 @
a0b68bc1
...
...
@@ -15,76 +15,82 @@
INCLUDE
(
ExternalProject
)
SET
(
PADDLE_SOURCES_DIR
${
THIRD_PARTY_PATH
}
/Paddle
)
SET
(
PADDLE_DOWNLOAD_DIR
${
PADDLE_SOURCES_DIR
}
/src/extern_paddle
)
SET
(
PADDLE_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/Paddle/
)
SET
(
PADDLE_INCLUDE_DIR
"
${
PADDLE_INSTALL_DIR
}
/include"
CACHE PATH
"PaddlePaddle include directory."
FORCE
)
SET
(
PADDLE_LIBRARIES
"
${
PADDLE_INSTALL_DIR
}
/lib/libpaddle_fluid.a"
CACHE FILEPATH
"Paddle library."
FORCE
)
INCLUDE_DIRECTORIES
(
${
CMAKE_BINARY_DIR
}
/Paddle/fluid_install_dir
)
# Reference https://stackoverflow.com/questions/45414507/pass-a-list-of-prefix-paths-to-externalproject-add-in-cmake-args
set
(
prefix_path
"
${
THIRD_PARTY_PATH
}
/install/gflags|
${
THIRD_PARTY_PATH
}
/install/leveldb|
${
THIRD_PARTY_PATH
}
/install/snappy|
${
THIRD_PARTY_PATH
}
/install/gtest|
${
THIRD_PARTY_PATH
}
/install/protobuf|
${
THIRD_PARTY_PATH
}
/install/zlib|
${
THIRD_PARTY_PATH
}
/install/glog"
)
message
(
"WITH_GPU =
${
WITH_GPU
}
"
)
# If minimal .a is need, you can set WITH_DEBUG_SYMBOLS=OFF
# Paddle Version should be one of:
# latest: latest develop build
# version number like 1.5.2
SET
(
PADDLE_VERSION
"latest"
)
if
(
WITH_GPU
)
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
-gpu-cuda
${
CUDA_VERSION_MAJOR
}
-cudnn7-avx-mkl"
)
else
()
if
(
AVX_FOUND
)
if
(
WITH_MKLML
)
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
-cpu-avx-mkl"
)
else
()
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
-cpu-avx-openblas"
)
endif
()
else
()
SET
(
PADDLE_LIB_VERSION
"
${
PADDLE_VERSION
}
-cpu-noavx-openblas"
)
endif
()
endif
()
SET
(
PADDLE_LIB_PATH
"http://paddle-inference-lib.bj.bcebos.com/
${
PADDLE_LIB_VERSION
}
/fluid_inference.tgz"
)
MESSAGE
(
STATUS
"PADDLE_LIB_PATH=
${
PADDLE_LIB_PATH
}
"
)
ExternalProject_Add
(
extern_paddle
"extern_paddle"
${
EXTERNAL_PROJECT_LOG_ARGS
}
# TODO(wangguibao): change to de newst repo when they changed.
GIT_REPOSITORY
"https://github.com/PaddlePaddle/Paddle"
GIT_TAG
"v1.5.1"
PREFIX
${
PADDLE_SOURCES_DIR
}
UPDATE_COMMAND
""
BINARY_DIR
${
CMAKE_BINARY_DIR
}
/Paddle
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
-DCMAKE_C_COMPILER=
${
CMAKE_C_COMPILER
}
-DCMAKE_INSTALL_PREFIX=
${
PADDLE_INSTALL_DIR
}
-DCMAKE_INSTALL_LIBDIR=
${
PADDLE_INSTALL_DIR
}
/lib
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DCMAKE_BUILD_TYPE=
${
THIRD_PARTY_BUILD_TYPE
}
-DCMAKE_PREFIX_PATH=
${
prefix_path
}
-DCMAKE_BINARY_DIR=
${
CMAKE_CURRENT_BINARY_DIR
}
-DWITH_SWIG_PY=OFF
-DWITH_PYTHON=OFF
-DWITH_MKL=
${
WITH_MKL
}
-DWITH_AVX=
${
WITH_AVX
}
-DWITH_MKLDNN=OFF
-DWITH_GPU=
${
WITH_GPU
}
-DWITH_FLUID_ONLY=ON
-DWITH_TESTING=OFF
-DWITH_DISTRIBUTE=OFF
-DON_INFER=ON
${
EXTERNAL_OPTIONAL_ARGS
}
LIST_SEPARATOR |
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
PADDLE_INSTALL_DIR
}
-DCMAKE_INSTALL_LIBDIR:PATH=
${
PADDLE_INSTALL_DIR
}
/lib
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
BUILD_COMMAND $
(
MAKE
)
INSTALL_COMMAND $
(
MAKE
)
fluid_lib_dist
URL
"
${
PADDLE_LIB_PATH
}
"
PREFIX
"
${
PADDLE_SOURCES_DIR
}
"
DOWNLOAD_DIR
"
${
PADDLE_DOWNLOAD_DIR
}
"
CONFIGURE_COMMAND
""
BUILD_COMMAND
""
UPDATE_COMMAND
""
INSTALL_COMMAND
${
CMAKE_COMMAND
}
-E copy_directory
${
PADDLE_DOWNLOAD_DIR
}
/paddle/include
${
PADDLE_INSTALL_DIR
}
/include &&
${
CMAKE_COMMAND
}
-E copy_directory
${
PADDLE_DOWNLOAD_DIR
}
/paddle/lib
${
PADDLE_INSTALL_DIR
}
/lib &&
${
CMAKE_COMMAND
}
-E copy_directory
${
PADDLE_DOWNLOAD_DIR
}
/third_party
${
PADDLE_INSTALL_DIR
}
/third_party
)
ExternalProject_Get_Property
(
extern_paddle BINARY_DIR
)
INCLUDE_DIRECTORIES
(
${
PADDLE_INCLUDE_DIR
}
)
ADD_LIBRARY
(
paddle_fluid STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET paddle_fluid PROPERTY IMPORTED_LOCATION
${
BINARY_DIR
}
/fluid_install_dir/paddle/fluid/inference
/libpaddle_fluid.a
)
SET_PROPERTY
(
TARGET paddle_fluid PROPERTY IMPORTED_LOCATION
${
PADDLE_INSTALL_DIR
}
/lib
/libpaddle_fluid.a
)
LIST
(
APPEND external_project_dependencies paddle
)
ADD_LIBRARY
(
snappystream STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET snappystream PROPERTY IMPORTED_LOCATION
${
BINARY_DIR
}
/fluid_install_dir
/third_party/install/snappystream/lib/libsnappystream.a
)
#
ADD_LIBRARY(snappystream STATIC IMPORTED GLOBAL)
#SET_PROPERTY(TARGET snappystream PROPERTY IMPORTED_LOCATION ${PADDLE_INSTALL_DIR}
/third_party/install/snappystream/lib/libsnappystream.a)
ADD_LIBRARY
(
xxhash STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET xxhash PROPERTY IMPORTED_LOCATION
${
BINARY_DIR
}
/fluid_install_dir
/third_party/install/xxhash/lib/libxxhash.a
)
SET_PROPERTY
(
TARGET xxhash PROPERTY IMPORTED_LOCATION
${
PADDLE_INSTALL_DIR
}
/third_party/install/xxhash/lib/libxxhash.a
)
ADD_LIBRARY
(
iomp5 SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET iomp5 PROPERTY IMPORTED_LOCATION
${
BINARY_DIR
}
/fluid_install_dir
/third_party/install/mklml/lib/libiomp5.so
)
SET_PROPERTY
(
TARGET iomp5 PROPERTY IMPORTED_LOCATION
${
PADDLE_INSTALL_DIR
}
/third_party/install/mklml/lib/libiomp5.so
)
ADD_LIBRARY
(
mklml_intel SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET mklml_intel PROPERTY IMPORTED_LOCATION
${
BINARY_DIR
}
/fluid_install_dir/third_party/install/mklml/lib/libmklml_intel.so
)
SET_PROPERTY
(
TARGET mklml_intel PROPERTY IMPORTED_LOCATION
${
PADDLE_INSTALL_DIR
}
/third_party/install/mklml/lib/libmklml_intel.so
)
ADD_LIBRARY
(
mkldnn SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET mkldnn PROPERTY IMPORTED_LOCATION
${
PADDLE_INSTALL_DIR
}
/third_party/install/mkldnn/lib/libmkldnn.so.0
)
LIST
(
APPEND paddle_depend_libs
snappystream
#
snappystream
snappy
iomp5
mklml_intel
xxhash
)
mkldnn
xxhash
)
demo-serving/CMakeLists.txt
浏览文件 @
a0b68bc1
...
...
@@ -75,7 +75,10 @@ install(FILES ${inc}
DESTINATION
${
PADDLE_SERVING_INSTALL_DIR
}
/include/serving
)
if
(
${
WITH_MKL
}
)
install
(
FILES
${
CMAKE_BINARY_DIR
}
/Paddle/third_party/install/mklml/lib/libmklml_intel.so
${
CMAKE_BINARY_DIR
}
/Paddle/third_party/install/mklml/lib/libiomp5.so DESTINATION
install
(
FILES
${
CMAKE_BINARY_DIR
}
/third_party/install/Paddle/third_party/install/mklml/lib/libmklml_intel.so
${
CMAKE_BINARY_DIR
}
/third_party/install/Paddle/third_party/install/mklml/lib/libiomp5.so
${
CMAKE_BINARY_DIR
}
/third_party/install/Paddle/third_party/install/mkldnn/lib/libmkldnn.so.0
DESTINATION
${
PADDLE_SERVING_INSTALL_DIR
}
/demo/serving/bin
)
endif
()
demo-serving/op/classify_op.h
浏览文件 @
a0b68bc1
...
...
@@ -21,7 +21,7 @@
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#endif
#else
#include "paddle
/fluid/inference/paddle_inference_api.h"
#include "paddle
_inference_api.h" // NOLINT
#endif
#include "demo-serving/image_class.pb.h"
...
...
demo-serving/op/ctr_prediction_op.h
浏览文件 @
a0b68bc1
...
...
@@ -21,7 +21,7 @@
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#endif
#else
#include "paddle
/fluid/inference/paddle_inference_api.h"
#include "paddle
_inference_api.h" // NOLINT
#endif
#include "demo-serving/ctr_prediction.pb.h"
...
...
demo-serving/op/reader_op.h
浏览文件 @
a0b68bc1
...
...
@@ -35,7 +35,7 @@
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#endif
#else
#include "paddle
/fluid/inference/paddle_inference_api.h"
#include "paddle
_inference_api.h" // NOLINT
#endif
namespace
baidu
{
...
...
demo-serving/op/text_classification_op.h
浏览文件 @
a0b68bc1
...
...
@@ -21,7 +21,7 @@
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#endif
#else
#include "paddle
/fluid/inference/paddle_inference_api.h"
#include "paddle
_inference_api.h" // NOLINT
#endif
#include "demo-serving/text_classification.pb.h"
...
...
inferencer-fluid-cpu/include/fluid_cpu_engine.h
浏览文件 @
a0b68bc1
...
...
@@ -28,7 +28,7 @@
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#endif
#else
#include "paddle
/fluid/inference/paddle_inference_api.h"
#include "paddle
_inference_api.h" // NOLINT
#endif
#include "predictor/framework/infer.h"
...
...
inferencer-fluid-gpu/include/fluid_gpu_engine.h
浏览文件 @
a0b68bc1
...
...
@@ -28,7 +28,7 @@
#include "paddle/fluid/inference/api/paddle_inference_api.h"
#endif
#else
#include "paddle
/fluid/inference/paddle_inference_api.h"
#include "paddle
_inference_api.h" // NOLINT
#endif
#include "predictor/framework/infer.h"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录