提交 8eb9a133 编写于 作者: G guru4elephant

refine CMakeLists.txt

上级 b470d47a
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
...@@ -27,7 +27,7 @@ message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: " ...@@ -27,7 +27,7 @@ message(STATUS "CXX compiler: ${CMAKE_CXX_COMPILER}, version: "
message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: " message(STATUS "C compiler: ${CMAKE_C_COMPILER}, version: "
"${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
find_package(Git REQUIRED) find_package(Git REQUIRED)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
find_package(CUDA QUIET) find_package(CUDA QUIET)
...@@ -62,17 +62,20 @@ if (NOT DEFINED WITH_MKLDNN) ...@@ -62,17 +62,20 @@ if (NOT DEFINED WITH_MKLDNN)
endif() endif()
endif() endif()
if (NOT CLIENT_ONLY)
include(external/jsoncpp) include(external/jsoncpp)
include(external/leveldb)
include(external/rocksdb) include(external/rocksdb)
include(external/gtest)
endif()
include(external/snappy)
include(external/leveldb)
include(external/zlib) include(external/zlib)
include(external/boost) include(external/boost)
include(external/protobuf) include(external/protobuf)
include(external/brpc) include(external/brpc)
include(external/gflags) include(external/gflags)
include(external/glog) include(external/glog)
include(external/snappy)
include(external/gtest)
include(external/pybind11) include(external/pybind11)
include(external/python) include(external/python)
include(generic) include(generic)
...@@ -87,36 +90,54 @@ endif() ...@@ -87,36 +90,54 @@ endif()
include_directories(${PADDLE_SERVING_SOURCE_DIR}) include_directories(${PADDLE_SERVING_SOURCE_DIR})
include_directories(${PADDLE_SERVING_BINARY_DIR}) include_directories(${PADDLE_SERVING_BINARY_DIR})
if(NOT CLIENT_ONLY)
set(EXTERNAL_LIBS
jsoncpp
gflags
rocksdb
glog
protobuf
paddlepaddle
brpc)
endif()
set(EXTERNAL_LIBS set(EXTERNAL_LIBS
jsoncpp gflags
gflags glog
rocksdb protobuf
glog brpc
protobuf
paddlepaddle
brpc
) )
if(NOT CLIENT_ONLY)
if(WITH_MKLML) if(WITH_MKLML)
list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB}) list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB})
endif() endif()
endif()
if(NOT CLIENT_ONLY)
if(WITH_MKLDNN) if(WITH_MKLDNN)
list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB}) list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB})
endif() endif()
endif()
if (NOT CLIENT_ONLY) if (NOT CLIENT_ONLY)
list(APPEND EXTERNAL_LIBS paddlepaddle) list(APPEND EXTERNAL_LIBS paddlepaddle)
list(APPEND EXTERNAL_LIBS opencv) list(APPEND EXTERNAL_LIBS opencv)
endif() endif()
if(NOT CLIENT_ONLY)
add_subdirectory(cube) add_subdirectory(cube)
add_subdirectory(demo-client)
add_subdirectory(kvdb)
endif()
add_subdirectory(configure) add_subdirectory(configure)
add_subdirectory(pdcodegen) add_subdirectory(pdcodegen)
add_subdirectory(sdk-cpp) add_subdirectory(sdk-cpp)
add_subdirectory(demo-client) if(CLIENT_ONLY)
add_subdirectory(kvdb) add_subdirectory(general-client)
add_subdirectory(python)
endif()
if (NOT CLIENT_ONLY) if (NOT CLIENT_ONLY)
add_subdirectory(predictor) add_subdirectory(predictor)
...@@ -128,6 +149,8 @@ add_subdirectory(demo-serving) ...@@ -128,6 +149,8 @@ add_subdirectory(demo-serving)
endif() endif()
# Paddle Serving Solutions # Paddle Serving Solutions
if(NOT CLIENT_ONLY)
if (WITH_ELASTIC_CTR) if (WITH_ELASTIC_CTR)
add_subdirectory(elastic-ctr) add_subdirectory(elastic-ctr)
endif() endif()
endif()
...@@ -26,3 +26,12 @@ install(FILES ${CMAKE_CURRENT_LIST_DIR}/include/configure_parser.h ...@@ -26,3 +26,12 @@ install(FILES ${CMAKE_CURRENT_LIST_DIR}/include/configure_parser.h
FILE(GLOB inc ${CMAKE_CURRENT_BINARY_DIR}/*.pb.h) FILE(GLOB inc ${CMAKE_CURRENT_BINARY_DIR}/*.pb.h)
install(FILES ${inc} install(FILES ${inc}
DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure) DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/include/configure)
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/proto
COMMAND cp *.py ${PADDLE_SERVING_BINARY_DIR}/python/paddle_serving/proto
COMMENT "Copy generated python proto into directory paddle_serving/proto."
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
...@@ -16,27 +16,27 @@ syntax = "proto2"; ...@@ -16,27 +16,27 @@ syntax = "proto2";
package baidu.paddle_serving.configure; package baidu.paddle_serving.configure;
message ConnectionConf { message ConnectionConf {
required int32 connect_timeout_ms = 1; required int32 connect_timeout_ms = 1 [default = 2000];
required int32 rpc_timeout_ms = 2; required int32 rpc_timeout_ms = 2 [default = 20000];
required int32 connect_retry_count = 3; required int32 connect_retry_count = 3 [default = 2];
required int32 max_connection_per_host = 4; required int32 max_connection_per_host = 4 [default = 100];
required int32 hedge_request_timeout_ms = 5; required int32 hedge_request_timeout_ms = 5 [default = -1];
required int32 hedge_fetch_retry_count = 6; required int32 hedge_fetch_retry_count = 6 [default = 2];
required string connection_type = 7; required string connection_type = 7 [default = "pooled"];
}; };
message NamingConf { message NamingConf {
optional string cluster_filter_strategy = 1; optional string cluster_filter_strategy = 1 [default="Default"];
optional string load_balance_strategy = 2; optional string load_balance_strategy = 2 [default = "la"];
optional string cluster = 3; optional string cluster = 3;
}; };
message RpcParameter { message RpcParameter {
// 0-NONE, 1-SNAPPY, 2-GZIP, 3-ZLIB, 4-LZ4 // 0-NONE, 1-SNAPPY, 2-GZIP, 3-ZLIB, 4-LZ4
required int32 compress_type = 1; required int32 compress_type = 1 [default = 0];
required int32 package_size = 2; required int32 package_size = 2 [default = 20];
required string protocol = 3; required string protocol = 3 [default = "baidu_std"];
required int32 max_channel_per_request = 4; required int32 max_channel_per_request = 4 [default = 3];
}; };
message SplitConf { message SplitConf {
...@@ -53,12 +53,12 @@ message VariantConf { ...@@ -53,12 +53,12 @@ message VariantConf {
optional string variant_router = 6; optional string variant_router = 6;
}; };
message WeightedRandomRenderConf { required string variant_weight_list = 1; }; message WeightedRandomRenderConf { required string variant_weight_list = 1 [default= "50" ]; };
message Predictor { message Predictor {
required string name = 1; required string name = 1 [default="general_model"];
required string service_name = 2; required string service_name = 2 [default="baidu.paddle_serving.predictor.general_model.GeneralModelService"];
required string endpoint_router = 3; required string endpoint_router = 3 [default="WeightedRandomRender"];
required WeightedRandomRenderConf weighted_random_render_conf = 4; required WeightedRandomRenderConf weighted_random_render_conf = 4;
repeated VariantConf variants = 5; repeated VariantConf variants = 5;
}; };
......
...@@ -17,7 +17,7 @@ add_custom_command( ...@@ -17,7 +17,7 @@ add_custom_command(
COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py bdist_wheel COMMAND env ${py_env} ${PYTHON_EXECUTABLE} setup.py bdist_wheel
DEPENDS ${SERVING_CLIENT_CORE} sdk_configure_py_proto ${PY_FILES}) DEPENDS ${SERVING_CLIENT_CORE} sdk_configure_py_proto ${PY_FILES})
add_custom_target(paddle_python ALL DEPENDS ${PADDLE_SERVING_BINARY_DIR}/.timestamp) add_custom_target(paddle_python ALL DEPENDS serving_client ${PADDLE_SERVING_BINARY_DIR}/.timestamp)
set(SERVING_CLIENT_PYTHON_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist/) set(SERVING_CLIENT_PYTHON_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist/)
......
...@@ -34,7 +34,7 @@ class SDKConfig(object): ...@@ -34,7 +34,7 @@ class SDKConfig(object):
variant_desc = sdk.VariantConf() variant_desc = sdk.VariantConf()
variant_desc.tag = "var1" variant_desc.tag = "var1"
variant_desc.naming_conf.cluster = "list://%s".format(":".join(self.endpoints)) variant_desc.naming_conf.cluster = "list://{}".format(":".join(self.endpoints))
predictor_desc.variants.extend([variant_desc]) predictor_desc.variants.extend([variant_desc])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册