提交 9be1446d 编写于 作者: W wangguibao

Add cmake option: CLIENT_ONLY - Compile client libraries and demos only

Change-Id: I3029679e261524053c00ea985cfcafb3dfb49bf6
上级 0ddb8447
...@@ -43,8 +43,10 @@ set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING ...@@ -43,8 +43,10 @@ set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING
set(THIRD_PARTY_BUILD_TYPE Release) set(THIRD_PARTY_BUILD_TYPE Release)
option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND}) option(WITH_AVX "Compile Paddle Serving with AVX intrinsics" ${AVX_FOUND})
option(WITH_MKL "Compile PaddlePaddle with MKL support." ${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}) set(WITH_MKLML ${WITH_MKL})
if (NOT DEFINED WITH_MKLDNN) if (NOT DEFINED WITH_MKLDNN)
...@@ -56,19 +58,22 @@ if (NOT DEFINED WITH_MKLDNN) ...@@ -56,19 +58,22 @@ if (NOT DEFINED WITH_MKLDNN)
endif() endif()
endif() endif()
include(external/mklml) include(external/leveldb)
include(external/zlib) include(external/zlib)
include(external/boost)
include(external/protobuf)
include(external/brpc)
include(external/gflags) include(external/gflags)
include(external/glog) include(external/glog)
include(external/leveldb)
include(external/protobuf)
include(external/snappy) include(external/snappy)
include(external/brpc)
include(external/boost)
include(flags)
include(generic) include(generic)
include(flags)
if (NOT CLIENT_ONLY)
include(external/mklml)
include(paddlepaddle) include(paddlepaddle)
include(external/opencv) include(external/opencv)
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})
...@@ -81,6 +86,7 @@ set(EXTERNAL_LIBS ...@@ -81,6 +86,7 @@ set(EXTERNAL_LIBS
brpc brpc
) )
if(WITH_MKLML) if(WITH_MKLML)
list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB}) list(APPEND EXTERNAL_LIBS ${MKLML_IOMP_LIB})
endif() endif()
...@@ -90,9 +96,17 @@ if(WITH_MKLDNN) ...@@ -90,9 +96,17 @@ if(WITH_MKLDNN)
list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB}) list(APPEND EXTERNAL_LIBS ${MKLDNN_LIB})
endif() endif()
if (NOT CLIENT_ONLY)
list(APPEND EXTERNAL_LIBS paddlepaddle)
list(APPEND EXTERNAL_LIBS opencv)
endif()
add_subdirectory(configure) add_subdirectory(configure)
add_subdirectory(pdcodegen) add_subdirectory(pdcodegen)
add_subdirectory(sdk-cpp)
if (NOT CLIENT_ONLY)
add_subdirectory(predictor) add_subdirectory(predictor)
add_subdirectory(inferencer-fluid-cpu) add_subdirectory(inferencer-fluid-cpu)
add_subdirectory(serving) add_subdirectory(serving)
add_subdirectory(sdk-cpp) endif()
...@@ -60,7 +60,8 @@ $ make install ...@@ -60,7 +60,8 @@ $ make install
因Paddle Serving依托于PaddlePaddle项目进行构建,以下编译选项其实是传递给PaddlePaddle的编译选项: 因Paddle Serving依托于PaddlePaddle项目进行构建,以下编译选项其实是传递给PaddlePaddle的编译选项:
| 编译选项 | 说明| | 编译选项 | 说明 |
|----------|-----| |----------|------|
| WITH_AVX | Compile PaddlePaddle with AVX intrinsics | | WITH_AVX | Compile PaddlePaddle with AVX intrinsics |
| WITH_MKL | Compile PaddlePaddle with MKLML library | | WITH_MKL | Compile PaddlePaddle with MKLML library |
| CLINET_ONLY | Compile client libraries and demos only |
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
#include "predictor/builtin_format.pb.h" #include "sdk-cpp/builtin_format.pb.h"
#include "sdk-cpp/dense_service.pb.h" #include "sdk-cpp/dense_service.pb.h"
#include "sdk-cpp/include/common.h" #include "sdk-cpp/include/common.h"
#include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/include/predictor_sdk.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
#include "predictor/builtin_format.pb.h" #include "sdk-cpp/builtin_format.pb.h"
#include "sdk-cpp/echo_service.pb.h" #include "sdk-cpp/echo_service.pb.h"
#include "sdk-cpp/include/common.h" #include "sdk-cpp/include/common.h"
#include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/include/predictor_sdk.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
#include "predictor/builtin_format.pb.h" #include "sdk-cpp/builtin_format.pb.h"
#include "sdk-cpp/include/common.h" #include "sdk-cpp/include/common.h"
#include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/include/predictor_sdk.h"
#include "sdk-cpp/int64tensor_service.pb.h" #include "sdk-cpp/int64tensor_service.pb.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
#include "predictor/builtin_format.pb.h" #include "sdk-cpp/builtin_format.pb.h"
#include "sdk-cpp/include/common.h" #include "sdk-cpp/include/common.h"
#include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/include/predictor_sdk.h"
#include "sdk-cpp/sparse_service.pb.h" #include "sdk-cpp/sparse_service.pb.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
#include "predictor/builtin_format.pb.h" #include "sdk-cpp/builtin_format.pb.h"
#include "sdk-cpp/include/common.h" #include "sdk-cpp/include/common.h"
#include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/include/predictor_sdk.h"
#include "sdk-cpp/text_classification.pb.h" #include "sdk-cpp/text_classification.pb.h"
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include <atomic> #include <atomic>
#include <fstream> #include <fstream>
#include <thread> // NOLINT #include <thread> // NOLINT
#include "predictor/builtin_format.pb.h" #include "sdk-cpp/builtin_format.pb.h"
#include "sdk-cpp/include/common.h" #include "sdk-cpp/include/common.h"
#include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/include/predictor_sdk.h"
#include "sdk-cpp/text_classification.pb.h" #include "sdk-cpp/text_classification.pb.h"
...@@ -328,18 +328,26 @@ int main(int argc, char **argv) { ...@@ -328,18 +328,26 @@ int main(int argc, char **argv) {
LOG(INFO) << "Total requests: " << round_times.size(); LOG(INFO) << "Total requests: " << round_times.size();
LOG(INFO) << "Max concurrency: " << FLAGS_concurrency; LOG(INFO) << "Max concurrency: " << FLAGS_concurrency;
LOG(INFO) << "Elapse ms (wall-time): " << elapse_ms; LOG(INFO) << "Elapse ms (wall-time): " << elapse_ms;
double qps = (static_cast<double>(count) / elapse_ms) * 1000;
double qps = 0.0;
if (elapse_ms != 0) {
qps = (static_cast<double>(count) / elapse_ms) * 1000;
}
LOG(INFO) << "QPS: " << qps / FLAGS_batch_size << "/s"; LOG(INFO) << "QPS: " << qps / FLAGS_batch_size << "/s";
LOG(INFO) << "Accuracy " << static_cast<double>(correct) / count; LOG(INFO) << "Accuracy " << static_cast<double>(correct) / count;
LOG(INFO) << "Latency statistics: "; LOG(INFO) << "Latency statistics: ";
if (round_times.size() != 0) {
LOG(INFO) << "Average ms: " << total_ms / round_times.size(); LOG(INFO) << "Average ms: " << total_ms / round_times.size();
LOG(INFO) << "50 percent ms: " << round_times[percent_pos_50]; LOG(INFO) << "50 percent ms: " << round_times[percent_pos_50];
LOG(INFO) << "80 percent ms: " << round_times[percent_pos_80]; LOG(INFO) << "80 percent ms: " << round_times[percent_pos_80];
LOG(INFO) << "90 percent ms: " << round_times[percent_pos_90]; LOG(INFO) << "90 percent ms: " << round_times[percent_pos_90];
LOG(INFO) << "99 percent ms: " << round_times[percent_pos_99]; LOG(INFO) << "99 percent ms: " << round_times[percent_pos_99];
LOG(INFO) << "99.9 percent ms: " << round_times[percent_pos_999]; LOG(INFO) << "99.9 percent ms: " << round_times[percent_pos_999];
} else {
LOG(INFO) << "N/A";
}
return 0; return 0;
} }
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <unistd.h> #include <unistd.h>
#include <fstream> #include <fstream>
#include "predictor/builtin_format.pb.h" #include "sdk-cpp/builtin_format.pb.h"
#include "sdk-cpp/image_class.pb.h" #include "sdk-cpp/image_class.pb.h"
#include "sdk-cpp/include/common.h" #include "sdk-cpp/include/common.h"
#include "sdk-cpp/include/predictor_sdk.h" #include "sdk-cpp/include/predictor_sdk.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册