diff --git a/cmake/external_libs/libevent.cmake b/cmake/external_libs/libevent.cmake index 553e1c65c40..902f19a5c7b 100644 --- a/cmake/external_libs/libevent.cmake +++ b/cmake/external_libs/libevent.cmake @@ -1,3 +1,5 @@ +set(libevent_CFLAGS "-fstack-protector-all -D_FORTIFY_SOURCE=2 -O2") +set(libevent_LDFLAGS "-Wl,-z,now") mindspore_add_pkg(libevent VER 2.1.12 LIBS event event_pthreads diff --git a/serving/acl/acl_session.h b/serving/acl/acl_session.h index c1ae025df2e..b60b9a60189 100644 --- a/serving/acl/acl_session.h +++ b/serving/acl/acl_session.h @@ -29,7 +29,6 @@ namespace mindspore { namespace inference { - class AclSession : public InferSession { public: AclSession(); diff --git a/serving/acl/dvpp_process.cc b/serving/acl/dvpp_process.cc index 10530ad4917..b1b95ac5722 100644 --- a/serving/acl/dvpp_process.cc +++ b/serving/acl/dvpp_process.cc @@ -23,7 +23,6 @@ namespace mindspore { namespace inference { - DvppProcess::DvppProcess() {} DvppProcess::~DvppProcess() {} @@ -1134,6 +1133,5 @@ Status DvppProcess::InitWithJsonConfig(const std::string &json_config) { } return SUCCESS; } - } // namespace inference } // namespace mindspore diff --git a/serving/acl/model_process.cc b/serving/acl/model_process.cc index 4016d1c00b2..0c0debdb0b7 100644 --- a/serving/acl/model_process.cc +++ b/serving/acl/model_process.cc @@ -22,7 +22,6 @@ namespace mindspore { namespace inference { - Status ModelProcess::PreInitModelResource() { model_desc_ = aclmdlCreateDesc(); aclError acl_ret = aclmdlGetDesc(model_desc_, model_id_); @@ -428,6 +427,5 @@ size_t ModelProcess::GetBatchSize() const { } return static_cast(input_infos_[0].dims[0]); } - } // namespace inference } // namespace mindspore diff --git a/serving/acl/model_process.h b/serving/acl/model_process.h index ae716404ff5..c9995035aaf 100644 --- a/serving/acl/model_process.h +++ b/serving/acl/model_process.h @@ -25,7 +25,6 @@ namespace mindspore { namespace inference { - struct AclTensorInfo { void *device_data; size_t buffer_size; @@ -78,7 +77,6 @@ class ModelProcess { void DestroyInputsBuffer(); void DestroyOutputsBuffer(); }; - } // namespace inference } // namespace mindspore diff --git a/serving/core/http_process.cc b/serving/core/http_process.cc index e738dca933a..c53dc408082 100644 --- a/serving/core/http_process.cc +++ b/serving/core/http_process.cc @@ -32,7 +32,6 @@ using nlohmann::json; namespace mindspore { namespace serving { - const int BUF_MAX = 0x7FFFFFFF; static constexpr char HTTP_DATA[] = "data"; static constexpr char HTTP_TENSOR[] = "tensor"; @@ -550,6 +549,5 @@ void http_handler_msg(struct evhttp_request *const req, void *const arg) { evbuffer_free(retbuff); MSI_TIME_STAMP_END(TotalRestfulPredict) } - } // namespace serving } // namespace mindspore diff --git a/serving/core/server.cc b/serving/core/server.cc index 5a8112bb1f6..0a5a7f15b96 100644 --- a/serving/core/server.cc +++ b/serving/core/server.cc @@ -40,7 +40,6 @@ using ms_serving::PredictRequest; namespace mindspore { namespace serving { - namespace { static const uint32_t uint32max = 0x7FFFFFFF; std::promise exit_requested; @@ -66,7 +65,6 @@ grpc::Status CreatGRPCStatus(const Status &status) { return grpc::Status::CANCELLED; } } - } // namespace // Service Implement @@ -114,7 +112,6 @@ static std::pair NewHttpServer() { auto listener = evconnlistener_new_bind(eb, nullptr, nullptr, LEV_OPT_REUSEABLE | LEV_OPT_CLOSE_ON_EXEC | LEV_OPT_CLOSE_ON_FREE, -1, reinterpret_cast(&sin), sizeof(sin)); - if (listener == nullptr) { MSI_LOG_ERROR << "Serving Error: RESTful server start failed, create http listener faild, port " << http_port; std::cout << "Serving Error: RESTful server start failed, create http listener faild, port " << http_port diff --git a/serving/core/server.h b/serving/core/server.h index a7795403e8b..8c9ac046d85 100644 --- a/serving/core/server.h +++ b/serving/core/server.h @@ -19,7 +19,6 @@ #include "util/status.h" namespace mindspore { namespace serving { - class Server { public: Server() = default; diff --git a/serving/core/serving_tensor.cc b/serving/core/serving_tensor.cc index 72225f37549..3fc1871ee4d 100644 --- a/serving/core/serving_tensor.cc +++ b/serving/core/serving_tensor.cc @@ -27,7 +27,6 @@ using std::vector; namespace mindspore { namespace serving { - using inference::DataType; using inference::InferTensorBase; @@ -191,6 +190,5 @@ const inference::InferImagesBase *ServingImagesRequest::operator[](size_t index) } return &(cache_[index]); } - } // namespace serving } // namespace mindspore diff --git a/serving/core/serving_tensor.h b/serving/core/serving_tensor.h index a341046fef3..002f2dbbe4a 100644 --- a/serving/core/serving_tensor.h +++ b/serving/core/serving_tensor.h @@ -25,7 +25,6 @@ namespace mindspore { namespace serving { - class MS_API ServingTensor : public inference::InferTensorBase { public: // the other's lifetime must longer than this object @@ -101,7 +100,6 @@ class ServingImagesRequest : public inference::ImagesRequestBase { const ms_serving::PredictRequest &request_; std::vector cache_; }; - } // namespace serving } // namespace mindspore #endif // MINDSPORE_SERVING_TENSOR_H_ diff --git a/serving/core/session.cc b/serving/core/session.cc index a5204b60381..fb5d11cc450 100644 --- a/serving/core/session.cc +++ b/serving/core/session.cc @@ -35,7 +35,6 @@ using ms_serving::PredictRequest; namespace mindspore { namespace serving { - Status Session::CreatDeviceSession(const std::string &device, uint32_t device_id) { session_ = inference::InferSession::CreateSession(device, device_id); if (session_ == nullptr) { @@ -151,6 +150,5 @@ Status Session::GetModelInputsInfo(std::vector &tensor_l } return ret; } - } // namespace serving } // namespace mindspore diff --git a/serving/core/session.h b/serving/core/session.h index 08168f30d09..fd597b192b9 100644 --- a/serving/core/session.h +++ b/serving/core/session.h @@ -28,7 +28,6 @@ namespace mindspore { namespace serving { - using inference::FAILED; using inference::INVALID_INPUTS; using inference::Status; @@ -57,7 +56,6 @@ class Session { Status PredictInner(const PredictRequest &request, PredictReply &reply); }; - } // namespace serving } // namespace mindspore #endif // MINDSPORE_SERVER_H diff --git a/serving/core/util/file_system_operation.cc b/serving/core/util/file_system_operation.cc index 66bbde34141..e66ccbfb1ae 100644 --- a/serving/core/util/file_system_operation.cc +++ b/serving/core/util/file_system_operation.cc @@ -29,7 +29,6 @@ namespace mindspore { namespace serving { - bool DirOrFileExist(const std::string &file_path) { int ret = access(file_path.c_str(), 0); return (ret == -1) ? false : true; diff --git a/serving/core/util/option_parser.cc b/serving/core/util/option_parser.cc index 83976655fa2..25adf3e24c4 100644 --- a/serving/core/util/option_parser.cc +++ b/serving/core/util/option_parser.cc @@ -23,7 +23,6 @@ namespace mindspore { namespace serving { - bool StartWith(const std::string &str, const std::string &expected) { return expected.empty() || (str.size() >= expected.size() && memcmp(str.data(), expected.data(), expected.size()) == 0); diff --git a/serving/core/version_control/model.cc b/serving/core/version_control/model.cc index a656e9af919..27c666b68aa 100644 --- a/serving/core/version_control/model.cc +++ b/serving/core/version_control/model.cc @@ -19,7 +19,6 @@ namespace mindspore { namespace serving { - MindSporeModel::MindSporeModel(const std::string &model_name, const std::string &model_path, const std::string &model_version, const time_t &last_update_time) : model_name_(model_name), diff --git a/serving/core/version_control/version_controller.cc b/serving/core/version_control/version_controller.cc index 59e98eb8af0..69aa17be6e3 100644 --- a/serving/core/version_control/version_controller.cc +++ b/serving/core/version_control/version_controller.cc @@ -25,7 +25,6 @@ namespace mindspore { namespace serving { - volatile bool stop_poll = false; std::string GetVersionFromPath(const std::string &path) {