From 73cc45518901bb93a99c71406db8a1086104fc50 Mon Sep 17 00:00:00 2001 From: wangguibao Date: Wed, 27 Feb 2019 20:06:06 +0800 Subject: [PATCH] make install; LOG(FATAL)->LOG(ERROR) Change-Id: I7ae7a94d8c6086f669c374ecbfcff590dc663bfd --- CMakeLists.txt | 10 +- configure/CMakeLists.txt | 5 + inferencer-fluid-cpu/CMakeLists.txt | 4 + .../include/fluid_cpu_engine.h | 56 ++++----- predictor/CMakeLists.txt | 8 ++ predictor/common/macros.h | 2 +- predictor/framework/bsf-inl-tensor.h | 16 +-- predictor/framework/bsf-inl.h | 22 ++-- predictor/framework/bsf.h | 4 +- predictor/framework/channel.h | 6 +- predictor/framework/dag.cpp | 10 +- predictor/framework/dag_view.cpp | 18 +-- predictor/framework/infer.h | 116 +++++++++--------- predictor/framework/infer_data.h | 6 +- predictor/framework/manager.h | 20 +-- predictor/framework/op_repository.cpp | 10 +- predictor/framework/predictor_metric.h | 12 +- predictor/framework/resource.cpp | 20 +-- predictor/framework/server.cpp | 10 +- predictor/framework/service.cpp | 22 ++-- predictor/framework/service_manager.h | 6 +- predictor/framework/workflow.cpp | 6 +- predictor/op/op.cpp | 16 +-- predictor/op/op.h | 6 +- predictor/src/pdcodegen.cpp | 12 +- predictor/src/pdserving.cpp | 2 +- sdk-cpp/CMakeLists.txt | 11 ++ sdk-cpp/conf/predictors.conf | 33 ----- sdk-cpp/conf/predictors.conf.bak | 71 ----------- sdk-cpp/demo/mapcnn_dense.cpp | 14 +-- sdk-cpp/demo/maprnn_dense.cpp | 2 +- serving/CMakeLists.txt | 9 ++ serving/conf/dense_dag.conf | 4 - serving/conf/imagec_dag.conf | 16 --- serving/conf/log.conf | 32 ----- serving/conf/model_toolkit.conf | 9 -- serving/conf/resource.conf | 3 - serving/conf/service.conf | 7 -- serving/conf/workflow.conf | 9 -- serving/op/reader_op.cpp | 2 +- 40 files changed, 249 insertions(+), 398 deletions(-) delete mode 100644 sdk-cpp/conf/predictors.conf delete mode 100644 sdk-cpp/conf/predictors.conf.bak delete mode 100644 serving/conf/dense_dag.conf delete mode 100644 serving/conf/imagec_dag.conf delete mode 100644 serving/conf/log.conf delete mode 100644 serving/conf/model_toolkit.conf delete mode 100644 serving/conf/resource.conf delete mode 100644 serving/conf/service.conf delete mode 100644 serving/conf/workflow.conf diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c3c833f..3ad0f39a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ cmake_minimum_required(VERSION 3.0) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") set(PADDLE_SERVING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(PADDLE_SERVING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) +SET(PADDLE_SERVING_INSTALL_DIR ${CMAKE_BINARY_DIR}/output) include(system) @@ -40,12 +41,6 @@ endif() set(THIRD_PARTY_PATH "${CMAKE_BINARY_DIR}/third_party" CACHE STRING "A path setting third party libraries download & build directories.") -set(FLUID_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_install_dir" CACHE STRING - "A path setting fluid shared and static libraries") - -set(FLUID_INFERENCE_INSTALL_DIR "${CMAKE_BINARY_DIR}/fluid_inference_install_dir" CACHE STRING - "A path setting fluid inference shared and static libraries") - set(THIRD_PARTY_BUILD_TYPE Release) option(WITH_AVX "Compile PaddlePaddle with AVX intrinsics" ${AVX_FOUND}) @@ -99,3 +94,6 @@ add_subdirectory(predictor) add_subdirectory(inferencer-fluid-cpu) add_subdirectory(serving) add_subdirectory(sdk-cpp) + + + diff --git a/configure/CMakeLists.txt b/configure/CMakeLists.txt index 3b6e55db..2f5ab6e7 100644 --- a/configure/CMakeLists.txt +++ b/configure/CMakeLists.txt @@ -18,3 +18,8 @@ target_include_directories(test_configure PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include ) target_link_libraries(test_configure configure protobuf) + +install(TARGETS configure + ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib + ) + diff --git a/inferencer-fluid-cpu/CMakeLists.txt b/inferencer-fluid-cpu/CMakeLists.txt index 64e4cddd..8c05ee14 100644 --- a/inferencer-fluid-cpu/CMakeLists.txt +++ b/inferencer-fluid-cpu/CMakeLists.txt @@ -7,3 +7,7 @@ target_include_directories(fluid_cpu_engine PUBLIC add_dependencies(fluid_cpu_engine pdserving paddle_fluid configure) target_link_libraries(fluid_cpu_engine pdserving -liomp5 -lmklml_intel -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) +install(TARGETS fluid_cpu_engine + ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib + ) + diff --git a/inferencer-fluid-cpu/include/fluid_cpu_engine.h b/inferencer-fluid-cpu/include/fluid_cpu_engine.h index 1339e28c..0f1e6613 100644 --- a/inferencer-fluid-cpu/include/fluid_cpu_engine.h +++ b/inferencer-fluid-cpu/include/fluid_cpu_engine.h @@ -74,7 +74,7 @@ public: virtual bool Run(const void* in_data, void* out_data) { if (!_core->Run(*(std::vector*)in_data, (std::vector*)out_data)) { - LOG(FATAL) << "Failed call Run with paddle predictor"; + LOG(ERROR) << "Failed call Run with paddle predictor"; return false; } @@ -85,13 +85,13 @@ public: virtual int clone(void* origin_core) { if (origin_core == NULL) { - LOG(FATAL) << "origin paddle Predictor is null."; + LOG(ERROR) << "origin paddle Predictor is null."; return -1; } paddle::PaddlePredictor* p_predictor = (paddle::PaddlePredictor*)origin_core; _core = p_predictor->Clone(); if (_core.get() == NULL) { - LOG(FATAL) << "fail to clone paddle predictor: " << origin_core; + LOG(ERROR) << "fail to clone paddle predictor: " << origin_core; return -1; } return 0; @@ -110,7 +110,7 @@ class FluidCpuAnalysisCore : public FluidFamilyCore { public: int create(const std::string& data_path) { if (access(data_path.c_str(), F_OK) == -1) { - LOG(FATAL) << "create paddle predictor failed, path not exits: " + LOG(ERROR) << "create paddle predictor failed, path not exits: " << data_path; return -1; } @@ -125,7 +125,7 @@ public: _core = paddle::CreatePaddlePredictor< paddle::contrib::AnalysisConfig>(analysis_config); if (NULL == _core.get()) { - LOG(FATAL) << "create paddle predictor failed, path: " + LOG(ERROR) << "create paddle predictor failed, path: " << data_path; return -1; } @@ -139,7 +139,7 @@ class FluidCpuNativeCore : public FluidFamilyCore { public: int create(const std::string& data_path) { if (access(data_path.c_str(), F_OK) == -1) { - LOG(FATAL) << "create paddle predictor failed, path not exits: " + LOG(ERROR) << "create paddle predictor failed, path not exits: " << data_path; return -1; } @@ -153,7 +153,7 @@ public: _core = paddle::CreatePaddlePredictor< paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config); if (NULL == _core.get()) { - LOG(FATAL) << "create paddle predictor failed, path: " + LOG(ERROR) << "create paddle predictor failed, path: " << data_path; return -1; } @@ -167,7 +167,7 @@ class FluidCpuAnalysisDirCore : public FluidFamilyCore { public: int create(const std::string& data_path) { if (access(data_path.c_str(), F_OK) == -1) { - LOG(FATAL) << "create paddle predictor failed, path not exits: " + LOG(ERROR) << "create paddle predictor failed, path not exits: " << data_path; return -1; } @@ -181,7 +181,7 @@ public: _core = paddle::CreatePaddlePredictor< paddle::contrib::AnalysisConfig>(analysis_config); if (NULL == _core.get()) { - LOG(FATAL) << "create paddle predictor failed, path: " + LOG(ERROR) << "create paddle predictor failed, path: " << data_path; return -1; } @@ -196,7 +196,7 @@ class FluidCpuNativeDirCore : public FluidFamilyCore { public: int create(const std::string& data_path) { if (access(data_path.c_str(), F_OK) == -1) { - LOG(FATAL) << "create paddle predictor failed, path not exits: " + LOG(ERROR) << "create paddle predictor failed, path not exits: " << data_path; return -1; } @@ -209,7 +209,7 @@ public: _core = paddle::CreatePaddlePredictor< paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config); if (NULL == _core.get()) { - LOG(FATAL) << "create paddle predictor failed, path: " + LOG(ERROR) << "create paddle predictor failed, path: " << data_path; return -1; } @@ -235,7 +235,7 @@ public: _col = col; _params = (float*)malloc(_row * _col * sizeof(float)); if (_params == NULL) { - LOG(FATAL) << "Load " << _file_name << " malloc error."; + LOG(ERROR) << "Load " << _file_name << " malloc error."; return -1; } LOG(WARNING) << "Load parameter file[" << _file_name << "] success."; @@ -253,20 +253,20 @@ public: int load() { if (_params == NULL || _row <= 0 || _col <= 0) { - LOG(FATAL) << "load parameter error [not inited]."; + LOG(ERROR) << "load parameter error [not inited]."; return -1; } FILE* fs = fopen(_file_name.c_str(), "rb"); if (fs == NULL) { - LOG(FATAL) << "load " << _file_name << " fopen error."; + LOG(ERROR) << "load " << _file_name << " fopen error."; return -1; } static const uint32_t MODEL_FILE_HEAD_LEN = 16; char head[MODEL_FILE_HEAD_LEN] = {0}; if (fread(head, 1, MODEL_FILE_HEAD_LEN, fs) != MODEL_FILE_HEAD_LEN) { destroy(); - LOG(FATAL) << "Load " << _file_name << " read head error."; + LOG(ERROR) << "Load " << _file_name << " read head error."; if (fs != NULL) { fclose(fs); fs = NULL; @@ -283,7 +283,7 @@ public: LOG(INFO) << "load " << _file_name << " read ok."; return 0; } else { - LOG(FATAL) << "load " << _file_name << " read error."; + LOG(ERROR) << "load " << _file_name << " read error."; destroy(); if (fs != NULL) { fclose(fs); @@ -309,13 +309,13 @@ public: float exp_max, float exp_min) { AutoLock lock(GlobalSigmoidCreateMutex::instance()); if (0 != _sigmoid_w.init(2, 1, sigmoid_w_file) || 0 != _sigmoid_w.load()) { - LOG(FATAL) << "load params sigmoid_w failed."; + LOG(ERROR) << "load params sigmoid_w failed."; return -1; } LOG(WARNING) << "load sigmoid_w [" << _sigmoid_w._params[0] << "] [" << _sigmoid_w._params[1] << "]."; if (0 != _sigmoid_b.init(2, 1, sigmoid_b_file) || 0 != _sigmoid_b.load()) { - LOG(FATAL) << "load params sigmoid_b failed."; + LOG(ERROR) << "load params sigmoid_b failed."; return -1; } LOG(WARNING) << "load sigmoid_b [" << _sigmoid_b._params[0] @@ -372,7 +372,7 @@ public: std::string conf_file = model_path.substr(pos); configure::SigmoidConf conf; if (configure::read_proto_conf(conf_path, conf_file, &conf) != 0) { - LOG(FATAL) << "failed load model path: " << model_path; + LOG(ERROR) << "failed load model path: " << model_path; return -1; } @@ -381,7 +381,7 @@ public: std::string fluid_model_data_path = conf.dnn_model_path(); int ret = load_fluid_model(fluid_model_data_path); if (ret < 0) { - LOG(FATAL) << "fail to load fluid model."; + LOG(ERROR) << "fail to load fluid model."; return -1; } const char* sigmoid_w_file = conf.sigmoid_w_file().c_str(); @@ -393,7 +393,7 @@ public: << "], use count[" << _core->_sigmoid_core.use_count() << "]."; ret = _core->_sigmoid_core->load(sigmoid_w_file, sigmoid_b_file, exp_max, exp_min); if (ret < 0) { - LOG(FATAL) << "fail to load sigmoid model."; + LOG(ERROR) << "fail to load sigmoid model."; return -1; } return 0; @@ -402,7 +402,7 @@ public: virtual bool Run(const void* in_data, void* out_data) { if (!_core->_fluid_core->Run(*(std::vector*)in_data, (std::vector*)out_data)) { - LOG(FATAL) << "Failed call Run with paddle predictor"; + LOG(ERROR) << "Failed call Run with paddle predictor"; return false; } @@ -411,12 +411,12 @@ public: virtual int clone(SigmoidFluidModel* origin_core) { if (origin_core == NULL) { - LOG(FATAL) << "origin paddle Predictor is null."; + LOG(ERROR) << "origin paddle Predictor is null."; return -1; } _core = origin_core->Clone(); if (_core.get() == NULL) { - LOG(FATAL) << "fail to clone paddle predictor: " << origin_core; + LOG(ERROR) << "fail to clone paddle predictor: " << origin_core; return -1; } LOG(INFO) << "clone sigmoid core[" << _core->_sigmoid_core.get() @@ -442,7 +442,7 @@ class FluidCpuNativeDirWithSigmoidCore : public FluidCpuWithSigmoidCore { public: int load_fluid_model(const std::string& data_path) { if (access(data_path.c_str(), F_OK) == -1) { - LOG(FATAL) << "create paddle predictor failed, path not exits: " + LOG(ERROR) << "create paddle predictor failed, path not exits: " << data_path; return -1; } @@ -455,7 +455,7 @@ public: _core->_fluid_core = paddle::CreatePaddlePredictor< paddle::NativeConfig, paddle::PaddleEngineKind::kNative>(native_config); if (NULL == _core.get()) { - LOG(FATAL) << "create paddle predictor failed, path: " + LOG(ERROR) << "create paddle predictor failed, path: " << data_path; return -1; } @@ -470,7 +470,7 @@ class FluidCpuAnalysisDirWithSigmoidCore : public FluidCpuWithSigmoidCore { public: int load_fluid_model(const std::string& data_path) { if (access(data_path.c_str(), F_OK) == -1) { - LOG(FATAL) << "create paddle predictor failed, path not exits: " + LOG(ERROR) << "create paddle predictor failed, path not exits: " << data_path; return -1; } @@ -484,7 +484,7 @@ public: _core->_fluid_core = paddle::CreatePaddlePredictor< paddle::contrib::AnalysisConfig>(analysis_config); if (NULL == _core.get()) { - LOG(FATAL) << "create paddle predictor failed, path: " + LOG(ERROR) << "create paddle predictor failed, path: " << data_path; return -1; } diff --git a/predictor/CMakeLists.txt b/predictor/CMakeLists.txt index 9e0a9ac1..307588e4 100644 --- a/predictor/CMakeLists.txt +++ b/predictor/CMakeLists.txt @@ -61,3 +61,11 @@ target_include_directories(pdclient PUBLIC ) target_link_libraries(pdclient protobuf boost brpc -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) +# install +install(TARGETS pdclient pdserving pdcodegen + RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/bin + ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib + LIBRARY DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/so + ) + + diff --git a/predictor/common/macros.h b/predictor/common/macros.h index 992dc1df..a6607f60 100644 --- a/predictor/common/macros.h +++ b/predictor/common/macros.h @@ -10,7 +10,7 @@ namespace predictor { #ifndef CATCH_ANY_AND_RET #define CATCH_ANY_AND_RET(errno) \ catch (...) { \ - LOG(FATAL) << "exception catched"; \ + LOG(ERROR) << "exception catched"; \ return errno; \ } #endif diff --git a/predictor/framework/bsf-inl-tensor.h b/predictor/framework/bsf-inl-tensor.h index 40114c9d..5568cc7a 100644 --- a/predictor/framework/bsf-inl-tensor.h +++ b/predictor/framework/bsf-inl-tensor.h @@ -111,23 +111,23 @@ public: const InArrayT& in, OutArrayT& out, bool align) { if (align) { if (out.count() <= 0 || out.size() <= 0) { - LOG(FATAL) << "Out tensor is empty, when aligned"; + LOG(ERROR) << "Out tensor is empty, when aligned"; return false; } if (out.size() != in.size()) { - LOG(FATAL) << "In/Out tensor size not eq: " << out.size() << "!=" << in.size(); + LOG(ERROR) << "In/Out tensor size not eq: " << out.size() << "!=" << in.size(); return false; } for (size_t fi = 0, shape0 = 0; fi < out.count(); ++fi) { if (!out[fi].valid()) { - LOG(FATAL) << "Out[" << fi << "] tensor not valid"; + LOG(ERROR) << "Out[" << fi << "] tensor not valid"; return false; } if (out.size() != out[fi].shape0()) { - LOG(FATAL) << "Shape0 not consistency, " << out.size() << "!=" << out[fi].shape0() << ", " << fi; + LOG(ERROR) << "Shape0 not consistency, " << out.size() << "!=" << out[fi].shape0() << ", " << fi; return false; } } @@ -231,7 +231,7 @@ public: void* data_buf = MempoolWrapper::instance().malloc(tensor_byte); if (!data_buf) { - LOG(FATAL) << "Malloc failed, size: " << tensor_byte; + LOG(ERROR) << "Malloc failed, size: " << tensor_byte; return ; } @@ -240,7 +240,7 @@ public: TaskMetaT& tm = _tasks[ti]; size_t acc_byte = ins_byte * (tm.end - tm.begin); if (data_byte + acc_byte > tensor_byte) { - LOG(FATAL) << "Invalid bytes: " << data_byte << " + " << acc_byte << " >= " << tensor_byte; + LOG(ERROR) << "Invalid bytes: " << data_byte << " + " << acc_byte << " >= " << tensor_byte; return ; } @@ -252,7 +252,7 @@ public: } if (data_byte != tensor_byte) { - LOG(FATAL) << "Invalid tensor byte: " << data_byte << " != " << tensor_byte; + LOG(ERROR) << "Invalid tensor byte: " << data_byte << " != " << tensor_byte; return ; } @@ -270,7 +270,7 @@ public: void notify_tasks() { if (_batch_out.size() != _batch_in.size()) { - LOG(FATAL) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size(); + LOG(ERROR) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size(); return ; } diff --git a/predictor/framework/bsf-inl.h b/predictor/framework/bsf-inl.h index 1d4e88fb..bc95886c 100644 --- a/predictor/framework/bsf-inl.h +++ b/predictor/framework/bsf-inl.h @@ -28,7 +28,7 @@ int TaskExecutor::start(uint32_t thread_num, uint32_t init_timeout_sec) { } if (thread_num == 0) { - LOG(FATAL) << "cannot init BSF with zero thread"; + LOG(ERROR) << "cannot init BSF with zero thread"; return -1; } @@ -42,7 +42,7 @@ int TaskExecutor::start(uint32_t thread_num, uint32_t init_timeout_sec) { int rc = THREAD_CREATE( &contexts[i].tid, NULL, &TaskExecutor::thread_entry, &contexts[i]); if (rc != 0) { - LOG(FATAL) << "failed to create BSF worker thread: index=" << i << ", rc=" << rc << ", errno=" << errno << ":" << strerror(errno); + LOG(ERROR) << "failed to create BSF worker thread: index=" << i << ", rc=" << rc << ", errno=" << errno << ":" << strerror(errno); return -1; } @@ -71,7 +71,7 @@ int TaskExecutor::start(uint32_t thread_num, uint32_t init_timeout_sec) { } if (has_error) { - LOG(FATAL) << "BSF thread init error"; + LOG(ERROR) << "BSF thread init error"; return -1; } @@ -86,7 +86,7 @@ int TaskExecutor::start(uint32_t thread_num, uint32_t init_timeout_sec) { init_timeout -= sleep_interval; } - LOG(FATAL) << "BSF thread init timed out"; + LOG(ERROR) << "BSF thread init timed out"; return -1; } @@ -108,19 +108,19 @@ TaskHandler TaskExecutor::schedule( const InArrayT& in, OutArrayT& out) { TaskT* task = butil::get_object(); if (!task) { - LOG(FATAL) << "Failed get TaskT from object pool"; + LOG(ERROR) << "Failed get TaskT from object pool"; return TaskHandler::valid_handle(); } if (!BatchTasks::check_valid(in, out, _batch_align)) { - LOG(FATAL) << "Invalid input & output"; + LOG(ERROR) << "Invalid input & output"; return TaskHandler::valid_handle(); } int fds[2]; int rc = pipe(fds); if (rc != 0) { - LOG(FATAL) << "call pipe() failed, errno=" << errno << ":" << strerror(errno); + LOG(ERROR) << "call pipe() failed, errno=" << errno << ":" << strerror(errno); return TaskHandler::valid_handle(); } @@ -149,7 +149,7 @@ bool TaskExecutor::fetch_batch(BatchTasks& batch) { } if (_task_queue.empty()) { - LOG(FATAL) << "invalid task queue!"; + LOG(ERROR) << "invalid task queue!"; return false; } @@ -169,7 +169,7 @@ template int TaskExecutor::work(ThreadContext* context) { if (_thread_init_fn != NULL) { if (_thread_init_fn(context->user_thread_context) != 0) { - LOG(FATAL) << "execute thread init thunk failed, BSF thread will exit"; + LOG(ERROR) << "execute thread init thunk failed, BSF thread will exit"; context->init_status = -1; return -1; } else { @@ -181,7 +181,7 @@ int TaskExecutor::work(ThreadContext* context) { while (!_stop) { if (_thread_reset_fn != NULL) { if (_thread_reset_fn(context->user_thread_context) != 0) { - LOG(FATAL) << "execute user thread reset failed"; + LOG(ERROR) << "execute user thread reset failed"; } } @@ -205,7 +205,7 @@ bool TaskManager::schedule(const InArrayT& in, _task_owned = handler; return true; } else { - LOG(FATAL) << "failed to schedule task"; + LOG(ERROR) << "failed to schedule task"; return false; } } diff --git a/predictor/framework/bsf.h b/predictor/framework/bsf.h index a152236e..4b21d265 100644 --- a/predictor/framework/bsf.h +++ b/predictor/framework/bsf.h @@ -121,7 +121,7 @@ public: void notify_tasks() { if (_batch_out.size() != _batch_in.size()) { - LOG(FATAL) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size(); + LOG(ERROR) << "batch size not consistency: " << _batch_out.size() << " != " << _batch_in.size(); return ; } @@ -133,7 +133,7 @@ public: for (size_t oi = begin; oi < end; ++oi, ++bi) { if (bi >= _batch_in.size()) { - LOG(FATAL) << "batch index overflow: " << bi << " > " <<_batch_in.size(); + LOG(ERROR) << "batch index overflow: " << bi << " > " <<_batch_in.size(); return ; } (*task->out)[oi] = _batch_out[bi]; diff --git a/predictor/framework/channel.h b/predictor/framework/channel.h index b38ef157..2327a02d 100644 --- a/predictor/framework/channel.h +++ b/predictor/framework/channel.h @@ -74,7 +74,7 @@ public: int share_to_bus(Bus* bus) { if (bus->regist(_op, this) != 0) { - LOG(FATAL) + LOG(ERROR) << "Failed regist channel[" << _op << "] to bus!"; return -1; @@ -128,7 +128,7 @@ public: } google::protobuf::Message* message_impl(derived_from_message) { - LOG(FATAL) << "Current type: " << typeid(T).name() + LOG(ERROR) << "Current type: " << typeid(T).name() << " is not derived from protobuf."; return NULL; } @@ -143,7 +143,7 @@ public: } const google::protobuf::Message* message_impl(derived_from_message) const { - LOG(FATAL) << "Current type: " << typeid(T).name() + LOG(ERROR) << "Current type: " << typeid(T).name() << " is not derived from protobuf."; return NULL; } diff --git a/predictor/framework/dag.cpp b/predictor/framework/dag.cpp index cbfd0ea6..4dcf4e01 100644 --- a/predictor/framework/dag.cpp +++ b/predictor/framework/dag.cpp @@ -34,7 +34,7 @@ int Dag::deinit() { if (conf != NULL) { Op* op = OpRepository::instance().get_op(node->type); if (op == NULL) { - LOG(FATAL) << "Failed to get_op, op type[" << node->type << "]"; + LOG(ERROR) << "Failed to get_op, op type[" << node->type << "]"; return -1; } op->delete_config(conf); @@ -89,7 +89,7 @@ EdgeMode Dag::parse_mode(std::string& mode) { int Dag::init(const char* path, const char* file, const std::string& name) { comcfg::Configure conf; if (conf.load(path, file) != 0) { - LOG(FATAL) << "Failed load conf from" + LOG(ERROR) << "Failed load conf from" << path << "/" << file << " in dag: " << name; return ERR_INTERNAL_FAILURE; @@ -123,7 +123,7 @@ int Dag::init(const configure::Workflow& conf, const std::string& name) { } Op* op = OpRepository::instance().get_op(node->type); if (op == NULL) { - LOG(FATAL) << "Failed to get_op, op type[" << node->type << "]"; + LOG(ERROR) << "Failed to get_op, op type[" << node->type << "]"; return ERR_INTERNAL_FAILURE; } // node->conf could be NULL @@ -134,7 +134,7 @@ int Dag::init(const configure::Workflow& conf, const std::string& name) { } if (topo_sort() != 0) { - LOG(FATAL) << "Topo sort dag[" << _dag_name << "] failed!"; + LOG(ERROR) << "Topo sort dag[" << _dag_name << "] failed!"; return ERR_INTERNAL_FAILURE; } @@ -228,7 +228,7 @@ void Dag::regist_metric(const std::string& service_name) { OP_METRIC_PREFIX + service_name + NAME_DELIMITER + node->full_name); Op* op = OpRepository::instance().get_op(node->type); if (op == NULL) { - LOG(FATAL) << "Failed to get_op, op type[" << node->type << "]"; + LOG(ERROR) << "Failed to get_op, op type[" << node->type << "]"; return; } op->set_full_name(service_name + NAME_DELIMITER + node->full_name); diff --git a/predictor/framework/dag_view.cpp b/predictor/framework/dag_view.cpp index 02810a38..1d9e55ad 100644 --- a/predictor/framework/dag_view.cpp +++ b/predictor/framework/dag_view.cpp @@ -17,12 +17,12 @@ int DagView::init(Dag* dag, const std::string& service_name) { for (uint32_t si = 0; si < stage_size; si++) { const DagStage* stage = dag->stage_by_index(si); if (stage == NULL) { - LOG(FATAL) << "Failed get stage by index:" << si; + LOG(ERROR) << "Failed get stage by index:" << si; return ERR_INTERNAL_FAILURE; } ViewStage* vstage = butil::get_object(); if (vstage == NULL) { - LOG(FATAL) + LOG(ERROR) << "Failed get vstage from object pool" << "at:" << si; return ERR_MEM_ALLOC_FAILURE; @@ -34,13 +34,13 @@ int DagView::init(Dag* dag, const std::string& service_name) { DagNode* node = stage->nodes[ni]; ViewNode* vnode = butil::get_object(); if (vnode == NULL) { - LOG(FATAL) << "Failed get vnode at:" << ni; + LOG(ERROR) << "Failed get vnode at:" << ni; return ERR_MEM_ALLOC_FAILURE; } // factory type Op* op = OpRepository::instance().get_op(node->type); if (op == NULL) { - LOG(FATAL) << "Failed get op with type:" + LOG(ERROR) << "Failed get op with type:" << node->type; return ERR_INTERNAL_FAILURE; } @@ -91,7 +91,7 @@ int DagView::execute(butil::IOBufBuilder* debug_os) { int errcode = execute_one_stage(_view[si], debug_os); TRACEPRINTF("finish to execute stage[%u]", si); if (errcode < 0) { - LOG(FATAL) + LOG(ERROR) << "failed execute stage[" << _view[si]->debug(); return errcode; @@ -115,7 +115,7 @@ int DagView::execute_one_stage(ViewStage* vstage, int errcode = op->process(debug_os != NULL); TRACEPRINTF("finish to execute op[%s]", op->name()); if (errcode < 0) { - LOG(FATAL) + LOG(ERROR) << "Execute failed, Op:" << op->debug_string(); return errcode; } @@ -156,14 +156,14 @@ const Channel* DagView::get_response_channel() const { // Caller obtains response channel from bus, and // writes it to rpc response(protbuf/json) if (_view.size() < 1) { - LOG(FATAL) << "invalid empty view stage!"; + LOG(ERROR) << "invalid empty view stage!"; return NULL; } ViewStage* last_stage = _view[_view.size() - 1]; if (last_stage->nodes.size() != 1 || last_stage->nodes[0] == NULL) { - LOG(FATAL) << "Invalid last stage, size[" + LOG(ERROR) << "Invalid last stage, size[" << last_stage->nodes.size() << "] != 1"; return NULL; @@ -171,7 +171,7 @@ const Channel* DagView::get_response_channel() const { Op* last_op = last_stage->nodes[0]->op; if (last_op == NULL) { - LOG(FATAL) << "Last op is NULL"; + LOG(ERROR) << "Last op is NULL"; return NULL; } return last_op->mutable_channel(); diff --git a/predictor/framework/infer.h b/predictor/framework/infer.h index 634864b9..134c5880 100644 --- a/predictor/framework/infer.h +++ b/predictor/framework/infer.h @@ -78,12 +78,12 @@ public: _infer_batch_size = conf.batch_infer_size(); _infer_batch_align = conf.enable_batch_align(); if (!check_need_reload() || load(_model_data_path) != 0) { - LOG(FATAL) << "Failed load model_data_path" << _model_data_path; + LOG(ERROR) << "Failed load model_data_path" << _model_data_path; return -1; } if (parse_version_info(conf, version) != 0) { - LOG(FATAL) << "Failed parse version info"; + LOG(ERROR) << "Failed parse version info"; return -1; } @@ -93,7 +93,7 @@ public: int proc_initialize(const configure::EngineDesc& conf, bool version) { if (proc_initialize_impl(conf, version) != 0) { - LOG(FATAL) << "Failed proc initialize impl"; + LOG(ERROR) << "Failed proc initialize impl"; return -1; } @@ -112,7 +112,7 @@ public: im::bsf::TaskExecutor::instance()->set_batch_align(_infer_batch_align); if (im::bsf::TaskExecutor::instance()->start(_infer_thread_num) != 0) { - LOG(FATAL) << "Failed start bsf executor, threads:" << _infer_thread_num; + LOG(ERROR) << "Failed start bsf executor, threads:" << _infer_thread_num; return -1; } @@ -152,7 +152,7 @@ public: int proc_finalize() { if (proc_finalize_impl() != 0) { - LOG(FATAL) << "Failed proc finalize impl"; + LOG(ERROR) << "Failed proc finalize impl"; return -1; } @@ -198,7 +198,7 @@ private: } else if (_reload_mode_tag == "none") { return false; } else { - LOG(FATAL) << "Not support check type: " + LOG(ERROR) << "Not support check type: " << _reload_mode_tag; return false; } @@ -207,7 +207,7 @@ private: bool check_timestamp_ne() { struct stat st; if (stat(_reload_tag_file.c_str(), &st) != 0) { - LOG(FATAL) << "Failed stat config file:" + LOG(ERROR) << "Failed stat config file:" << _reload_tag_file; return false; } @@ -224,7 +224,7 @@ private: bool check_timestamp_gt() { struct stat st; if (stat(_reload_tag_file.c_str(), &st) != 0) { - LOG(FATAL) << "Failed stat config file:" + LOG(ERROR) << "Failed stat config file:" << _reload_tag_file; return false; } @@ -293,7 +293,7 @@ public: for (uint32_t ti = 0; ti < _reload_vec.size(); ++ti) { if (load_data(_reload_vec[ti], model_data_dir) != 0) { - LOG(FATAL) << "Failed reload engine model: " << ti; + LOG(ERROR) << "Failed reload engine model: " << ti; return -1; } } @@ -312,7 +312,7 @@ public: md->cores[next_idx] = new (std::nothrow) EngineCore; if (!md->cores[next_idx] || md->cores[next_idx]->create(data_path) != 0) { - LOG(FATAL) << "Failed create model, path: " << data_path; + LOG(ERROR) << "Failed create model, path: " << data_path; return -1; } md->current_idx = next_idx; @@ -322,13 +322,13 @@ public: virtual int thrd_initialize_impl() { // memory pool to be inited in non-serving-threads if (MempoolWrapper::instance().thread_initialize() != 0) { - LOG(FATAL) << "Failed thread initialize mempool"; + LOG(ERROR) << "Failed thread initialize mempool"; return -1; } ModelData* md = new(std::nothrow) ModelData; if (!md || load_data(md, _model_data_path) != 0) { - LOG(FATAL) << "Failed create thread data from " << _model_data_path; + LOG(ERROR) << "Failed create thread data from " << _model_data_path; return -1; } @@ -341,7 +341,7 @@ public: int thrd_clear_impl() { // for non-serving-threads if (MempoolWrapper::instance().thread_clear() != 0) { - LOG(FATAL) << "Failed thread clear mempool"; + LOG(ERROR) << "Failed thread clear mempool"; return -1; } return 0; @@ -360,7 +360,7 @@ public: EngineCore* get_core() { ModelData* md = (ModelData*)THREAD_GETSPECIFIC(_skey); if (!md) { - LOG(FATAL) << "Failed get thread specific data"; + LOG(ERROR) << "Failed get thread specific data"; return NULL; } return md->cores[md->current_idx]; @@ -382,7 +382,7 @@ public: virtual int proc_initialize(const configure::EngineDesc& conf, bool version) { _pd = new (std::nothrow) ModelData; if (!_pd) { - LOG(FATAL) << "Failed to allocate for ProcData"; + LOG(ERROR) << "Failed to allocate for ProcData"; return -1; } return DBReloadableInferEngine::proc_initialize( @@ -393,7 +393,7 @@ public: // 加载进程级模型数据 if (!_pd || DBReloadableInferEngine::load_data( _pd, model_data_dir) != 0) { - LOG(FATAL) + LOG(ERROR) << "Failed to create common model from [" << model_data_dir << "]."; return -1; @@ -409,7 +409,7 @@ public: for (uint32_t ti = 0; ti < DBReloadableInferEngine::_reload_vec.size(); ++ti) { if (load_data(DBReloadableInferEngine::_reload_vec[ti], _pd->cores[_pd->current_idx]) != 0) { - LOG(FATAL) << "Failed reload engine model: " << ti; + LOG(ERROR) << "Failed reload engine model: " << ti; return -1; } } @@ -431,7 +431,7 @@ public: td->cores[next_idx] = new (std::nothrow) EngineCore; if (!td->cores[next_idx] || td->cores[next_idx]->clone(pd_core->get()) != 0) { - LOG(FATAL) << "Failed clone model from pd_core[ " << pd_core + LOG(ERROR) << "Failed clone model from pd_core[ " << pd_core << "], idx[" << next_idx << "]"; return -1; } @@ -446,13 +446,13 @@ public: virtual int thrd_initialize_impl() { // memory pool to be inited in non-serving-threads if (MempoolWrapper::instance().thread_initialize() != 0) { - LOG(FATAL) << "Failed thread initialize mempool"; + LOG(ERROR) << "Failed thread initialize mempool"; return -1; } ModelData* md = new(std::nothrow) ModelData; if (!md || load_data(md, _pd->cores[_pd->current_idx]) != 0) { - LOG(FATAL) << "Failed clone thread data, origin_core[" + LOG(ERROR) << "Failed clone thread data, origin_core[" << _pd->cores[_pd->current_idx] << "]."; return -1; } @@ -477,12 +477,12 @@ public: FluidFamilyCore* core = DBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get fluid core in infer_impl()"; + LOG(ERROR) << "Failed get fluid core in infer_impl()"; return -1; } if (!core->Run(in, out)) { - LOG(FATAL) << "Failed run fluid family core"; + LOG(ERROR) << "Failed run fluid family core"; return -1; } return 0; @@ -503,19 +503,19 @@ public: TensorrtFamilyCore* core = DBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get fluid core in infer_impl()"; + LOG(ERROR) << "Failed get fluid core in infer_impl()"; return -1; } if (!core->Run(in, out, batch_size)) { - LOG(FATAL) << "Failed run fluid family core"; + LOG(ERROR) << "Failed run fluid family core"; return -1; } return 0; } int infer_impl2(const BatchTensor& in, BatchTensor& out) { - LOG(FATAL) << "Tensortrt donot supports infer_impl2 yet!"; + LOG(ERROR) << "Tensortrt donot supports infer_impl2 yet!"; return -1; } }; @@ -527,12 +527,12 @@ public: ~AbacusInferEngine() {} int infer_impl1(const void* in, void* out, uint32_t batch_size = -1) { - LOG(FATAL) << "Abacus dnn engine must use predict interface"; + LOG(ERROR) << "Abacus dnn engine must use predict interface"; return -1; } int infer_impl2(const BatchTensor& in, BatchTensor& out) { - LOG(FATAL) << "Abacus dnn engine must use predict interface"; + LOG(ERROR) << "Abacus dnn engine must use predict interface"; return -1; } @@ -541,7 +541,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in predict()"; + LOG(ERROR) << "Failed get abacus core in predict()"; return -1; } @@ -551,7 +551,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in predict()"; + LOG(ERROR) << "Failed get abacus core in predict()"; return -1; } @@ -561,7 +561,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in debug()"; + LOG(ERROR) << "Failed get abacus core in debug()"; return -1; } return core->debug(); @@ -571,7 +571,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in set_serach_id()"; + LOG(ERROR) << "Failed get abacus core in set_serach_id()"; return -1; } return core->set_search_id(sid); @@ -581,7 +581,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in set_layer_dim()"; + LOG(ERROR) << "Failed get abacus core in set_layer_dim()"; return -1; } return core->set_hidden_layer_dim(dim); @@ -592,7 +592,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in get_input()"; + LOG(ERROR) << "Failed get abacus core in get_input()"; return -1; } return core->get_input(ins_idx, fea_num, in); @@ -603,7 +603,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in get_layer_value()"; + LOG(ERROR) << "Failed get abacus core in get_layer_value()"; return -1; } return core->get_layer_value(name, ins_num, fea_dim, out); @@ -613,7 +613,7 @@ public: AbacusFamilyCore* core = CloneDBReloadableInferEngine::get_core(); if (!core || !core->get()) { - LOG(FATAL) << "Failed get abacus core in set_position_idx()"; + LOG(ERROR) << "Failed get abacus core in set_position_idx()"; return; } core->set_position_idx(input, fea, ins_idx); @@ -628,12 +628,12 @@ public: ~PaddleV2InferEngine() {} int infer_impl1(const void* in, void* out, uint32_t batch_size = -1) { - LOG(FATAL) << "Paddle V2 engine must use predict interface"; + LOG(ERROR) << "Paddle V2 engine must use predict interface"; return -1; } int infer_impl2(const BatchTensor& in, BatchTensor& out) { - LOG(FATAL) << "Paddle V2 engine must use predict interface"; + LOG(ERROR) << "Paddle V2 engine must use predict interface"; return -1; } }; @@ -649,7 +649,7 @@ public: int proc_initialize(const configure::EngineDesc& conf) { if (proc_initialize(conf, false) != 0) { - LOG(FATAL) << "Failed proc intialize engine: " + LOG(ERROR) << "Failed proc intialize engine: " << conf.name().c_str(); return -1; } @@ -665,20 +665,20 @@ public: = StaticInferFactory::instance().generate_object( engine_type); if (!engine) { - LOG(FATAL) << "Failed generate engine with type:" + LOG(ERROR) << "Failed generate engine with type:" << engine_type; return -1; } if (engine->proc_initialize(conf, version) != 0) { - LOG(FATAL) << "Failed initialize engine, type:" + LOG(ERROR) << "Failed initialize engine, type:" << engine_type; return -1; } auto r = _versions.insert(std::make_pair(engine->version(), engine)); if (!r.second) { - LOG(FATAL) << "Failed insert item: " << engine->version() + LOG(ERROR) << "Failed insert item: " << engine->version() << ", type: " << engine_type; return -1; } @@ -690,7 +690,7 @@ public: int proc_finalize() { for (auto iter = _versions.begin(); iter != _versions.end(); ++iter) { if (iter->second->proc_finalize() != 0) { - LOG(FATAL) << "Failed proc finalize version engine: " << + LOG(ERROR) << "Failed proc finalize version engine: " << iter->first; } LOG(WARNING) @@ -702,7 +702,7 @@ public: int thrd_initialize() { for (auto iter = _versions.begin(); iter != _versions.end(); ++iter) { if (iter->second->thrd_initialize() != 0) { - LOG(FATAL) << "Failed thrd initialize version engine: " << + LOG(ERROR) << "Failed thrd initialize version engine: " << iter->first; return -1; } @@ -715,7 +715,7 @@ public: int thrd_clear() { for (auto iter = _versions.begin(); iter != _versions.end(); ++iter) { if (iter->second->thrd_clear() != 0) { - LOG(FATAL) << "Failed thrd clear version engine: " << + LOG(ERROR) << "Failed thrd clear version engine: " << iter->first; return -1; } @@ -727,7 +727,7 @@ public: int thrd_finalize() { for (auto iter = _versions.begin(); iter != _versions.end(); ++iter) { if (iter->second->thrd_finalize() != 0) { - LOG(FATAL) << "Failed thrd finalize version engine: " << + LOG(ERROR) << "Failed thrd finalize version engine: " << iter->first; return -1; } @@ -739,7 +739,7 @@ public: int reload() { for (auto iter = _versions.begin(); iter != _versions.end(); ++iter) { if (iter->second->reload() != 0) { - LOG(FATAL) << "Failed reload version engine: " << + LOG(ERROR) << "Failed reload version engine: " << iter->first; return -1; } @@ -760,7 +760,7 @@ public: // inference interface InferEngine* default_engine() const { if (_versions.size() != 1) { - LOG(FATAL) << "Ambiguous default engine version:" + LOG(ERROR) << "Ambiguous default engine version:" << _versions.size(); return NULL; } @@ -797,7 +797,7 @@ public: const void* in, void* out, uint32_t batch_size, uint64_t version) { auto iter = _versions.find(version); if (iter == _versions.end()) { - LOG(FATAL) << "Not found version engine: " << version; + LOG(ERROR) << "Not found version engine: " << version; return -1; } @@ -808,7 +808,7 @@ public: T* get_core(uint64_t version) { auto iter = _versions.find(version); if (iter == _versions.end()) { - LOG(FATAL) << "Not found version engine: " << version; + LOG(ERROR) << "Not found version engine: " << version; return NULL; } @@ -843,7 +843,7 @@ public: int proc_initialize(const char* path, const char* file) { ModelToolkitConf model_toolkit_conf; if (configure::read_proto_conf(path, file, &model_toolkit_conf) != 0) { - LOG(FATAL) << "failed load infer config, path: " + LOG(ERROR) << "failed load infer config, path: " << path << "/" << file; return -1; } @@ -853,19 +853,19 @@ public: std::string engine_name = model_toolkit_conf.engines(ei).name(); VersionedInferEngine* engine = new (std::nothrow) VersionedInferEngine(); if (!engine) { - LOG(FATAL) << "Failed generate versioned engine: " << engine_name; + LOG(ERROR) << "Failed generate versioned engine: " << engine_name; return -1; } if (engine->proc_initialize(model_toolkit_conf.engines(ei)) != 0) { - LOG(FATAL) << "Failed initialize version engine, name:" + LOG(ERROR) << "Failed initialize version engine, name:" << engine_name; return -1; } auto r = _map.insert(std::make_pair(engine_name, engine)); if (!r.second) { - LOG(FATAL) << "Failed insert item: " << engine_name; + LOG(ERROR) << "Failed insert item: " << engine_name; return -1; } LOG(WARNING) << "Succ proc initialize engine: " << engine_name; @@ -877,7 +877,7 @@ public: int thrd_initialize() { for (auto it = _map.begin(); it != _map.end(); ++it) { if (it->second->thrd_initialize() != 0) { - LOG(FATAL) << "Failed thrd initialize engine, name: " + LOG(ERROR) << "Failed thrd initialize engine, name: " << it->first; return -1; } @@ -890,7 +890,7 @@ public: int thrd_clear() { for (auto it = _map.begin(); it != _map.end(); ++it) { if (it->second->thrd_clear() != 0) { - LOG(FATAL) << "Failed thrd clear engine, name: " + LOG(ERROR) << "Failed thrd clear engine, name: " << it->first; return -1; } @@ -901,7 +901,7 @@ public: int reload() { for (auto it = _map.begin(); it != _map.end(); ++it) { if (it->second->reload() != 0) { - LOG(FATAL) << "Failed reload engine, name: " + LOG(ERROR) << "Failed reload engine, name: " << it->first; return -1; } @@ -912,7 +912,7 @@ public: int thrd_finalize() { for (auto it = _map.begin(); it != _map.end(); ++it) { if (it->second->thrd_finalize() != 0) { - LOG(FATAL) << "Failed thrd finalize engine, name: " + LOG(ERROR) << "Failed thrd finalize engine, name: " << it->first; return -1; } @@ -925,7 +925,7 @@ public: int proc_finalize() { for (auto it = _map.begin(); it != _map.end(); ++it) { if (it->second->proc_finalize() != 0) { - LOG(FATAL) << "Failed proc finalize engine, name: " + LOG(ERROR) << "Failed proc finalize engine, name: " << it->first; return -1; } diff --git a/predictor/framework/infer_data.h b/predictor/framework/infer_data.h index ad244c39..cd26982a 100644 --- a/predictor/framework/infer_data.h +++ b/predictor/framework/infer_data.h @@ -86,14 +86,14 @@ struct Tensor { bool valid() const { if (shape.empty()) { if (data.data() || data.size()) { - LOG(FATAL) << "data should be empty"; + LOG(ERROR) << "data should be empty"; return false; } return true; } if (!data.data() || !data.size()) { - LOG(FATAL) << "data cannot empty"; + LOG(ERROR) << "data cannot empty"; return false; } @@ -103,7 +103,7 @@ struct Tensor { } if (byte_size * ele_byte() != data.size()) { - LOG(FATAL) << "wrong data size: " << byte_size * ele_byte() << " vs. " << data.size(); + LOG(ERROR) << "wrong data size: " << byte_size * ele_byte() << " vs. " << data.size(); return false; } diff --git a/predictor/framework/manager.h b/predictor/framework/manager.h index 1cb27436..e280a01a 100644 --- a/predictor/framework/manager.h +++ b/predictor/framework/manager.h @@ -41,7 +41,7 @@ public: int initialize(const std::string path, const std::string file) { WorkflowConf workflow_conf; if (configure::read_proto_conf(path, file, &workflow_conf) != 0) { - LOG(FATAL) << "Failed load manager<" << Workflow::tag() << "> configure from " << path << "/" << file; + LOG(ERROR) << "Failed load manager<" << Workflow::tag() << "> configure from " << path << "/" << file; return -1; } @@ -52,11 +52,11 @@ public: std::string name = workflow_conf.workflows(ii).name(); Workflow* item = new (std::nothrow) Workflow(); if (item == NULL) { - LOG(FATAL) << "Failed create " << Workflow::tag() << " for: " << name; + LOG(ERROR) << "Failed create " << Workflow::tag() << " for: " << name; return -1; } if (item->init(workflow_conf.workflows(ii)) != 0) { - LOG(FATAL) + LOG(ERROR) << "Failed init item: " << name << " at:" << ii << "!"; return -1; @@ -66,7 +66,7 @@ public: typename boost::unordered_map::iterator, bool> r = _item_map.insert(std::make_pair(name, item)); if (!r.second) { - LOG(FATAL) + LOG(ERROR) << "Failed insert item:" << name << " at:" << ii << "!"; return -1; @@ -78,7 +78,7 @@ public: } } catch (...) { - LOG(FATAL) + LOG(ERROR) << "Config[" << path << "/" << file << "] format " << "invalid, load failed"; return -1; @@ -149,7 +149,7 @@ public: int initialize(const std::string path, const std::string file) { InferServiceConf infer_service_conf; if (configure::read_proto_conf(path, file, &infer_service_conf) != 0) { - LOG(FATAL) << "Failed load manager<" << InferService::tag() << "> configure!"; + LOG(ERROR) << "Failed load manager<" << InferService::tag() << "> configure!"; return -1; } @@ -160,11 +160,11 @@ public: std::string name = infer_service_conf.services(ii).name(); InferService* item = new (std::nothrow) InferService(); if (item == NULL) { - LOG(FATAL) << "Failed create " << InferService::tag() << " for: " << name; + LOG(ERROR) << "Failed create " << InferService::tag() << " for: " << name; return -1; } if (item->init(infer_service_conf.services(ii)) != 0) { - LOG(FATAL) + LOG(ERROR) << "Failed init item: " << name << " at:" << ii << "!"; return -1; @@ -174,7 +174,7 @@ public: typename boost::unordered_map::iterator, bool> r = _item_map.insert(std::make_pair(name, item)); if (!r.second) { - LOG(FATAL) + LOG(ERROR) << "Failed insert item:" << name << " at:" << ii << "!"; return -1; @@ -186,7 +186,7 @@ public: } } catch (...) { - LOG(FATAL) + LOG(ERROR) << "Config[" << path << "/" << file << "] format " << "invalid, load failed"; return -1; diff --git a/predictor/framework/op_repository.cpp b/predictor/framework/op_repository.cpp index d3effdeb..2bceff15 100644 --- a/predictor/framework/op_repository.cpp +++ b/predictor/framework/op_repository.cpp @@ -11,35 +11,35 @@ Op* OpRepository::get_op(std::string op_type) { if (iter != _repository.end()) { op = (iter->second)->get_op(); } else { - LOG(FATAL) << "Try to create unknown op[" << op_type << "]"; + LOG(ERROR) << "Try to create unknown op[" << op_type << "]"; } return op; } void OpRepository::return_op(Op* op) { if (op == NULL) { - LOG(FATAL) << "Try to return NULL op"; + LOG(ERROR) << "Try to return NULL op"; return; } ManagerMap::iterator iter = _repository.find(op->type()); if (iter != _repository.end()) { iter->second->return_op(op); } else { - LOG(FATAL) << "Try to return unknown op[" << op << "], op_type[" + LOG(ERROR) << "Try to return unknown op[" << op << "], op_type[" << op->type() << "]."; } } void OpRepository::return_op(const std::string& op_type, Op* op) { if (op == NULL) { - LOG(FATAL) << "Try to return NULL op"; + LOG(ERROR) << "Try to return NULL op"; return; } ManagerMap::iterator iter = _repository.find(op_type); if (iter != _repository.end()) { iter->second->return_op(op); } else { - LOG(FATAL) << "Try to return unknown op[" << op << "], op_type[" + LOG(ERROR) << "Try to return unknown op[" << op << "], op_type[" << op_type << "]."; } } diff --git a/predictor/framework/predictor_metric.h b/predictor/framework/predictor_metric.h index 3a3afd0b..ca684504 100644 --- a/predictor/framework/predictor_metric.h +++ b/predictor/framework/predictor_metric.h @@ -210,7 +210,7 @@ public: if (metric != NULL) { **metric << latency; } else { - LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; + LOG(ERROR) << "impossible, check if you regist[" << metric_name << "]."; } } @@ -219,7 +219,7 @@ public: if (metric != NULL) { **metric << count; } else { - LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; + LOG(ERROR) << "impossible, check if you regist[" << metric_name << "]."; } } @@ -228,7 +228,7 @@ public: if (metric != NULL) { **metric << value; } else { - LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; + LOG(ERROR) << "impossible, check if you regist[" << metric_name << "]."; } } @@ -237,7 +237,7 @@ public: if (metric != NULL) { **metric << value; } else { - LOG(FATAL) << "impossible, check if you regist[" << metric_name << "]."; + LOG(ERROR) << "impossible, check if you regist[" << metric_name << "]."; } } @@ -246,7 +246,7 @@ public: if (metric != NULL) { (*metric)->update_lhs(count); } else { - LOG(FATAL) << "impossible, check if you regist[" << name << "]."; + LOG(ERROR) << "impossible, check if you regist[" << name << "]."; } } @@ -255,7 +255,7 @@ public: if (metric != NULL) { (*metric)->update_rhs(count); } else { - LOG(FATAL) << "impossible, check if you regist[" << name << "]."; + LOG(ERROR) << "impossible, check if you regist[" << name << "]."; } } diff --git a/predictor/framework/resource.cpp b/predictor/framework/resource.cpp index 99c239a5..cb35b0cf 100644 --- a/predictor/framework/resource.cpp +++ b/predictor/framework/resource.cpp @@ -84,7 +84,7 @@ int Resource::thread_initialize() { // infer manager if (FLAGS_enable_model_toolkit && InferManager::instance().thrd_initialize() != 0) { - LOG(FATAL) << "Failed thrd initialized infer manager"; + LOG(ERROR) << "Failed thrd initialized infer manager"; return -1; } @@ -92,18 +92,18 @@ int Resource::thread_initialize() { if (p_dynamic_resource == NULL) { p_dynamic_resource = new (std::nothrow) DynamicResource; if (p_dynamic_resource == NULL) { - LOG(FATAL) << "failed to create tls DynamicResource"; + LOG(ERROR) << "failed to create tls DynamicResource"; return -1; } if (p_dynamic_resource->initialize() != 0) { - LOG(FATAL) << "DynamicResource initialize failed."; + LOG(ERROR) << "DynamicResource initialize failed."; delete p_dynamic_resource; p_dynamic_resource = NULL; return -1; } if (THREAD_SETSPECIFIC(_tls_bspec_key, p_dynamic_resource) != 0) { - LOG(FATAL) << "unable to set tls DynamicResource"; + LOG(ERROR) << "unable to set tls DynamicResource"; delete p_dynamic_resource; p_dynamic_resource = NULL; return -1; @@ -128,21 +128,21 @@ int Resource::thread_clear() { // infer manager if (FLAGS_enable_model_toolkit && InferManager::instance().thrd_clear() != 0) { - LOG(FATAL) << "Failed thrd clear infer manager"; + LOG(ERROR) << "Failed thrd clear infer manager"; return -1; } DynamicResource* p_dynamic_resource = (DynamicResource*) THREAD_GETSPECIFIC(_tls_bspec_key); if (p_dynamic_resource == NULL) { #if 0 - LOG(FATAL) << "tls dynamic resource shouldn't be null after thread_initialize"; + LOG(ERROR) << "tls dynamic resource shouldn't be null after thread_initialize"; #else - LOG(FATAL) << bthread_self() << ": tls dynamic resource shouldn't be null after thread_initialize"; + LOG(ERROR) << bthread_self() << ": tls dynamic resource shouldn't be null after thread_initialize"; #endif return -1; } if (p_dynamic_resource->clear() != 0) { - LOG(FATAL) << "Failed to invoke dynamic resource clear"; + LOG(ERROR) << "Failed to invoke dynamic resource clear"; return -1; } @@ -153,7 +153,7 @@ int Resource::thread_clear() { int Resource::reload() { if (FLAGS_enable_model_toolkit && InferManager::instance().reload() != 0) { - LOG(FATAL) << "Failed reload infer manager"; + LOG(ERROR) << "Failed reload infer manager"; return -1; } @@ -163,7 +163,7 @@ int Resource::reload() { int Resource::finalize() { if (FLAGS_enable_model_toolkit && InferManager::instance().proc_finalize() != 0) { - LOG(FATAL) << "Failed proc finalize infer manager"; + LOG(ERROR) << "Failed proc finalize infer manager"; return -1; } diff --git a/predictor/framework/server.cpp b/predictor/framework/server.cpp index e5b9970a..d6210191 100644 --- a/predictor/framework/server.cpp +++ b/predictor/framework/server.cpp @@ -32,12 +32,12 @@ int ServerManager::add_service_by_format(const std::string& format) { Service* service = FormatServiceManager::instance().get_service(format); if (service == NULL) { - LOG(FATAL) << "Not found service by format:" << format << "!"; + LOG(ERROR) << "Not found service by format:" << format << "!"; return -1; } if (_format_services.find(format) != _format_services.end()) { - LOG(FATAL) << "Cannot insert duplicated service by format:" + LOG(ERROR) << "Cannot insert duplicated service by format:" << format << "!"; return -1; } @@ -45,7 +45,7 @@ int ServerManager::add_service_by_format(const std::string& format) { std::pair::iterator, bool> it = _format_services.insert(std::make_pair(format, service)); if (!it.second) { - LOG(FATAL) << "Failed insert service by format:" + LOG(ERROR) << "Failed insert service by format:" << format << "!"; return -1; } @@ -126,11 +126,11 @@ void* ServerManager::_reload_worker(void* args) { while (ServerManager::reload_starting()) { LOG(INFO) << "Begin reload framework..."; if (Resource::instance().reload() != 0) { - LOG(FATAL) << "Failed reload resource!"; + LOG(ERROR) << "Failed reload resource!"; } if (WorkflowManager::instance().reload() != 0) { - LOG(FATAL) << "Failed reload workflows"; + LOG(ERROR) << "Failed reload workflows"; } usleep(FLAGS_reload_interval_s * 1000000); diff --git a/predictor/framework/service.cpp b/predictor/framework/service.cpp index 5ec5f1ae..c00755a6 100644 --- a/predictor/framework/service.cpp +++ b/predictor/framework/service.cpp @@ -30,7 +30,7 @@ int InferService::init(const configure::InferService& conf) { ServerManager& svr_mgr = ServerManager::instance(); if (svr_mgr.add_service_by_format(_infer_service_format) != 0) { - LOG(FATAL) + LOG(ERROR) << "Not found service by format name:" << _infer_service_format << "!"; return ERR_INTERNAL_FAILURE; @@ -44,7 +44,7 @@ int InferService::init(const configure::InferService& conf) { if (_enable_map_request_to_workflow) { if (_request_to_workflow_map.init( MAX_WORKFLOW_NUM_IN_ONE_SERVICE/*load_factor=80*/) != 0) { - LOG(FATAL) + LOG(ERROR) << "init request to workflow map failed, bucket_count[" << MAX_WORKFLOW_NUM_IN_ONE_SERVICE << "]."; return ERR_INTERNAL_FAILURE; @@ -52,7 +52,7 @@ int InferService::init(const configure::InferService& conf) { int err = 0; _request_field_key = conf.request_field_key().c_str(); if (_request_field_key == "") { - LOG(FATAL) + LOG(ERROR) << "read request_field_key failed, request_field_key[" << _request_field_key << "]."; return ERR_INTERNAL_FAILURE; @@ -74,7 +74,7 @@ int InferService::init(const configure::InferService& conf) { Workflow* workflow = WorkflowManager::instance().item(tokens[ti]); if (workflow == NULL) { - LOG(FATAL) + LOG(ERROR) << "Failed get workflow by name:" << tokens[ti] << ", ti: " << ti; return ERR_INTERNAL_FAILURE; @@ -85,7 +85,7 @@ int InferService::init(const configure::InferService& conf) { const std::string& request_field_value = conf.value_mapped_workflows(fi).request_field_value(); if (_request_to_workflow_map.insert(request_field_value, workflows) == NULL) { - LOG(FATAL) + LOG(ERROR) << "insert [" << request_field_value << "," << list << "] to _request_to_workflow_map failed."; return ERR_INTERNAL_FAILURE; @@ -100,7 +100,7 @@ int InferService::init(const configure::InferService& conf) { Workflow* workflow = WorkflowManager::instance().item(workflow_name); if (workflow == NULL) { - LOG(FATAL) + LOG(ERROR) << "Failed get workflow by name:" << workflow_name; return ERR_INTERNAL_FAILURE; @@ -158,7 +158,7 @@ int InferService::inference( int errcode = _execute_workflow(workflow, request, response, debug_os); TRACEPRINTF("finish to execute workflow[%s]", workflow->name().c_str()); if (errcode < 0) { - LOG(FATAL) << "Failed execute workflow[" << workflow->name() + LOG(ERROR) << "Failed execute workflow[" << workflow->name() << "] in:" << name(); return errcode; } @@ -171,7 +171,7 @@ int InferService::inference( int errcode = execute_one_workflow(fi, request, response, debug_os); TRACEPRINTF("finish to execute one workflow-%lu", fi); if (errcode < 0) { - LOG(FATAL) << "Failed execute 0-th workflow in:" << name(); + LOG(ERROR) << "Failed execute 0-th workflow in:" << name(); return errcode; } } @@ -192,7 +192,7 @@ int InferService::execute_one_workflow( google::protobuf::Message* response, butil::IOBufBuilder* debug_os) { if (index >= _flows.size()) { - LOG(FATAL) << "Faield execute workflow, index: " + LOG(ERROR) << "Faield execute workflow, index: " << index << " >= max:" << _flows.size(); return ERR_OVERFLOW_FAILURE; } @@ -217,7 +217,7 @@ int InferService::_execute_workflow( // call actual inference interface int errcode = dv->execute(debug_os); if (errcode < 0) { - LOG(FATAL) << "Failed execute dag for workflow:" + LOG(ERROR) << "Failed execute dag for workflow:" << workflow->name(); return errcode; } @@ -226,7 +226,7 @@ int InferService::_execute_workflow( // create ender channel and copy const Channel* res_channel = dv->get_response_channel(); if (!_merger || !_merger->merge(res_channel->message(), response)) { - LOG(FATAL) << "Failed merge channel res to response"; + LOG(ERROR) << "Failed merge channel res to response"; return ERR_INTERNAL_FAILURE; } TRACEPRINTF("finish to copy from"); diff --git a/predictor/framework/service_manager.h b/predictor/framework/service_manager.h index 0267f8c2..bb1d2008 100644 --- a/predictor/framework/service_manager.h +++ b/predictor/framework/service_manager.h @@ -12,7 +12,7 @@ do { \ int ret = ::baidu::paddle_serving::predictor::FormatServiceManager::instance().regist_service(\ svr_name, svr); \ if (ret != 0) { \ - LOG(FATAL) \ + LOG(ERROR) \ << "Failed regist service[" \ << svr_name << "]" << "[" \ << typeid(svr).name() << "]" \ @@ -32,7 +32,7 @@ public: int regist_service(const std::string& svr_name, Service* svr) { if (_service_map.find(svr_name) != _service_map.end()) { - LOG(FATAL) + LOG(ERROR) << "Service[" << svr_name << "][" << typeid(svr).name() << "]" << " already exist!"; @@ -42,7 +42,7 @@ public: std::pair::iterator, bool> ret; ret = _service_map.insert(std::make_pair(svr_name, svr)); if (ret.second == false) { - LOG(FATAL) + LOG(ERROR) << "Service[" << svr_name << "][" << typeid(svr).name() << "]" << " insert failed!"; diff --git a/predictor/framework/workflow.cpp b/predictor/framework/workflow.cpp index 4a6c0653..53f4a221 100644 --- a/predictor/framework/workflow.cpp +++ b/predictor/framework/workflow.cpp @@ -24,12 +24,12 @@ DagView* Workflow::fetch_dag_view(const std::string& service_name) { } else if (_type == "Parallel") { view = butil::get_object(); } else { - LOG(FATAL) + LOG(ERROR) << "Unknown dag type:" << _type << "!"; return NULL; } if (view == NULL) { - LOG(FATAL) << "create dag view from pool failed!"; + LOG(ERROR) << "create dag view from pool failed!"; return NULL; } view->init(&_dag, service_name); @@ -44,7 +44,7 @@ void Workflow::return_dag_view(DagView* view) { butil::return_object( dynamic_cast(view)); } else { - LOG(FATAL) + LOG(ERROR) << "Unknown dag type:" << _type << "!"; return ; } diff --git a/predictor/op/op.cpp b/predictor/op/op.cpp index 175fa61d..274c8409 100644 --- a/predictor/op/op.cpp +++ b/predictor/op/op.cpp @@ -20,7 +20,7 @@ int Op::init(Bus* bus, Dag* dag, uint32_t id, const std::string& name, _timer = butil::get_object(); if (!_timer) { - LOG(FATAL) << "Invalid timerflow in op:" + LOG(ERROR) << "Invalid timerflow in op:" << this->name(); return -1; } @@ -31,7 +31,7 @@ int Op::init(Bus* bus, Dag* dag, uint32_t id, const std::string& name, Channel* channel = mutable_channel(); if (channel == NULL) { - LOG(FATAL) + LOG(ERROR) << "Failed mutable channel in op: " << this->id() << ", " << this->name() << "!"; return -1; @@ -50,7 +50,7 @@ int Op::deinit() { _timer = NULL; if (release_channel() != 0) { - LOG(FATAL) << "Failed release channel in op:" + LOG(ERROR) << "Failed release channel in op:" << this->id() << ", " << this->name() << "!"; return -1; } @@ -60,12 +60,12 @@ int Op::deinit() { int Op::check_time(const char* tag) { if (!_timer) { - LOG(FATAL) << "Invalid timer in op"; + LOG(ERROR) << "Invalid timer in op"; return -1; } if (!_timer->check(tag)) { - LOG(FATAL) << "Failed check timer:" << tag; + LOG(ERROR) << "Failed check timer:" << tag; return -1; } @@ -78,7 +78,7 @@ int Op::process(bool debug) { _timer->start(); } if (!_has_init) { - LOG(FATAL) + LOG(ERROR) << "Make sure op has been init before inference"; return ERR_INTERNAL_FAILURE; } @@ -93,7 +93,7 @@ int Op::process(bool debug) { /* DagNode* node = _dag->node_by_name(this->name()); if (node == NULL) { - LOG(FATAL) << "Failed get node of op:" << this->name(); + LOG(ERROR) << "Failed get node of op:" << this->name(); return -1; } boost::unordered_map& depends = @@ -290,7 +290,7 @@ uint32_t Op::id() const { const std::string Op::debug_string() { const Channel* channel = get_channel(); if (!channel) { - LOG(FATAL) << "Invalid channel!"; + LOG(ERROR) << "Invalid channel!"; return "Invalid channel in OP"; } return channel->debug_string(); diff --git a/predictor/op/op.h b/predictor/op/op.h index 0abbff18..bf922a0a 100644 --- a/predictor/op/op.h +++ b/predictor/op/op.h @@ -43,7 +43,7 @@ public: OpChannel* op_channel = dynamic_cast*>(channel); if (!op_channel) { - LOG(FATAL) << "Cannot dynamic cast channel of op:" + LOG(ERROR) << "Cannot dynamic cast channel of op:" << this->name() << " to type: " << typeid(T).name(); return NULL; } @@ -63,7 +63,7 @@ public: const OpChannel* op_channel = dynamic_cast*>(channel); if (!op_channel) { - LOG(FATAL) << "Cannot dynamic cast channel of op:" + LOG(ERROR) << "Cannot dynamic cast channel of op:" << this->name() << " to type: " << typeid(T).name(); return NULL; } @@ -197,7 +197,7 @@ public: _channel = butil::get_object(); if (!_channel) { - LOG(FATAL) + LOG(ERROR) << "Failed mutable channel of type:" << typeid(T).name(); return NULL; diff --git a/predictor/src/pdcodegen.cpp b/predictor/src/pdcodegen.cpp index 85e5f3b6..1a3a7047 100644 --- a/predictor/src/pdcodegen.cpp +++ b/predictor/src/pdcodegen.cpp @@ -524,7 +524,7 @@ private: " LOG(INFO) << \"Failed fetch response from stub handler, new it\";\n" " cur_res = response->New();\n" " if (cur_res == NULL) {\n" - " LOG(FATAL) << \"Failed new response item!\";\n" + " LOG(ERROR) << \"Failed new response item!\";\n" " _stub_handler->update_average(1, \"pack_fail\");\n" " return brpc::SubCall::Bad();\n" " }\n" @@ -548,7 +548,7 @@ private: " response->MergeFrom(*sub_response);\n" " return brpc::ResponseMerger::MERGED;\n" "} catch (const std::exception& e) {\n" - " LOG(FATAL) << \"Merge failed.\";\n" + " LOG(ERROR) << \"Merge failed.\";\n" " _stub_handler->update_average(1, \"pack_fail\");\n" " return brpc::ResponseMerger::FAIL;\n" "}\n"); @@ -603,7 +603,7 @@ private: printer->Print( "sub_req = dynamic_cast<$req_type$*>(_stub_handler->fetch_request());\n" "if (sub_req == NULL) {\n" - " LOG(FATAL) << \"failed fetch sub_req from stub.\";\n" + " LOG(ERROR) << \"failed fetch sub_req from stub.\";\n" " _stub_handler->update_average(1, \"pack_fail\");\n" " return brpc::SubCall::Bad();\n" "}\n", @@ -613,7 +613,7 @@ private: } else { printer->Print( "if (req->$field_name$_size() != total_size) {\n" - " LOG(FATAL) << \"pack field size not consistency: \"\n" + " LOG(ERROR) << \"pack field size not consistency: \"\n" " << total_size << \"!=\" << req->$field_name$_size()\n" " << \", field: $field_name$.\";\n" " _stub_handler->update_average(1, \"pack_fail\");\n" @@ -643,7 +643,7 @@ private: "if (sub_req == NULL) { // no packed items\n" " sub_req = dynamic_cast<$req_type$*>(_stub_handler->fetch_request());\n" " if (!sub_req) {\n" - " LOG(FATAL) << \"failed fetch sub_req from stub handler.\";\n" + " LOG(ERROR) << \"failed fetch sub_req from stub handler.\";\n" " _stub_handler->update_average(1, \"pack_fail\");\n" " return brpc::SubCall::Bad();\n" " }\n" @@ -681,7 +681,7 @@ private: printer->Print( "google::protobuf::Message* sub_res = _stub_handler->fetch_response();\n" "if (sub_res == NULL) {\n" - " LOG(FATAL) << \"failed create sub_res from res.\";\n" + " LOG(ERROR) << \"failed create sub_res from res.\";\n" " _stub_handler->update_average(1, \"pack_fail\");\n" " return brpc::SubCall::Bad();\n" "}\n" diff --git a/predictor/src/pdserving.cpp b/predictor/src/pdserving.cpp index dad683d8..36e2adee 100644 --- a/predictor/src/pdserving.cpp +++ b/predictor/src/pdserving.cpp @@ -138,7 +138,7 @@ int main(int argc, char** argv) { int errcode = bthread_set_worker_startfn(pthread_worker_start_fn); if (errcode != 0) { - LOG(FATAL) << "Failed call pthread worker start function, error_code[" << errcode << "]"; + LOG(ERROR) << "Failed call pthread worker start function, error_code[" << errcode << "]"; return -1; } LOG(INFO) << "Succ call pthread worker start function"; diff --git a/sdk-cpp/CMakeLists.txt b/sdk-cpp/CMakeLists.txt index 206b74b0..f3fccbc7 100644 --- a/sdk-cpp/CMakeLists.txt +++ b/sdk-cpp/CMakeLists.txt @@ -40,3 +40,14 @@ target_include_directories(mapcnn_sparse PUBLIC target_link_libraries(mapcnn_sparse sdk-cpp -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) +# install +install(TARGETS sdk-cpp + ARCHIVE DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/lib + ) + +install(TARGETS ximage + RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/demo/client/bin) +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/conf DESTINATION + ${PADDLE_SERVING_INSTALL_DIR}/demo/client/) +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/data DESTINATION + ${PADDLE_SERVING_INSTALL_DIR}/demo/client/) diff --git a/sdk-cpp/conf/predictors.conf b/sdk-cpp/conf/predictors.conf deleted file mode 100644 index a3c315d1..00000000 --- a/sdk-cpp/conf/predictors.conf +++ /dev/null @@ -1,33 +0,0 @@ -[DefaultVariantInfo] -Tag : default -[.Connection] -ConnectTimeoutMilliSec: 2000 -RpcTimeoutMilliSec: 20000 -ConnectRetryCount : 2 -MaxConnectionPerHost : 100 -HedgeRequestTimeoutMilliSec: -1 -HedgeFetchRetryCount : 2 -BnsReloadIntervalSeconds : 10 -ConnectionType : pooled -[.NamingInfo] -ClusterFilterStrategy : Default -LoadBalanceStrategy : la -[.RpcParameter] -# 0-NONE, 1-SNAPPY, 2-GZIP, 3-ZLIB, 4-LZ4 -CompressType : 0 -PackageSize : 20 -Protocol : baidu_std -MaxChannelPerRequest : 3 - -[@Predictor] -name : ximage -service_name : baidu.paddle_serving.predictor.image_classification.ImageClassifyService -endpoint_router : WeightedRandomRender -[.WeightedRandomRender] -VariantWeightList : 50 -[.@VariantInfo] -Tag : var1 -[..NamingInfo] -Cluster : list://127.0.0.1:8010 -#Cluster : list://10.88.158.21:8010 - diff --git a/sdk-cpp/conf/predictors.conf.bak b/sdk-cpp/conf/predictors.conf.bak deleted file mode 100644 index 493e8e5c..00000000 --- a/sdk-cpp/conf/predictors.conf.bak +++ /dev/null @@ -1,71 +0,0 @@ -[DefaultVariantInfo] -Tag : default -[.Connection] -ConnectTimeoutMilliSec: 2000 -RpcTimeoutMilliSec: 20000 -ConnectRetryCount : 2 -MaxConnectionPerHost : 100 -HedgeRequestTimeoutMilliSec: -1 -HedgeFetchRetryCount : 2 -BnsReloadIntervalSeconds : 10 -ConnectionType : pooled -[.NamingInfo] -ClusterFilterStrategy : Default -LoadBalanceStrategy : la -[.RpcParameter] -# 0-NONE, 1-SNAPPY, 2-GZIP, 3-ZLIB, 4-LZ4 -CompressType : 0 -PackageSize : 20 -Protocol : baidu_std -MaxChannelPerRequest : 3 - -[@Predictor] -name : ximage -service_name : baidu.paddle_serving.predictor.image_classification.ImageClassifyService -endpoint_router : WeightedRandomRender -[.WeightedRandomRender] -VariantWeightList : 50 -[.@VariantInfo] -Tag : var1 -[..NamingInfo] -Cluster : list://127.0.0.1:8010 -#Cluster : list://10.88.158.21:8010 - -[@Predictor] -name : dense_cnn -service_name : baidu.paddle_serving.fluid_engine.DefaultDenseService -endpoint_router : WeightedRandomRender -[.WeightedRandomRender] -VariantWeightList : 25 -[.@VariantInfo] -Tag : var1 -[..NamingInfo] -Cluster : list://10.194.83.21:8010 -#Cluster : bns://opera-ps-mapcnn-000-nj03.MAP.nj03 -[..Connection] - -[@Predictor] -name : sparse_cnn -service_name : baidu.paddle_serving.fluid_engine.DefaultSparseService -endpoint_router : WeightedRandomRender -[.WeightedRandomRender] -VariantWeightList : 25 -[.@VariantInfo] -Tag : var1 -[..NamingInfo] -Cluster : list://10.194.83.21:8010 -#Cluster : bns://opera-ps-mapcnn-000-nj03.MAP.nj03 -[..Connection] - -[@Predictor] -name : wasq -service_name : baidu.infinite.map_rnn.MapRnnService -endpoint_router : WeightedRandomRender -[.WeightedRandomRender] -VariantWeightList : 25 -[.@VariantInfo] -Tag : var1 -[..NamingInfo] -Cluster : list://127.0.0.1:8010 -#Cluster : bns://opera-ps-mapcnn-000-nj03.MAP.nj03 -[..Connection] diff --git a/sdk-cpp/demo/mapcnn_dense.cpp b/sdk-cpp/demo/mapcnn_dense.cpp index 4593dcf7..70eec3b0 100644 --- a/sdk-cpp/demo/mapcnn_dense.cpp +++ b/sdk-cpp/demo/mapcnn_dense.cpp @@ -36,7 +36,7 @@ public: pthread_mutex_init(&_mutex, NULL); FILE* fp = fopen(file_name.c_str(), "r"); if (!fp) { - LOG(FATAL) << "Failed open data file: " + LOG(ERROR) << "Failed open data file: " << file_name; return -1; } @@ -58,7 +58,7 @@ public: for (size_t ri = 0; ri < buf_size; ri++) { Request* req = new Request(); if (generate_one_req(*req, batch_size) != 0) { - LOG(FATAL) << "Failed generate req at: " << ri; + LOG(ERROR) << "Failed generate req at: " << ri; fclose(fp); return -1; } @@ -229,7 +229,7 @@ void* work(void* p) { while (true) { Predictor* predictor = api->fetch_predictor("mapcnn"); if (!predictor) { - LOG(FATAL) << "Failed fetch predictor: wasq"; + LOG(ERROR) << "Failed fetch predictor: wasq"; return NULL; } Request* req = input->next_req(); @@ -237,7 +237,7 @@ void* work(void* p) { timeval start; gettimeofday(&start, NULL); if (predictor->inference(req, &res) != 0) { - LOG(FATAL) << "failed call predictor with req:" + LOG(ERROR) << "failed call predictor with req:" << req->ShortDebugString(); return NULL; } @@ -264,19 +264,19 @@ int main(int argc, char** argv) { int qps = atoi(argv[4]); PredictorApi api; if (api.create("./conf", "predictors.conf") != 0) { - LOG(FATAL) << "Failed create predictors api!"; + LOG(ERROR) << "Failed create predictors api!"; return -1; } InputData data; if (data.create( "./data/pure_feature", req_buffer, batch_size, qps) != 0) { - LOG(FATAL) << "Failed create inputdata!"; + LOG(ERROR) << "Failed create inputdata!"; return -1; } Arg arg = {&api, &data}; pthread_t* threads = new pthread_t[thread_num]; if (!threads) { - LOG(FATAL) << "Failed create threads, num:" << thread_num; + LOG(ERROR) << "Failed create threads, num:" << thread_num; return -1; } for (int i = 0; i < thread_num; ++i) { diff --git a/sdk-cpp/demo/maprnn_dense.cpp b/sdk-cpp/demo/maprnn_dense.cpp index 964e0dbe..46f7b71e 100644 --- a/sdk-cpp/demo/maprnn_dense.cpp +++ b/sdk-cpp/demo/maprnn_dense.cpp @@ -295,7 +295,7 @@ public: _data_record = data; /*FILE* fp = fopen(file_name.c_str(), "r"); if (!fp) { - LOG(FATAL) << "Failed open data file: " + LOG(ERROR) << "Failed open data file: " << file_name; return -1; } diff --git a/serving/CMakeLists.txt b/serving/CMakeLists.txt index fe78975e..47247a6a 100644 --- a/serving/CMakeLists.txt +++ b/serving/CMakeLists.txt @@ -12,3 +12,12 @@ target_link_libraries(image_class opencv_imgcodecs ${opencv_depend_libs} -Wl,--whole-archive fluid_cpu_engine -Wl,--no-whole-archive pdserving paddle_fluid ${paddle_depend_libs} ${MKLML_LIB} ${MKLML_IOMP_LIB} -lpthread -lcrypto -lm -lrt -lssl -ldl -lz) + +install(TARGETS image_class + RUNTIME DESTINATION ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/bin) +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/conf DESTINATION + ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/) +install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/data DESTINATION + ${PADDLE_SERVING_INSTALL_DIR}/demo/serving/) + + diff --git a/serving/conf/dense_dag.conf b/serving/conf/dense_dag.conf deleted file mode 100644 index a10399b9..00000000 --- a/serving/conf/dense_dag.conf +++ /dev/null @@ -1,4 +0,0 @@ -workflow_type: Sequence -[@Node] -name: dense_op -type: DenseOp diff --git a/serving/conf/imagec_dag.conf b/serving/conf/imagec_dag.conf deleted file mode 100644 index 05bfd015..00000000 --- a/serving/conf/imagec_dag.conf +++ /dev/null @@ -1,16 +0,0 @@ -workflow_type: Sequence -[@Node] -name: image_reader_op -type: ReaderOp -[@Node] -name: image_classify_op -type: ClassifyOp -[.@Depend] -name: image_reader_op -mode: RO -[@Node] -name: write_json_op -type: WriteOp -[.@Depend] -name: image_classify_op -mode: RO diff --git a/serving/conf/log.conf b/serving/conf/log.conf deleted file mode 100644 index 28ed37d3..00000000 --- a/serving/conf/log.conf +++ /dev/null @@ -1,32 +0,0 @@ -COMLOG_LEVEL : 16 -COMLOG_DEVICE_NUM : 2 -COMLOG_DEVICE0 : TRACE -COMLOG_DEVICE1 : WARNING - -TRACE_OPEN : 1 -TRACE_TYPE : FILE -TRACE_PATH : ./log -TRACE_NAME : pdserving.log -TRACE_SYSLEVEL : 0 -TRACE_SELFLEVEL : NOTICE,TRACE,DEBUG -TRACE_SIZE : 4000 -TRACE_SPLITE_TYPE : DATECUT -TRACE_DATA_CUTTIME : 60 -TRACE_DATA_CRONOCUT : 1 -TRACE_RESERVED1 : %Y%m%d%H -TRACE_LAYOUT : %L: %A %T %R -TRACE_QUOTA_DAY : 2 - -WARNING_OPEN : 1 -WARNING_TYPE : FILE -WARNING_PATH : ./log -WARNING_NAME : pdserving.log.wf -WARNING_SYSLEVEL : 0 -WARNING_SELFLEVEL : WARNING,FATAL -WARNING_SIZE : 4000 -WARNING_SPLITE_TYPE : DATECUT -WARNING_DATA_CUTTIME : 60 -WARNING_DATA_CRONOCUT : 1 -WARNING_RESERVED1 : %Y%m%d%H -WARNING_LAYOUT : %L: %A %T %R -WARNING_QUOTA_DAY : 2 diff --git a/serving/conf/model_toolkit.conf b/serving/conf/model_toolkit.conf deleted file mode 100644 index 1bab437f..00000000 --- a/serving/conf/model_toolkit.conf +++ /dev/null @@ -1,9 +0,0 @@ -[@Engine] -Type : FLUID_CPU_NATIVE_DIR -Name : image_classification_resnet -ReloadableMeta: ./data/model/paddle/fluid_time_file -ReloadableType: timestamp_ne -ModelDataPath: ./data/model/paddle/fluid/SE_ResNeXt50_32x4d -RuntimeThreadNum: 0 -BatchInferSize: 0 -EnableBatchAlign: 0 diff --git a/serving/conf/resource.conf b/serving/conf/resource.conf deleted file mode 100644 index 7f63e422..00000000 --- a/serving/conf/resource.conf +++ /dev/null @@ -1,3 +0,0 @@ -# model toolkit conf -model_toolkit_path: ./conf -model_toolkit_file: model_toolkit.conf diff --git a/serving/conf/service.conf b/serving/conf/service.conf deleted file mode 100644 index f7c79b48..00000000 --- a/serving/conf/service.conf +++ /dev/null @@ -1,7 +0,0 @@ -[@Service] -name: ImageClassifyService -@workflow: workflow1 - -[@Service] -name: BuiltinDenseFormatService -@workflow: workflow2 diff --git a/serving/conf/workflow.conf b/serving/conf/workflow.conf deleted file mode 100644 index 6c4c2e2e..00000000 --- a/serving/conf/workflow.conf +++ /dev/null @@ -1,9 +0,0 @@ -[@Workflow] -name: workflow1 -path: ./conf -file: imagec_dag.conf - -[@Workflow] -name: workflow2 -path: ./conf -file: dense_dag.conf diff --git a/serving/op/reader_op.cpp b/serving/op/reader_op.cpp index da9591d2..cbe69b48 100644 --- a/serving/op/reader_op.cpp +++ b/serving/op/reader_op.cpp @@ -46,7 +46,7 @@ int ReaderOp::inference() { const char* binary = ins.image_binary().c_str(); size_t length = ins.image_length(); if (length == 0) { - LOG(FATAL) << "Empty image, length is 0"; + LOG(ERROR) << "Empty image, length is 0"; return -1; } -- GitLab