提交 79f70c34 编写于 作者: W wangguibao

make install; LOG(FATAL)->LOG(ERROR)

Change-Id: I7ae7a94d8c6086f669c374ecbfcff590dc663bfd
上级 3f81527a
......@@ -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)
......@@ -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
)
......@@ -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
)
......@@ -74,7 +74,7 @@ public:
virtual bool Run(const void* in_data, void* out_data) {
if (!_core->Run(*(std::vector<paddle::PaddleTensor>*)in_data,
(std::vector<paddle::PaddleTensor>*)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<paddle::PaddleTensor>*)in_data,
(std::vector<paddle::PaddleTensor>*)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;
}
......
......@@ -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
)
......@@ -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
......
......@@ -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 ;
}
......
......@@ -28,7 +28,7 @@ int TaskExecutor<TaskT>::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<TaskT>::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<TaskT>::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<TaskT>::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<TaskT> TaskExecutor<TaskT>::schedule(
const InArrayT& in, OutArrayT& out) {
TaskT* task = butil::get_object<TaskT>();
if (!task) {
LOG(FATAL) << "Failed get TaskT from object pool";
LOG(ERROR) << "Failed get TaskT from object pool";
return TaskHandler<TaskT>::valid_handle();
}
if (!BatchTasks<TaskT>::check_valid(in, out, _batch_align)) {
LOG(FATAL) << "Invalid input & output";
LOG(ERROR) << "Invalid input & output";
return TaskHandler<TaskT>::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<TaskT>::valid_handle();
}
......@@ -149,7 +149,7 @@ bool TaskExecutor<TaskT>::fetch_batch(BatchTasks<TaskT>& batch) {
}
if (_task_queue.empty()) {
LOG(FATAL) << "invalid task queue!";
LOG(ERROR) << "invalid task queue!";
return false;
}
......@@ -169,7 +169,7 @@ template<typename TaskT>
int TaskExecutor<TaskT>::work(ThreadContext<TaskT>* 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<TaskT>::work(ThreadContext<TaskT>* 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<InItemT, OutItemT>::schedule(const InArrayT& in,
_task_owned = handler;
return true;
} else {
LOG(FATAL) << "failed to schedule task";
LOG(ERROR) << "failed to schedule task";
return false;
}
}
......
......@@ -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];
......
......@@ -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<false>) {
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<false>) const {
LOG(FATAL) << "Current type: " << typeid(T).name()
LOG(ERROR) << "Current type: " << typeid(T).name()
<< " is not derived from protobuf.";
return NULL;
}
......
......@@ -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);
......
......@@ -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<ViewStage>();
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<ViewNode>();
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();
......
此差异已折叠。
......@@ -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;
}
......
......@@ -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<std::string, Workflow*>::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<std::string, InferService*>::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;
......
......@@ -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 << "].";
}
}
......
......@@ -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 << "].";
}
}
......
......@@ -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;
}
......
......@@ -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<boost::unordered_map<std::string, Service*>::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);
......
......@@ -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");
......
......@@ -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<boost::unordered_map<std::string, Service*>::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!";
......
......@@ -24,12 +24,12 @@ DagView* Workflow::fetch_dag_view(const std::string& service_name) {
} else if (_type == "Parallel") {
view = butil::get_object<ParallelDagView>();
} 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<ParallelDagView>(
dynamic_cast<ParallelDagView*>(view));
} else {
LOG(FATAL)
LOG(ERROR)
<< "Unknown dag type:" << _type << "!";
return ;
}
......
......@@ -20,7 +20,7 @@ int Op::init(Bus* bus, Dag* dag, uint32_t id, const std::string& name,
_timer = butil::get_object<TimerFlow>();
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<std::string, EdgeMode>& 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();
......
......@@ -43,7 +43,7 @@ public:
OpChannel<T>* op_channel =
dynamic_cast<OpChannel<T>*>(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<T>* op_channel =
dynamic_cast<const OpChannel<T>*>(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<ChannelType>();
if (!_channel) {
LOG(FATAL)
LOG(ERROR)
<< "Failed mutable channel of type:"
<< typeid(T).name();
return NULL;
......
......@@ -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"
......
......@@ -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";
......
......@@ -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/)
[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
[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]
......@@ -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) {
......
......@@ -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;
}
......
......@@ -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/)
workflow_type: Sequence
[@Node]
name: dense_op
type: DenseOp
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
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
[@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
# model toolkit conf
model_toolkit_path: ./conf
model_toolkit_file: model_toolkit.conf
[@Service]
name: ImageClassifyService
@workflow: workflow1
[@Service]
name: BuiltinDenseFormatService
@workflow: workflow2
[@Workflow]
name: workflow1
path: ./conf
file: imagec_dag.conf
[@Workflow]
name: workflow2
path: ./conf
file: dense_dag.conf
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册