diff --git a/CMakeLists.txt b/CMakeLists.txt index adc8bc655eebd6767a9077334921684a2690c02c..1df5591109c38782865c71452e2d0e167ed7f3c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,8 +43,10 @@ set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING set(THIRD_PARTY_BUILD_TYPE Release) -option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND}) -option(WITH_MKL "Compile PaddlePaddle with MKL support." ${AVX_FOUND}) +option(WITH_AVX "Compile Paddle Serving with AVX intrinsics" ${AVX_FOUND}) +option(WITH_MKL "Compile Paddle Serving with MKL support." ${AVX_FOUND}) +option(CLIENT_ONLY "Compile client libraries and demos only" + FALSE) set(WITH_MKLML ${WITH_MKL}) if (NOT DEFINED WITH_MKLDNN) @@ -56,19 +58,22 @@ if (NOT DEFINED WITH_MKLDNN) endif() endif() -include(external/mklml) +include(external/leveldb) include(external/zlib) +include(external/boost) +include(external/protobuf) +include(external/brpc) include(external/gflags) include(external/glog) -include(external/leveldb) -include(external/protobuf) include(external/snappy) -include(external/brpc) -include(external/boost) -include(flags) include(generic) +include(flags) + +if (NOT CLIENT_ONLY) +include(external/mklml) include(paddlepaddle) include(external/opencv) +endif() include_directories(${PADDLE_SERVING_SOURCE_DIR}) include_directories(${PADDLE_SERVING_BINARY_DIR}) @@ -81,6 +86,7 @@ set(EXTERNAL_LIBS brpc ) + if(WITH_MKLML) list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB}) endif() @@ -90,9 +96,17 @@ if(WITH_MKLDNN) list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB}) endif() +if (NOT CLIENT_ONLY) + list(APPEND EXTERNAL_LIBS paddlepaddle) + list(APPEND EXTERNAL_LIBS opencv) +endif() + add_subdirectory(configure) add_subdirectory(pdcodegen) +add_subdirectory(sdk-cpp) + +if (NOT CLIENT_ONLY) add_subdirectory(predictor) add_subdirectory(inferencer-fluid-cpu) add_subdirectory(serving) -add_subdirectory(sdk-cpp) +endif() diff --git a/doc/INSTALL.md b/doc/INSTALL.md index 1285c905eee9826f80d5204b33fda0ccd23b5ab9..64e482d6438f2d6e5da8ea6ce98e0933b18a0f7b 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -60,7 +60,8 @@ $ make install 因Paddle Serving依托于PaddlePaddle项目进行构建,以下编译选项其实是传递给PaddlePaddle的编译选项: -| 编译选项 | 说明| -|----------|-----| +| 编译选项 | 说明 | +|----------|------| | WITH_AVX | Compile PaddlePaddle with AVX intrinsics | | WITH_MKL | Compile PaddlePaddle with MKLML library | +| CLINET_ONLY | Compile client libraries and demos only | diff --git a/sdk-cpp/demo/dense_format.cpp b/sdk-cpp/demo/dense_format.cpp index 43d73630c6ffad4aa400e3f9b6c4e80fc8778d2d..beb13877fffa1cc48c73a8b831ffda302987314a 100644 --- a/sdk-cpp/demo/dense_format.cpp +++ b/sdk-cpp/demo/dense_format.cpp @@ -17,7 +17,7 @@ #include #include -#include "predictor/builtin_format.pb.h" +#include "sdk-cpp/builtin_format.pb.h" #include "sdk-cpp/dense_service.pb.h" #include "sdk-cpp/include/common.h" #include "sdk-cpp/include/predictor_sdk.h" diff --git a/sdk-cpp/demo/echo.cpp b/sdk-cpp/demo/echo.cpp index b296cd281cb891a7c6f147e89e7d510e1c3cc0c6..ca68d2cbafd177864bb3e97164bb57959adf7430 100644 --- a/sdk-cpp/demo/echo.cpp +++ b/sdk-cpp/demo/echo.cpp @@ -17,7 +17,7 @@ #include #include -#include "predictor/builtin_format.pb.h" +#include "sdk-cpp/builtin_format.pb.h" #include "sdk-cpp/echo_service.pb.h" #include "sdk-cpp/include/common.h" #include "sdk-cpp/include/predictor_sdk.h" diff --git a/sdk-cpp/demo/int64tensor_format.cpp b/sdk-cpp/demo/int64tensor_format.cpp index 15db68a2779bb93d8ceb7e9ea3573cd7b780a950..97160d82969d5932cc89416c8aecdbad117705de 100644 --- a/sdk-cpp/demo/int64tensor_format.cpp +++ b/sdk-cpp/demo/int64tensor_format.cpp @@ -17,7 +17,7 @@ #include #include -#include "predictor/builtin_format.pb.h" +#include "sdk-cpp/builtin_format.pb.h" #include "sdk-cpp/include/common.h" #include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/int64tensor_service.pb.h" diff --git a/sdk-cpp/demo/sparse_format.cpp b/sdk-cpp/demo/sparse_format.cpp index 78c237d76827d8d2fa591a026e2ac299b3dca1ce..c428881dc909237754a66f5c116fa2b4e266afeb 100644 --- a/sdk-cpp/demo/sparse_format.cpp +++ b/sdk-cpp/demo/sparse_format.cpp @@ -17,7 +17,7 @@ #include #include -#include "predictor/builtin_format.pb.h" +#include "sdk-cpp/builtin_format.pb.h" #include "sdk-cpp/include/common.h" #include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/sparse_service.pb.h" diff --git a/sdk-cpp/demo/text_classification.cpp b/sdk-cpp/demo/text_classification.cpp index 493a24b9a977ea458d6073e8419ace6aa8a6c6f0..6e9555d06a7c3d7c63645aa1f38bec2c62399318 100644 --- a/sdk-cpp/demo/text_classification.cpp +++ b/sdk-cpp/demo/text_classification.cpp @@ -17,7 +17,7 @@ #include #include -#include "predictor/builtin_format.pb.h" +#include "sdk-cpp/builtin_format.pb.h" #include "sdk-cpp/include/common.h" #include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/text_classification.pb.h" diff --git a/sdk-cpp/demo/text_classification_press.cpp b/sdk-cpp/demo/text_classification_press.cpp index a51afa3fa7e2dd8aa6f0e6f90d935d1f9415ebd1..04a9d2f693fd391676e8655dfff9cbfdb3333734 100644 --- a/sdk-cpp/demo/text_classification_press.cpp +++ b/sdk-cpp/demo/text_classification_press.cpp @@ -19,7 +19,7 @@ #include #include #include // NOLINT -#include "predictor/builtin_format.pb.h" +#include "sdk-cpp/builtin_format.pb.h" #include "sdk-cpp/include/common.h" #include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/text_classification.pb.h" @@ -328,18 +328,26 @@ int main(int argc, char **argv) { LOG(INFO) << "Total requests: " << round_times.size(); LOG(INFO) << "Max concurrency: " << FLAGS_concurrency; LOG(INFO) << "Elapse ms (wall-time): " << elapse_ms; - double qps = (static_cast(count) / elapse_ms) * 1000; + + double qps = 0.0; + if (elapse_ms != 0) { + qps = (static_cast(count) / elapse_ms) * 1000; + } LOG(INFO) << "QPS: " << qps / FLAGS_batch_size << "/s"; LOG(INFO) << "Accuracy " << static_cast(correct) / count; LOG(INFO) << "Latency statistics: "; - LOG(INFO) << "Average ms: " << total_ms / round_times.size(); - LOG(INFO) << "50 percent ms: " << round_times[percent_pos_50]; - LOG(INFO) << "80 percent ms: " << round_times[percent_pos_80]; - LOG(INFO) << "90 percent ms: " << round_times[percent_pos_90]; - LOG(INFO) << "99 percent ms: " << round_times[percent_pos_99]; - LOG(INFO) << "99.9 percent ms: " << round_times[percent_pos_999]; + if (round_times.size() != 0) { + LOG(INFO) << "Average ms: " << total_ms / round_times.size(); + LOG(INFO) << "50 percent ms: " << round_times[percent_pos_50]; + LOG(INFO) << "80 percent ms: " << round_times[percent_pos_80]; + LOG(INFO) << "90 percent ms: " << round_times[percent_pos_90]; + LOG(INFO) << "99 percent ms: " << round_times[percent_pos_99]; + LOG(INFO) << "99.9 percent ms: " << round_times[percent_pos_999]; + } else { + LOG(INFO) << "N/A"; + } return 0; } diff --git a/sdk-cpp/demo/ximage.cpp b/sdk-cpp/demo/ximage.cpp index 226f6420da3903bf5ac6e8afafeef8bddecb95d7..426a138e6f186acbaa99acb2215cbff00100ebab 100644 --- a/sdk-cpp/demo/ximage.cpp +++ b/sdk-cpp/demo/ximage.cpp @@ -17,7 +17,7 @@ #include #include -#include "predictor/builtin_format.pb.h" +#include "sdk-cpp/builtin_format.pb.h" #include "sdk-cpp/image_class.pb.h" #include "sdk-cpp/include/common.h" #include "sdk-cpp/include/predictor_sdk.h"