diff --git a/README.md b/README.md
index 76e46b968aa77dac12ce241ebf66d53eebda5462..8184a3b0dfa7271c96b9b34fd7ed1a1900529a4c 100644
--- a/README.md
+++ b/README.md
@@ -53,7 +53,7 @@ We consider deploying deep learning inference service online to be a user-facing
AIStudio Turorial
-Here we provide tutorial on AIStudio(Chinese Version) [AIStudio教程-Paddle Serving服务化部署框架](https://aistudio.baidu.com/aistudio/projectdetail/1550674)
+Here we provide tutorial on AIStudio(Chinese Version) [AIStudio教程-Paddle Serving服务化部署框架](https://www.paddlepaddle.org.cn/tutorials/projectdetail/1555945)
The tutorial provides
@@ -85,14 +85,14 @@ We **highly recommend** you to **run Paddle Serving in Docker**, please visit [R
```
# Run CPU Docker
docker pull registry.baidubce.com/paddlepaddle/serving:0.5.0-devel
-docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-devel
+docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-devel bash
docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
```
```
# Run GPU Docker
nvidia-docker pull registry.baidubce.com/paddlepaddle/serving:0.5.0-cuda10.2-cudnn8-devel
-nvidia-docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-cuda10.2-cudnn8-devel
+nvidia-docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-cuda10.2-cudnn8-devel bash
nvidia-docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
```
diff --git a/README_CN.md b/README_CN.md
index 2cae7b525833f9c60411ea6c7f48f3860e22a10b..d166d7c0ffb558ae309afb1fec572ad79ab5f679 100644
--- a/README_CN.md
+++ b/README_CN.md
@@ -53,7 +53,7 @@ Paddle Serving 旨在帮助深度学习开发者轻易部署在线预测服务
教程
-Paddle Serving开发者为您提供了简单易用的[AIStudio教程-Paddle Serving服务化部署框架](https://aistudio.baidu.com/aistudio/projectdetail/1550674)
+Paddle Serving开发者为您提供了简单易用的[AIStudio教程-Paddle Serving服务化部署框架](https://www.paddlepaddle.org.cn/tutorials/projectdetail/1555945)
教程提供了如下内容
@@ -86,14 +86,14 @@ Paddle Serving开发者为您提供了简单易用的[AIStudio教程-Paddle Serv
```
# 启动 CPU Docker
docker pull registry.baidubce.com/paddlepaddle/serving:0.5.0-devel
-docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-devel
+docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-devel bash
docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
```
```
# 启动 GPU Docker
nvidia-docker pull registry.baidubce.com/paddlepaddle/serving:0.5.0-cuda10.2-cudnn8-devel
-nvidia-docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-cuda10.2-cudnn8-devel
+nvidia-docker run -p 9292:9292 --name test -dit registry.baidubce.com/paddlepaddle/serving:0.5.0-cuda10.2-cudnn8-devel bash
nvidia-docker exec -it test bash
git clone https://github.com/PaddlePaddle/Serving
```
diff --git a/cmake/paddlepaddle.cmake b/cmake/paddlepaddle.cmake
index 8a88db9797c90689858468a42673da266c59ae2c..1421f52c0828bbe0917eccb5fecf72e1f3057961 100644
--- a/cmake/paddlepaddle.cmake
+++ b/cmake/paddlepaddle.cmake
@@ -18,7 +18,7 @@ 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)
+SET(PADDLE_LIBRARIES "${PADDLE_INSTALL_DIR}/lib/libpaddle_inference.a" CACHE FILEPATH "Paddle library." FORCE)
message("paddle install dir: " ${PADDLE_INSTALL_DIR})
@@ -31,7 +31,7 @@ message( "WITH_GPU = ${WITH_GPU}")
# Paddle Version should be one of:
# latest: latest develop build
# version number like 1.5.2
-SET(PADDLE_VERSION "2.0.0")
+SET(PADDLE_VERSION "2.0.1")
if (WITH_GPU)
if(CUDA_VERSION EQUAL 11.0)
set(CUDA_SUFFIX "cuda11-cudnn8-avx-mkl")
@@ -55,9 +55,9 @@ if (WITH_GPU)
SET(PADDLE_LIB_VERSION "${PADDLE_VERSION}-gpu-${CUDA_SUFFIX}")
elseif (WITH_LITE)
if (WITH_XPU)
- SET(PADDLE_LIB_VERSION "${PADDLE_VERSION}-arm-xpu")
+ SET(PADDLE_LIB_VERSION "${PADDLE_VERSION}-${CMAKE_SYSTEM_PROCESSOR}-xpu")
else()
- SET(PADDLE_LIB_VERSION "${PADDLE_VERSION}-arm")
+ SET(PADDLE_LIB_VERSION "${PADDLE_VERSION}-${CMAKE_SYSTEM_PROCESSOR}")
endif()
else()
if (WITH_AVX)
@@ -139,8 +139,8 @@ LINK_DIRECTORIES(${PADDLE_INSTALL_DIR}/third_party/install/mkldnn/lib)
ADD_LIBRARY(openblas STATIC IMPORTED GLOBAL)
SET_PROPERTY(TARGET openblas PROPERTY IMPORTED_LOCATION ${PADDLE_INSTALL_DIR}/third_party/install/openblas/lib/libopenblas.a)
-ADD_LIBRARY(paddle_fluid STATIC IMPORTED GLOBAL)
-SET_PROPERTY(TARGET paddle_fluid PROPERTY IMPORTED_LOCATION ${PADDLE_INSTALL_DIR}/lib/libpaddle_fluid.a)
+ADD_LIBRARY(paddle_inference STATIC IMPORTED GLOBAL)
+SET_PROPERTY(TARGET paddle_inference PROPERTY IMPORTED_LOCATION ${PADDLE_INSTALL_DIR}/lib/libpaddle_inference.a)
if (WITH_TRT)
ADD_LIBRARY(nvinfer SHARED IMPORTED GLOBAL)
diff --git a/core/configure/CMakeLists.txt b/core/configure/CMakeLists.txt
index 8e2b62eb64549bbd2b60f6e744eca3245f884bac..32534fee141ee5b4b0b7b1eed580e1769deb5cff 100644
--- a/core/configure/CMakeLists.txt
+++ b/core/configure/CMakeLists.txt
@@ -1,120 +1,94 @@
if (SERVER OR CLIENT)
-LIST(APPEND protofiles
- ${CMAKE_CURRENT_LIST_DIR}/proto/server_configure.proto
- ${CMAKE_CURRENT_LIST_DIR}/proto/sdk_configure.proto
- ${CMAKE_CURRENT_LIST_DIR}/proto/inferencer_configure.proto
- ${CMAKE_CURRENT_LIST_DIR}/proto/general_model_config.proto
-)
-
-PROTOBUF_GENERATE_CPP(configure_proto_srcs configure_proto_hdrs ${protofiles})
-list(APPEND configure_srcs ${configure_proto_srcs})
-
-list(APPEND configure_srcs ${CMAKE_CURRENT_LIST_DIR}/src/configure_parser.cpp)
-
-add_library(configure ${configure_srcs})
-add_dependencies(configure brpc)
-
-install(TARGETS configure
- ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
- )
-
-install(FILES ${CMAKE_CURRENT_LIST_DIR}/include/configure_parser.h
- DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure/include)
-
-FILE(GLOB inc ${CMAKE_CURRENT_BINARY_DIR}/*.pb.h)
-
-install(FILES ${inc}
- DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure)
+ LIST(APPEND protofiles
+ ${CMAKE_CURRENT_LIST_DIR}/proto/server_configure.proto
+ ${CMAKE_CURRENT_LIST_DIR}/proto/sdk_configure.proto
+ ${CMAKE_CURRENT_LIST_DIR}/proto/inferencer_configure.proto
+ ${CMAKE_CURRENT_LIST_DIR}/proto/general_model_config.proto
+ )
+
+ PROTOBUF_GENERATE_CPP(configure_proto_srcs configure_proto_hdrs ${protofiles})
+ list(APPEND configure_srcs ${configure_proto_srcs})
+
+ list(APPEND configure_srcs ${CMAKE_CURRENT_LIST_DIR}/src/configure_parser.cpp)
+
+ add_library(configure ${configure_srcs})
+ add_dependencies(configure brpc)
+
+ install(TARGETS configure
+ ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
+ )
+
+ install(FILES ${CMAKE_CURRENT_LIST_DIR}/include/configure_parser.h
+ DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure/include)
+
+ FILE(GLOB inc ${CMAKE_CURRENT_BINARY_DIR}/*.pb.h)
+
+ install(FILES ${inc}
+ DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure)
endif()
if (WITH_PYTHON)
-py_proto_compile(general_model_config_py_proto SRCS proto/general_model_config.proto)
-add_custom_target(general_model_config_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
-add_dependencies(general_model_config_py_proto general_model_config_py_proto_init)
-
-py_grpc_proto_compile(multi_lang_general_model_service_py_proto SRCS proto/multi_lang_general_model_service.proto)
-add_custom_target(multi_lang_general_model_service_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
-add_dependencies(multi_lang_general_model_service_py_proto multi_lang_general_model_service_py_proto_init)
-
-if (CLIENT)
-py_proto_compile(sdk_configure_py_proto SRCS proto/sdk_configure.proto)
-add_custom_target(sdk_configure_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
-add_dependencies(sdk_configure_py_proto sdk_configure_py_proto_init)
-add_custom_command(TARGET sdk_configure_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
- COMMENT "Copy generated python proto into directory paddle_serving_client/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
-add_custom_command(TARGET general_model_config_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
- COMMENT "Copy generated general_model_config proto file into directory paddle_serving_client/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
-add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
- COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_client/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
-if (APP)
-add_custom_command(TARGET general_model_config_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/proto
- COMMENT "Copy generated general_model_config proto file into directory paddle_serving_app/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-endif()
-
-if (SERVER)
-py_proto_compile(server_config_py_proto SRCS proto/server_configure.proto)
-add_custom_target(server_config_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
-add_dependencies(server_config_py_proto server_config_py_proto_init)
-if (NOT WITH_GPU AND NOT WITH_LITE)
-add_custom_command(TARGET server_config_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
- COMMENT "Copy generated python proto into directory paddle_serving_server/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINRARY_DIR})
-
-add_custom_command(TARGET general_model_config_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
- COMMENT "Copy generated general_model_config proto file into directory paddle_serving_server/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
-add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
- COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_server/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-else()
-add_custom_command(TARGET server_config_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory
- ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
- COMMAND cp -f *.py
- ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
- COMMENT "Copy generated python proto into directory
- paddle_serving_server_gpu/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINRARY_DIR})
-
-add_custom_command(TARGET general_model_config_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory
- ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
- COMMAND cp -f *.py
- ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
- COMMENT "Copy generated general_model_config proto file into directory
- paddle_serving_server_gpu/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
-add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
- COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
- COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server_gpu/proto
- COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_server_gpu/proto."
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-endif()
-endif()
+ py_proto_compile(general_model_config_py_proto SRCS proto/general_model_config.proto)
+ add_custom_target(general_model_config_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
+ add_dependencies(general_model_config_py_proto general_model_config_py_proto_init)
+
+ py_grpc_proto_compile(multi_lang_general_model_service_py_proto SRCS proto/multi_lang_general_model_service.proto)
+ add_custom_target(multi_lang_general_model_service_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
+ add_dependencies(multi_lang_general_model_service_py_proto multi_lang_general_model_service_py_proto_init)
+
+ if (CLIENT)
+ py_proto_compile(sdk_configure_py_proto SRCS proto/sdk_configure.proto)
+ add_custom_target(sdk_configure_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
+ add_dependencies(sdk_configure_py_proto sdk_configure_py_proto_init)
+ add_custom_command(TARGET sdk_configure_py_proto POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
+ COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
+ COMMENT "Copy generated python proto into directory paddle_serving_client/proto."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_command(TARGET general_model_config_py_proto POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
+ COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
+ COMMENT "Copy generated general_model_config proto file into directory paddle_serving_client/proto."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
+ COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_client/proto
+ COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_client/proto."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
+
+ if (APP)
+ add_custom_command(TARGET general_model_config_py_proto POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/proto
+ COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_app/proto
+ COMMENT "Copy generated general_model_config proto file into directory paddle_serving_app/proto."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
+
+ if (SERVER)
+ py_proto_compile(server_config_py_proto SRCS proto/server_configure.proto)
+ add_custom_target(server_config_py_proto_init ALL COMMAND ${CMAKE_COMMAND} -E touch __init__.py)
+ add_dependencies(server_config_py_proto server_config_py_proto_init)
+ add_custom_command(TARGET server_config_py_proto POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
+ COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
+ COMMENT "Copy generated python proto into directory paddle_serving_server/proto."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINRARY_DIR})
+
+ add_custom_command(TARGET general_model_config_py_proto POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
+ COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
+ COMMENT "Copy generated general_model_config proto file into directory paddle_serving_server/proto."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+
+ add_custom_command(TARGET multi_lang_general_model_service_py_proto POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
+ COMMAND cp -f *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving_server/proto
+ COMMENT "Copy generated multi_lang_general_model_service proto file into directory paddle_serving_server/proto."
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
+ endif()
endif()
diff --git a/core/configure/proto/server_configure.proto b/core/configure/proto/server_configure.proto
index ea03d44f2cf3ff42b3b603ff9ddca7127fe8c15a..62537d01d3f0cea52c8117561080720695c1e2c6 100644
--- a/core/configure/proto/server_configure.proto
+++ b/core/configure/proto/server_configure.proto
@@ -20,7 +20,7 @@ message EngineDesc {
required string type = 2;
required string reloadable_meta = 3;
required string reloadable_type = 4;
- required string model_data_path = 5;
+ required string model_dir = 5;
required int32 runtime_thread_num = 6;
required int32 batch_infer_size = 7;
required int32 enable_batch_align = 8;
@@ -41,12 +41,13 @@ message EngineDesc {
optional SparseParamServiceType sparse_param_service_type = 11;
optional string sparse_param_service_table_name = 12;
optional bool enable_memory_optimization = 13;
- optional bool static_optimization = 14;
- optional bool force_update_static_cache = 15;
- optional bool enable_ir_optimization = 16;
- optional bool use_trt = 17;
- optional bool use_lite = 18;
- optional bool use_xpu = 19;
+ optional bool enable_ir_optimization = 14;
+ optional bool use_trt = 15;
+ optional bool use_lite = 16;
+ optional bool use_xpu = 17;
+ optional bool use_gpu = 18;
+ optional bool combined_model = 19;
+ optional bool encrypted_model = 20;
};
// model_toolkit conf
diff --git a/core/configure/tests/test_configure.cpp b/core/configure/tests/test_configure.cpp
index 9ef35acb0ba22fc4bdc274ba5ee550605a7b3016..816085fa4317ded2043dd337330fcf5a69a505ce 100644
--- a/core/configure/tests/test_configure.cpp
+++ b/core/configure/tests/test_configure.cpp
@@ -69,8 +69,6 @@ int test_write_conf() {
engine->set_sparse_param_service_type(EngineDesc::LOCAL);
engine->set_sparse_param_service_table_name("local_kv");
engine->set_enable_memory_optimization(true);
- engine->set_static_optimization(false);
- engine->set_force_update_static_cache(false);
int ret = baidu::paddle_serving::configure::write_proto_conf(
&model_toolkit_conf, output_dir, model_toolkit_conf_file);
diff --git a/core/general-client/CMakeLists.txt b/core/general-client/CMakeLists.txt
index ddacb8d53d141e242fe6222a837ec8997608382b..d6079317a75d3f45b61920836e6695bd6b31d951 100644
--- a/core/general-client/CMakeLists.txt
+++ b/core/general-client/CMakeLists.txt
@@ -1,6 +1,5 @@
if(CLIENT)
add_subdirectory(pybind11)
pybind11_add_module(serving_client src/general_model.cpp src/pybind_general_model.cpp)
-add_dependencies(serving_client sdk_cpp)
target_link_libraries(serving_client PRIVATE -Wl,--whole-archive utils sdk-cpp pybind python -Wl,--no-whole-archive -lpthread -lcrypto -lm -lrt -lssl -ldl -lz -Wl,-rpath,'$ORIGIN'/lib)
endif()
diff --git a/core/general-server/CMakeLists.txt b/core/general-server/CMakeLists.txt
index 48f154b0ebf0600c84990daa089feaea0eb85446..6ea0b5e490ff0ea8954780799fb6f1b0aa00d0bb 100644
--- a/core/general-server/CMakeLists.txt
+++ b/core/general-server/CMakeLists.txt
@@ -2,33 +2,25 @@ include_directories(SYSTEM ${CMAKE_CURRENT_LIST_DIR}/../../)
include(op/CMakeLists.txt)
include(proto/CMakeLists.txt)
add_executable(serving ${serving_srcs})
-add_dependencies(serving pdcodegen fluid_cpu_engine pdserving paddle_fluid cube-api utils)
+add_dependencies(serving pdcodegen paddle_inference_engine pdserving paddle_inference cube-api utils)
+
if (WITH_GPU)
- add_dependencies(serving fluid_gpu_engine)
+ add_dependencies(serving paddle_inference_engine)
endif()
if (WITH_LITE)
- add_dependencies(serving fluid_arm_engine)
+ add_dependencies(serving paddle_inference_engine)
endif()
target_include_directories(serving PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/../../core/predictor
- )
- include_directories(${CUDNN_ROOT}/include/)
-if(WITH_GPU)
- target_link_libraries(serving -Wl,--whole-archive fluid_gpu_engine
- -Wl,--no-whole-archive)
-endif()
-
-if(WITH_LITE)
- target_link_libraries(serving -Wl,--whole-archive fluid_arm_engine
- -Wl,--no-whole-archive)
-endif()
+)
+include_directories(${CUDNN_ROOT}/include/)
-target_link_libraries(serving -Wl,--whole-archive fluid_cpu_engine
+target_link_libraries(serving -Wl,--whole-archive paddle_inference_engine
-Wl,--no-whole-archive)
-target_link_libraries(serving paddle_fluid ${paddle_depend_libs})
+target_link_libraries(serving paddle_inference ${paddle_depend_libs})
target_link_libraries(serving brpc)
target_link_libraries(serving protobuf)
target_link_libraries(serving pdserving)
diff --git a/core/predictor/CMakeLists.txt b/core/predictor/CMakeLists.txt
index 10fcd0b23b2d76a3e693bc29e07f5add663dbcdf..baa7cf18fd6efc367c15a524fba611cfd72eb972 100644
--- a/core/predictor/CMakeLists.txt
+++ b/core/predictor/CMakeLists.txt
@@ -12,12 +12,12 @@ set_source_files_properties(
${pdserving_srcs}
PROPERTIES
COMPILE_FLAGS "-Wno-strict-aliasing -Wno-unused-variable -Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor")
-add_dependencies(pdserving protobuf boost brpc leveldb pdcodegen configure extern_paddle paddle_fluid)
+add_dependencies(pdserving protobuf boost brpc leveldb pdcodegen configure extern_paddle paddle_inference)
if (WITH_TRT)
add_definitions(-DWITH_TRT)
endif()
target_link_libraries(pdserving
- brpc protobuf boost leveldb configure -lpthread -lcrypto -lm -lrt -lssl -ldl -lz paddle_fluid ${paddle_depend_libs})
+ brpc protobuf boost leveldb configure -lpthread -lcrypto -lm -lrt -lssl -ldl -lz paddle_inference ${paddle_depend_libs})
# install
install(TARGETS pdserving
RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/bin
diff --git a/core/predictor/common/utils.h b/core/predictor/common/utils.h
index a1cdb0db08009b4685e9183244d8e59190e7607d..052f90b166f04a28d0e7aeb427884921abdcab5e 100644
--- a/core/predictor/common/utils.h
+++ b/core/predictor/common/utils.h
@@ -14,6 +14,7 @@
#pragma once
#include
+#include
#include "core/predictor/common/inner_common.h"
#include "core/predictor/common/macros.h"
@@ -148,6 +149,16 @@ class IsDerivedFrom {
}
};
+static void ReadBinaryFile(const std::string& filename, std::string* contents) {
+ std::ifstream fin(filename, std::ios::in | std::ios::binary);
+ fin.seekg(0, std::ios::end);
+ contents->clear();
+ contents->resize(fin.tellg());
+ fin.seekg(0, std::ios::beg);
+ fin.read(&(contents->at(0)), contents->size());
+ fin.close();
+}
+
} // namespace predictor
} // namespace paddle_serving
} // namespace baidu
diff --git a/core/predictor/framework/infer.h b/core/predictor/framework/infer.h
index ba0c18e06c298553af10836fd488c6cffcd92226..fcd3038c85174fd62d2f6157b003d91f8c830f2a 100644
--- a/core/predictor/framework/infer.h
+++ b/core/predictor/framework/infer.h
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -29,83 +30,29 @@ namespace predictor {
using configure::ModelToolkitConf;
-class InferEngineCreationParams {
+class AutoLock {
public:
- InferEngineCreationParams() {
- _path = "";
- _enable_memory_optimization = false;
- _enable_ir_optimization = false;
- _static_optimization = false;
- _force_update_static_cache = false;
- _use_trt = false;
- _use_lite = false;
- _use_xpu = false;
+ explicit AutoLock(pthread_mutex_t& mutex) : _mut(mutex) {
+ pthread_mutex_lock(&mutex);
}
+ ~AutoLock() { pthread_mutex_unlock(&_mut); }
- void set_path(const std::string& path) { _path = path; }
-
- void set_enable_memory_optimization(bool enable_memory_optimization) {
- _enable_memory_optimization = enable_memory_optimization;
- }
-
- void set_enable_ir_optimization(bool enable_ir_optimization) {
- _enable_ir_optimization = enable_ir_optimization;
- }
-
- void set_use_trt(bool use_trt) { _use_trt = use_trt; }
-
- void set_use_lite(bool use_lite) { _use_lite = use_lite; }
-
- void set_use_xpu(bool use_xpu) { _use_xpu = use_xpu; }
-
- bool enable_memory_optimization() const {
- return _enable_memory_optimization;
- }
-
- bool enable_ir_optimization() const { return _enable_ir_optimization; }
-
- bool use_trt() const { return _use_trt; }
-
- bool use_lite() const { return _use_lite; }
-
- bool use_xpu() const { return _use_xpu; }
-
- void set_static_optimization(bool static_optimization = false) {
- _static_optimization = static_optimization;
- }
-
- void set_force_update_static_cache(bool force_update_static_cache = false) {
- _force_update_static_cache = force_update_static_cache;
- }
-
- bool static_optimization() const { return _static_optimization; }
-
- bool force_update_static_cache() const { return _force_update_static_cache; }
+ private:
+ pthread_mutex_t& _mut;
+};
- std::string get_path() const { return _path; }
+class GlobalCreateMutex {
+ public:
+ pthread_mutex_t& mutex() { return _mut; }
- void dump() const {
- LOG(INFO) << "InferEngineCreationParams: "
- << "model_path = " << _path << ", "
- << "enable_memory_optimization = " << _enable_memory_optimization
- << ", "
- << "enable_tensorrt = " << _use_trt << ", "
- << "enable_lite = " << _use_lite << ", "
- << "enable_xpu = " << _use_xpu << ", "
- << "enable_ir_optimization = " << _enable_ir_optimization << ", "
- << "static_optimization = " << _static_optimization << ", "
- << "force_update_static_cache = " << _force_update_static_cache;
+ static pthread_mutex_t& instance() {
+ static GlobalCreateMutex gmutex;
+ return gmutex.mutex();
}
private:
- std::string _path;
- bool _enable_memory_optimization;
- bool _enable_ir_optimization;
- bool _static_optimization;
- bool _force_update_static_cache;
- bool _use_trt;
- bool _use_lite;
- bool _use_xpu;
+ GlobalCreateMutex() { pthread_mutex_init(&_mut, NULL); }
+ pthread_mutex_t _mut;
};
class InferEngine {
@@ -152,57 +99,19 @@ class ReloadableInferEngine : public InferEngine {
uint64_t last_revision;
};
- virtual int load(const InferEngineCreationParams& params) = 0;
+ virtual int load(const configure::EngineDesc& conf) = 0;
int proc_initialize_impl(const configure::EngineDesc& conf, bool version) {
_reload_tag_file = conf.reloadable_meta();
_reload_mode_tag = conf.reloadable_type();
- _model_data_path = conf.model_data_path();
+ _model_data_path = conf.model_dir();
_infer_thread_num = conf.runtime_thread_num();
_infer_batch_size = conf.batch_infer_size();
_infer_batch_align = conf.enable_batch_align();
- bool enable_memory_optimization = false;
- if (conf.has_enable_memory_optimization()) {
- enable_memory_optimization = conf.enable_memory_optimization();
- }
-
- bool static_optimization = false;
- if (conf.has_static_optimization()) {
- static_optimization = conf.static_optimization();
- }
-
- bool force_update_static_cache = false;
- if (conf.has_force_update_static_cache()) {
- force_update_static_cache = conf.force_update_static_cache();
- }
+ _conf = conf;
- if (conf.has_enable_ir_optimization()) {
- _infer_engine_params.set_enable_ir_optimization(
- conf.enable_ir_optimization());
- }
-
- _infer_engine_params.set_path(_model_data_path);
- if (enable_memory_optimization) {
- _infer_engine_params.set_enable_memory_optimization(true);
- _infer_engine_params.set_static_optimization(static_optimization);
- _infer_engine_params.set_force_update_static_cache(
- force_update_static_cache);
- }
-
- if (conf.has_use_trt()) {
- _infer_engine_params.set_use_trt(conf.use_trt());
- }
-
- if (conf.has_use_lite()) {
- _infer_engine_params.set_use_lite(conf.use_lite());
- }
-
- if (conf.has_use_xpu()) {
- _infer_engine_params.set_use_xpu(conf.use_xpu());
- }
-
- if (!check_need_reload() || load(_infer_engine_params) != 0) {
+ if (!check_need_reload() || load(conf) != 0) {
LOG(ERROR) << "Failed load model_data_path" << _model_data_path;
return -1;
}
@@ -230,7 +139,6 @@ class ReloadableInferEngine : public InferEngine {
if (_infer_thread_num > 0) {
return 0;
}
-
return thrd_initialize_impl();
}
@@ -254,13 +162,13 @@ class ReloadableInferEngine : public InferEngine {
int reload() {
if (check_need_reload()) {
LOG(WARNING) << "begin reload model[" << _model_data_path << "].";
- return load(_infer_engine_params);
+ return load(_conf);
}
return 0;
}
uint64_t version() const { return _version; }
-
+
uint32_t thread_num() const { return _infer_thread_num; }
private:
@@ -322,7 +230,7 @@ class ReloadableInferEngine : public InferEngine {
protected:
std::string _model_data_path;
- InferEngineCreationParams _infer_engine_params;
+ configure::EngineDesc _conf;
private:
std::string _reload_tag_file;
@@ -361,25 +269,25 @@ class DBReloadableInferEngine : public ReloadableInferEngine {
return ReloadableInferEngine::proc_initialize(conf, version);
}
- virtual int load(const InferEngineCreationParams& params) {
+ virtual int load(const configure::EngineDesc& conf) {
if (_reload_vec.empty()) {
return 0;
}
for (uint32_t ti = 0; ti < _reload_vec.size(); ++ti) {
- if (load_data(_reload_vec[ti], params) != 0) {
+ if (load_data(_reload_vec[ti], conf) != 0) {
LOG(ERROR) << "Failed reload engine model: " << ti;
return -1;
}
}
- LOG(WARNING) << "Succ load engine, path: " << params.get_path();
+ LOG(WARNING) << "Succ load engine, path: " << conf.model_dir();
return 0;
}
int load_data(ModelData* md,
- const InferEngineCreationParams& params) {
+ const configure::EngineDesc& conf) {
uint32_t next_idx = (md->current_idx + 1) % 2;
if (md->cores[next_idx]) {
delete md->cores[next_idx];
@@ -387,9 +295,9 @@ class DBReloadableInferEngine : public ReloadableInferEngine {
md->cores[next_idx] = new (std::nothrow) EngineCore;
- params.dump();
- if (!md->cores[next_idx] || md->cores[next_idx]->create(params) != 0) {
- LOG(ERROR) << "Failed create model, path: " << params.get_path();
+ //params.dump();
+ if (!md->cores[next_idx] || md->cores[next_idx]->create(conf) != 0) {
+ LOG(ERROR) << "Failed create model, path: " << conf.model_dir();
return -1;
}
md->current_idx = next_idx;
@@ -400,9 +308,9 @@ class DBReloadableInferEngine : public ReloadableInferEngine {
// memory pool to be inited in non-serving-threads
ModelData* md = new (std::nothrow) ModelData;
- if (!md || load_data(md, _infer_engine_params) != 0) {
+ if (!md || load_data(md, _conf) != 0) {
LOG(ERROR) << "Failed create thread data from "
- << _infer_engine_params.get_path();
+ << _conf.model_dir();
return -1;
}
@@ -458,16 +366,16 @@ class CloneDBReloadableInferEngine
return DBReloadableInferEngine::proc_initialize(conf, version);
}
- virtual int load(const InferEngineCreationParams& params) {
+ virtual int load(const configure::EngineDesc& conf) {
// 加载进程级模型数据
if (!_pd ||
- DBReloadableInferEngine::load_data(_pd, params) != 0) {
- LOG(ERROR) << "Failed to create common model from [" << params.get_path()
+ DBReloadableInferEngine::load_data(_pd, conf) != 0) {
+ LOG(ERROR) << "Failed to create common model from [" << conf.model_dir()
<< "].";
return -1;
}
LOG(WARNING) << "Succ load common model[" << _pd->cores[_pd->current_idx]
- << "], path[" << params.get_path() << "].";
+ << "], path[" << conf.model_dir() << "].";
if (DBReloadableInferEngine::_reload_vec.empty()) {
return 0;
@@ -483,7 +391,7 @@ class CloneDBReloadableInferEngine
}
}
- LOG(WARNING) << "Succ load clone model, path[" << params.get_path() << "]";
+ LOG(WARNING) << "Succ load clone model, path[" << conf.model_dir() << "]";
return 0;
}
@@ -527,18 +435,18 @@ class CloneDBReloadableInferEngine
_pd; // 进程级EngineCore,多个线程级EngineCore共用该对象的模型数据
};
-template
+template
#ifdef WITH_TRT
-class FluidInferEngine : public DBReloadableInferEngine {
+class FluidInferEngine : public DBReloadableInferEngine {
#else
-class FluidInferEngine : public CloneDBReloadableInferEngine {
+class FluidInferEngine : public CloneDBReloadableInferEngine {
#endif
public: // NOLINT
FluidInferEngine() {}
~FluidInferEngine() {}
std::vector GetInputNames() {
- FluidFamilyCore* core =
- DBReloadableInferEngine::get_core();
+ PaddleInferenceCore* core =
+ DBReloadableInferEngine::get_core();
if (!core || !core->get()) {
LOG(ERROR) << "Failed get fluid core in GetInputHandle()";
}
@@ -546,8 +454,8 @@ class FluidInferEngine : public CloneDBReloadableInferEngine {
}
std::vector GetOutputNames() {
- FluidFamilyCore* core =
- DBReloadableInferEngine::get_core();
+ PaddleInferenceCore* core =
+ DBReloadableInferEngine::get_core();
if (!core || !core->get()) {
LOG(ERROR) << "Failed get fluid core in GetInputHandle()";
}
@@ -556,8 +464,8 @@ class FluidInferEngine : public CloneDBReloadableInferEngine {
std::unique_ptr GetInputHandle(
const std::string& name) {
- FluidFamilyCore* core =
- DBReloadableInferEngine::get_core();
+ PaddleInferenceCore* core =
+ DBReloadableInferEngine::get_core();
if (!core || !core->get()) {
LOG(ERROR) << "Failed get fluid core in GetInputHandle()";
}
@@ -566,8 +474,8 @@ class FluidInferEngine : public CloneDBReloadableInferEngine {
std::unique_ptr GetOutputHandle(
const std::string& name) {
- FluidFamilyCore* core =
- DBReloadableInferEngine::get_core();
+ PaddleInferenceCore* core =
+ DBReloadableInferEngine::get_core();
if (!core || !core->get()) {
LOG(ERROR) << "Failed get fluid core in GetOutputHandle()";
}
@@ -575,8 +483,8 @@ class FluidInferEngine : public CloneDBReloadableInferEngine {
}
int infer_impl() {
- FluidFamilyCore* core =
- DBReloadableInferEngine::get_core();
+ PaddleInferenceCore* core =
+ DBReloadableInferEngine::get_core();
if (!core || !core->get()) {
LOG(ERROR) << "Failed get fluid core in infer_impl()";
return -1;
diff --git a/doc/COMPILE.md b/doc/COMPILE.md
index ec1900a89b9b2f0112f0d44adc539b138438bba7..60c7203de19663eaa43a2d5d29f48d90fe27f969 100644
--- a/doc/COMPILE.md
+++ b/doc/COMPILE.md
@@ -77,7 +77,7 @@ export PYTHON_EXECUTABLE=$PYTHONROOT/bin/python3.8
## Install Python dependencies
```shell
-pip install -r python/requirements.txt
+pip install -r python/requirements.txt -i https://mirror.baidu.com/pypi/simple
```
If you use other Python version, please use the right `pip` accordingly.
@@ -123,14 +123,13 @@ Compared with CPU environment, GPU environment needs to refer to the following t
**It should be noted that the following table is used as a reference for non-Docker compilation environment. The Docker compilation environment has been configured with relevant parameters and does not need to be specified in cmake process. **
| cmake environment variable | meaning | GPU environment considerations | whether Docker environment is needed |
-|-----------------------|------------------------- ------------|-------------------------------|----- ---------------|
-| CUDA_TOOLKIT_ROOT_DIR | cuda installation path, usually /usr/local/cuda | Required for all environments | No
-(/usr/local/cuda) |
+|-----------------------|-------------------------------------|-------------------------------|--------------------|
+| CUDA_TOOLKIT_ROOT_DIR | cuda installation path, usually /usr/local/cuda | Required for all environments | No (/usr/local/cuda) |
| CUDNN_LIBRARY | The directory where libcudnn.so.* is located, usually /usr/local/cuda/lib64/ | Required for all environments | No (/usr/local/cuda/lib64/) |
| CUDA_CUDART_LIBRARY | The directory where libcudart.so.* is located, usually /usr/local/cuda/lib64/ | Required for all environments | No (/usr/local/cuda/lib64/) |
| TENSORRT_ROOT | The upper level directory of the directory where libnvinfer.so.* is located, depends on the TensorRT installation directory | Cuda 9.0/10.0 does not need, other needs | No (/usr) |
-If not in Docker environment, users can refer to the following execution methods. The specific path is subject to the current environment, and the code is only for reference.
+If not in Docker environment, users can refer to the following execution methods. The specific path is subject to the current environment, and the code is only for reference.TENSORRT_LIBRARY_PATH is related to the TensorRT version and should be set according to the actual situation。For example, in the cuda10.1 environment, the TensorRT version is 6.0 (/usr/local/TensorRT-6.0.1.5/targets/x86_64-linux-gnu/),In the cuda10.2 environment, the TensorRT version is 7.1 (/usr/local/TensorRT-7.1.3.4/targets/x86_64-linux-gnu/).
``` shell
export CUDA_PATH='/usr/local/cuda'
@@ -145,7 +144,7 @@ cmake -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR \
-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_PATH} \
-DCUDNN_LIBRARY=${CUDNN_LIBRARY} \
-DCUDA_CUDART_LIBRARY=${CUDA_CUDART_LIBRARY} \
- -DTENSORRT_ROOT=${TENSORRT_LIBRARY_PATH}
+ -DTENSORRT_ROOT=${TENSORRT_LIBRARY_PATH} \
-DSERVER=ON \
-DWITH_GPU=ON ..
make -j10
diff --git a/doc/COMPILE_CN.md b/doc/COMPILE_CN.md
index 740a33028c2c1fff7364e3d771360d4a579e3ae8..ec8a482e7cecb9a5d412e7759d688aa875b9aeef 100644
--- a/doc/COMPILE_CN.md
+++ b/doc/COMPILE_CN.md
@@ -76,7 +76,7 @@ export PYTHON_EXECUTABLE=$PYTHONROOT/bin/python3.8
## 安装Python依赖
```shell
-pip install -r python/requirements.txt
+pip install -r python/requirements.txt -i https://mirror.baidu.com/pypi/simple
```
如果使用其他Python版本,请使用对应版本的`pip`。
@@ -128,7 +128,7 @@ make -j10
| CUDA_CUDART_LIBRARY | libcudart.so.*所在目录,通常为/usr/local/cuda/lib64/ | 全部环境都需要 | 否(/usr/local/cuda/lib64/) |
| TENSORRT_ROOT | libnvinfer.so.*所在目录的上一级目录,取决于TensorRT安装目录 | Cuda 9.0/10.0不需要,其他需要 | 否(/usr) |
-非Docker环境下,用户可以参考如下执行方式,具体的路径以当时环境为准,代码仅作为参考。
+非Docker环境下,用户可以参考如下执行方式,具体的路径以当时环境为准,代码仅作为参考。TENSORRT_LIBRARY_PATH和TensorRT版本有关,要根据实际情况设置。例如在cuda10.1环境下TensorRT版本是6.0(/usr/local/TensorRT-6.0.1.5/targets/x86_64-linux-gnu/),在cuda10.2环境下TensorRT版本是7.1(/usr/local/TensorRT-7.1.3.4/targets/x86_64-linux-gnu/)。
``` shell
export CUDA_PATH='/usr/local/cuda'
@@ -143,7 +143,7 @@ cmake -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR \
-DCUDA_TOOLKIT_ROOT_DIR=${CUDA_PATH} \
-DCUDNN_LIBRARY=${CUDNN_LIBRARY} \
-DCUDA_CUDART_LIBRARY=${CUDA_CUDART_LIBRARY} \
- -DTENSORRT_ROOT=${TENSORRT_LIBRARY_PATH}
+ -DTENSORRT_ROOT=${TENSORRT_LIBRARY_PATH} \
-DSERVER=ON \
-DWITH_GPU=ON ..
make -j10
@@ -159,7 +159,7 @@ make -j10
mkdir client-build && cd client-build
cmake -DPYTHON_INCLUDE_DIR=$PYTHON_INCLUDE_DIR \
-DPYTHON_LIBRARIES=$PYTHON_LIBRARIES \
- -DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
+ -DPYTHON_EXECUTABLE=$PYTHON_EXECUTABLE \
-DCLIENT=ON ..
make -j10
```
diff --git a/doc/FAQ.md b/doc/FAQ.md
index b7b5ab98cfd101b6d15a24458abb9d4e7d91c109..cbcf514b938354589f0d5253cad74b295a5f677c 100644
--- a/doc/FAQ.md
+++ b/doc/FAQ.md
@@ -6,17 +6,17 @@
#### Q: Paddle Serving 、Paddle Inference、PaddleHub Serving三者的区别及联系?
-**A:** paddle serving是远程服务,即发起预测的设备(手机、浏览器、客户端等)与实际预测的硬件不在一起。 paddle inference是一个library,适合嵌入到一个大系统中保证预测效率,paddle serving调用了paddle inference做远程服务。paddlehub serving可以认为是一个示例,都会使用paddle serving作为统一预测服务入口。如果在web端交互,一般是调用远程服务的形式,可以使用paddle serving的web service搭建。
+**A:** paddle serving是远程服务,即发起预测的设备(手机、浏览器、客户端等)与实际预测的硬件不在一起。 paddle inference是一个library,适合嵌入到一个大系统中保证预测效率,paddle serving调用了paddle inference做远程服务。paddlehub serving可以认为是一个示例,都会使用paddle serving作为统一预测服务入口。如果在web端交互,一般是调用远程服务的形式,可以使用paddle serving的web service搭建。
#### Q: paddle-serving是否支持Int32支持
**A:** 在protobuf定feed_type和fetch_type编号与数据类型对应如下
- 0-int64
-
- 1-float32
-
- 2-int32
+ 0-int64
+
+ 1-float32
+
+ 2-int32
#### Q: paddle-serving是否支持windows和Linux环境下的多线程调用
@@ -37,6 +37,7 @@
## 安装问题
#### Q: pip install安装whl包过程,报错信息如下:
+
```
Collecting opencv-python
Using cached opencv-python-4.3.0.38.tar.gz (88.0 MB)
@@ -69,9 +70,11 @@ Collecting opencv-python
s = list(pattern)
TypeError: 'NoneType' object is not iterable
```
+
**A:** 指定opencv-python版本安装,pip install opencv-python==4.2.0.32,再安装whl包
#### Q: pip3 install whl包过程报错信息如下:
+
```
Complete output from command python setup.py egg_info:
Found cython-generated files...
@@ -80,13 +83,16 @@ Collecting opencv-python
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-taoxz02y/grpcio/
```
+
**A:** 需要升级pip3,再重新执行安装命令。
+
```
pip3 install --upgrade pip
pip3 install --upgrade setuptools
```
#### Q: 运行过程中报错,信息如下:
+
```
Traceback (most recent call last):
File "../../deploy/serving/test_client.py", line 18, in
@@ -97,7 +103,9 @@ Traceback (most recent call last):
from shapely.geometry import Polygon
ImportError: No module named shapely.geometry
```
+
**A:** 有2种方法,第一种通过pip/pip3安装shapely,第二种通过pip/pip3安装所有依赖组件。
+
```
方法1:
pip install shapely==1.7.0
@@ -116,7 +124,69 @@ pip install -r python/requirements.txt
**A:** 没有安装JDK,或者JAVA_HOME路径配置错误(正确配置是JDK路径,常见错误配置成JRE路径,例如正确路径参考JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/")。Java JDK安装参考https://segmentfault.com/a/1190000015389941
+## 环境问题
+
+#### Q:使用过程中出现CXXABI错误。
+
+这个问题出现的原因是Python使用的gcc版本和Serving所需的gcc版本对不上。对于Docker用户,推荐使用[Docker容器](./RUN_IN_DOCKER_CN.md),由于Docker容器内的Python版本与Serving在发布前都做过适配,这样就不会出现类似的错误。如果是其他开发环境,首先需要确保开发环境中具备GCC 8.2,如果没有gcc 8.2,参考安装方式
+
+```bash
+wget -q https://paddle-ci.gz.bcebos.com/gcc-8.2.0.tar.xz
+tar -xvf gcc-8.2.0.tar.xz && \
+cd gcc-8.2.0 && \
+unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE && \
+./contrib/download_prerequisites && \
+cd .. && mkdir temp_gcc82 && cd temp_gcc82 && \
+../gcc-8.2.0/configure --prefix=/usr/local/gcc-8.2 --enable-threads=posix --disable-checking --disable-multilib && \
+make -j8 && make install
+cd .. && rm -rf temp_gcc82
+cp ${lib_so_6} ${lib_so_6}.bak && rm -f ${lib_so_6} &&
+ln -s /usr/local/gcc-8.2/lib64/libgfortran.so.5 ${lib_so_5} && \
+ln -s /usr/local/gcc-8.2/lib64/libstdc++.so.6 ${lib_so_6} && \
+cp /usr/local/gcc-8.2/lib64/libstdc++.so.6.0.25 ${lib_path}
+```
+
+假如已经有了GCC 8.2,可以自行安装Python,此外我们也提供了两个GCC 8.2编译的[Python2.7](https://paddle-serving.bj.bcebos.com/others/Python2.7.17-gcc82.tar) 和 [Python3.6](https://paddle-serving.bj.bcebos.com/others/Python3.6.10-gcc82.tar) 。下载解压后,需要将对应的目录设置为`PYTHONROOT`,并设置`PATH`和`LD_LIBRARY_PATH`。
+
+```bash
+export PYTHONROOT=/path/of/python # 对应解压后的Python目录
+export PATH=$PYTHONROOT/bin:$PATH
+export LD_LIBRARY_PATH=$PYTHONROOT/lib:$LD_LIBRARY_PATH
+```
+
+#### Q:遇到libstdc++.so.6的版本不够的问题
+
+触发该问题的原因在于,编译Paddle Serving相关可执行程序和动态库,所采用的是GCC 8.2(Cuda 9.0和10.0的Server可执行程序受限Cuda兼容性采用GCC 4.8编译)。Python在调用的过程中,有可能链接到了其他GCC版本的 `libstdc++.so`。 需要做的就是受限确保所在环境具备GCC 8.2,其次将GCC8.2的`libstdc++.so.*`拷贝到某个目录例如`/home/libstdcpp`下。最后`export LD_LIBRARY_PATH=/home/libstdcpp:$LD_LIBRARY_PATH` 即可。
+
+#### Q: 遇到OPENSSL_1.0.1EC 符号找不到的问题。
+
+目前Serving的可执行程序和客户端动态库需要链接1.0.2k版本的openssl动态库。如果环境当中没有,可以执行
+
+```bash
+wget https://paddle-serving.bj.bcebos.com/others/centos_ssl.tar && \
+ tar xf centos_ssl.tar && rm -rf centos_ssl.tar && \
+ mv libcrypto.so.1.0.2k /usr/lib/libcrypto.so.1.0.2k && mv libssl.so.1.0.2k /usr/lib/libssl.so.1.0.2k && \
+ ln -sf /usr/lib/libcrypto.so.1.0.2k /usr/lib/libcrypto.so.10 && \
+ ln -sf /usr/lib/libssl.so.1.0.2k /usr/lib/libssl.so.10 && \
+ ln -sf /usr/lib/libcrypto.so.10 /usr/lib/libcrypto.so && \
+ ln -sf /usr/lib/libssl.so.10 /usr/lib/libssl.so
+```
+
+其中`/usr/lib` 可以换成其他目录,并确保该目录在`LD_LIBRARY_PATH`下。
+### GPU相关环境问题
+
+#### Q:需要做哪些检查确保Serving可以运行在GPU环境
+
+**注:如果是使用Serving提供的镜像不需要做下列检查,如果是其他开发环境可以参考以下指导。**
+
+首先需要确保`nvidia-smi`可用,其次需要确保所需的动态库so文件在`LD_LIBRARY_PATH`所在的目录(包括系统lib库)。
+
+(1)Cuda显卡驱动:文件名通常为 `libcuda.so.$DRIVER_VERSION` 例如驱动版本为440.10.15,文件名就是`libcuda.so.440.10.15`。
+
+(2)Cuda和Cudnn动态库:文件名通常为 `libcudart.so.$CUDA_VERSION`,和 `libcudnn.so.$CUDNN_VERSION`。例如Cuda9就是 `libcudart.so.9.0`,Cudnn7就是 `libcudnn.so.7`。Cuda和Cudnn与Serving的版本匹配参见[Serving所有镜像列表](DOCKER_IMAGES_CN.md#%E9%99%84%E5%BD%95%E6%89%80%E6%9C%89%E9%95%9C%E5%83%8F%E5%88%97%E8%A1%A8).
+
+ (3) Cuda10.1及更高版本需要TensorRT。安装TensorRT相关文件的脚本参考 [install_trt.sh](../tools/dockerfile/build_scripts/install_trt.sh).
## 部署问题
@@ -154,7 +224,7 @@ InvalidArgumentError: Device id must be less than GPU count, but received id is:
**A:**:1)使用[GPU docker](https://github.com/PaddlePaddle/Serving/blob/develop/doc/RUN_IN_DOCKER.md#gpunvidia-docker)解决环境问题
- 2)修改anaconda的虚拟环境下安装的python的gcc版本[参考](https://www.jianshu.com/p/c498b3d86f77)
+ 2)修改anaconda的虚拟环境下安装的python的gcc版本[参考](https://www.jianshu.com/p/c498b3d86f77)
#### Q: paddle-serving是否支持本地离线安装
@@ -221,9 +291,10 @@ client端的日志直接打印到标准输出。
**A:** 1)警告是glog组件打印的,告知glog初始化之前日志打印在STDERR
- 2)一般采用GLOG_v方式启动服务同时设置日志级别。
+ 2)一般采用GLOG_v方式启动服务同时设置日志级别。
例如:
+
```
GLOG_v=2 python -m paddle_serving_server.serve --model xxx_conf/ --port 9999
```
diff --git a/paddle_inference/CMakeLists.txt b/paddle_inference/CMakeLists.txt
index 4d41f87fbeffb26cf9fc0135f92499c080325e2f..ad97644e96300381453a729b09ee72f9ec00e1d6 100644
--- a/paddle_inference/CMakeLists.txt
+++ b/paddle_inference/CMakeLists.txt
@@ -13,13 +13,5 @@
# limitations under the License
if (NOT CLIENT_ONLY)
- add_subdirectory(inferencer-fluid-cpu)
-
- if (WITH_GPU)
- add_subdirectory(inferencer-fluid-gpu)
- endif()
-
- if (WITH_LITE)
- add_subdirectory(inferencer-fluid-arm)
- endif()
+ add_subdirectory(paddle)
endif()
diff --git a/paddle_inference/inferencer-fluid-arm/CMakeLists.txt b/paddle_inference/inferencer-fluid-arm/CMakeLists.txt
deleted file mode 100644
index cf415d9e039e84ddef964c5a84fc79b5970ed41f..0000000000000000000000000000000000000000
--- a/paddle_inference/inferencer-fluid-arm/CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-FILE(GLOB fluid_arm_engine_srcs ${CMAKE_CURRENT_LIST_DIR}/src/*.cpp)
-add_library(fluid_arm_engine ${fluid_arm_engine_srcs})
-target_include_directories(fluid_arm_engine PUBLIC
- ${CMAKE_BINARY_DIR}/Paddle/fluid_install_dir/)
-add_dependencies(fluid_arm_engine pdserving extern_paddle configure)
-target_link_libraries(fluid_arm_engine pdserving paddle_fluid -lpthread -lcrypto -lm -lrt -lssl -ldl -lz)
-
-install(TARGETS fluid_arm_engine
- ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib
- )
diff --git a/paddle_inference/inferencer-fluid-arm/include/fluid_arm_engine.h b/paddle_inference/inferencer-fluid-arm/include/fluid_arm_engine.h
deleted file mode 100644
index b3db6e1ad03d1822155918f9eb8714b6285972d1..0000000000000000000000000000000000000000
--- a/paddle_inference/inferencer-fluid-arm/include/fluid_arm_engine.h
+++ /dev/null
@@ -1,291 +0,0 @@
-// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#pragma once
-
-#include
-#include
-#include