diff --git a/mindspore/core/mindrt/include/mindrt.hpp b/mindspore/core/mindrt/include/mindrt.hpp index d3659859e1a..bcb7b8a5b6c 100644 --- a/mindspore/core/mindrt/include/mindrt.hpp +++ b/mindspore/core/mindrt/include/mindrt.hpp @@ -22,7 +22,6 @@ // brief provide an asynchronous programming framework as Actor model namespace mindspore { - struct MindrtAddress { std::string scheme; std::string ip; @@ -71,6 +70,5 @@ int GetHttpKmsgFlag(); // brief set flag of http message format void SetHttpKmsgFlag(int flag); - } // namespace mindspore #endif diff --git a/mindspore/core/mindrt/src/actor/actor.cc b/mindspore/core/mindrt/src/actor/actor.cc index 51b40ff1ebd..a188fe92d1d 100644 --- a/mindspore/core/mindrt/src/actor/actor.cc +++ b/mindspore/core/mindrt/src/actor/actor.cc @@ -85,7 +85,6 @@ void ActorBase::Run() { if (msg == nullptr) { continue; } - // std::cout << "dequeue message]actor=" << id.Name() << ",msg=" << msg->Name() << std::endl; AddMsgRecord(msg->Name()); switch (msg->GetType()) { case MessageBase::Type::KMSG: diff --git a/mindspore/core/mindrt/src/actor/actormgr.cc b/mindspore/core/mindrt/src/actor/actormgr.cc index 6a8719c32db..c4cb97834ec 100644 --- a/mindspore/core/mindrt/src/actor/actormgr.cc +++ b/mindspore/core/mindrt/src/actor/actormgr.cc @@ -24,7 +24,6 @@ #include "actor/iomgr.h" namespace mindspore { - ActorMgr ActorMgr::actorMgr; std::map> ActorMgr::ioMgrs; @@ -232,9 +231,7 @@ AID ActorMgr::Spawn(const ActorReference &actor, bool shareThread, bool start) { MS_LOG(ERROR) << "The actor's name conflicts,name:" << actor->GetAID().Name().c_str(); MINDRT_EXIT("Actor name conflicts."); } - MS_LOG(DEBUG) << "ACTOR was spawned,a=" << actor->GetAID().Name().c_str(); - std::unique_ptr threadPolicy; if (shareThread) { @@ -285,5 +282,4 @@ void ActorMgr::Wait(const AID &id) { actor->Await(); } } - }; // end of namespace mindspore diff --git a/mindspore/core/mindrt/src/actor/actorpolicy.cc b/mindspore/core/mindrt/src/actor/actorpolicy.cc index 8d38c05a809..71f4146e9cb 100644 --- a/mindspore/core/mindrt/src/actor/actorpolicy.cc +++ b/mindspore/core/mindrt/src/actor/actorpolicy.cc @@ -19,7 +19,6 @@ #include "actor/actorpolicy.h" namespace mindspore { - void ActorPolicy::SetRunningStatus(bool startRun) { std::lock_guard lock(mailboxLock); this->start = startRun; @@ -44,12 +43,10 @@ int SingleThread::EnqueMessage(std::unique_ptr &&msg) { enqueMailbox->push_back(std::move(msg)); result = ++msgCount; } - // Notify when the count of message is from empty to one. if (start && result == 1) { conditionVar.notify_one(); } - return result; } void SingleThread::Notify() { @@ -66,7 +63,6 @@ std::list> *SingleThread::GetMsgs() { // REF_PRIVATE_MEMBER result = dequeMailbox; - return result; } @@ -119,10 +115,7 @@ std::list> *ShardedThread::GetMsgs() { SwapMailbox(); result = dequeMailbox; } - mailboxLock.unlock(); - return result; } - }; // end of namespace mindspore diff --git a/mindspore/core/mindrt/src/actor/aid.cc b/mindspore/core/mindrt/src/actor/aid.cc index c12d02ae8b0..fa52ba48f71 100644 --- a/mindspore/core/mindrt/src/actor/aid.cc +++ b/mindspore/core/mindrt/src/actor/aid.cc @@ -17,7 +17,6 @@ #include "actor/aid.h" namespace mindspore { - constexpr int PORTMINNUMBER = 0; constexpr int PORTMAXNUMBER = 65535; constexpr int PROCOLLEN = 3; // strlen("://"); @@ -83,10 +82,8 @@ void AID::SetProtocol(const std::string &protocol) { } else { url = protocol + url.substr(index); } - } else { if (protocol == MINDRT_TCP) { - // url = url; } else { url = protocol + "://" + url; } @@ -125,5 +122,4 @@ uint16_t AID::GetPort() const { } return (uint16_t)std::stoul(url.substr(index + 1)); } - }; // end of namespace mindspore diff --git a/mindspore/core/mindrt/src/async/future.cc b/mindspore/core/mindrt/src/async/future.cc index e859ea75d01..e3107439732 100644 --- a/mindspore/core/mindrt/src/async/future.cc +++ b/mindspore/core/mindrt/src/async/future.cc @@ -18,11 +18,9 @@ namespace mindspore { namespace internal { - void Waitf(const AID &aid) { mindspore::Terminate(aid); MS_LOG(WARNING) << "WaitFor is timeout."; } - } // namespace internal } // namespace mindspore diff --git a/mindspore/core/mindrt/src/async/uuid_base.cc b/mindspore/core/mindrt/src/async/uuid_base.cc index b18c3ca5cad..934f2745b2b 100644 --- a/mindspore/core/mindrt/src/async/uuid_base.cc +++ b/mindspore/core/mindrt/src/async/uuid_base.cc @@ -21,7 +21,6 @@ namespace mindspore { namespace uuids { - constexpr int DASH_POS0 = 4; constexpr int DASH_POS1 = 6; constexpr int DASH_POS2 = 8; @@ -45,7 +44,6 @@ Option uuid::FromBytes(const std::string &s) { } uuid u; memcpy(&u.uuidData, s.data(), s.size()); - return Option(u); } @@ -116,7 +114,6 @@ bool uuid::IsNilUUID() const { return false; } } - return true; } @@ -142,7 +139,6 @@ uuid RandomBasedGenerator::GenerateRandomUuid() { // We use uniform distribution std::uniform_int_distribution distribution((std::numeric_limits::min)(), (std::numeric_limits::max)()); - uint64_t randomValue = distribution(gen); unsigned int i = 0; @@ -151,7 +147,6 @@ uuid RandomBasedGenerator::GenerateRandomUuid() { randomValue = distribution(gen); i = 0; } - *it = static_cast((randomValue >> (i * RIGHT_SHIFT_BITS)) & 0xFF); } @@ -171,6 +166,5 @@ uuid RandomBasedGenerator::GenerateRandomUuid() { return tmpUUID; } - } // namespace uuids } // namespace mindspore diff --git a/mindspore/core/mindrt/src/async/uuid_generator.cc b/mindspore/core/mindrt/src/async/uuid_generator.cc index 9f7d376976f..0dc7f8bff62 100644 --- a/mindspore/core/mindrt/src/async/uuid_generator.cc +++ b/mindspore/core/mindrt/src/async/uuid_generator.cc @@ -19,7 +19,6 @@ #include namespace mindspore { - namespace uuid_generator { UUID UUID::GetRandomUUID() { return UUID(mindspore::uuids::RandomBasedGenerator::GenerateRandomUuid()); } @@ -55,7 +54,5 @@ int GenHttpServerConnId() { return httpServerConnId++; } #endif - } // namespace localid_generator - } // namespace mindspore diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/cumsum_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/cumsum_fp32.cc index f5cfa39ece9..358650e2819 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/cumsum_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/cumsum_fp32.cc @@ -48,7 +48,7 @@ int CumsumLaunch(void *cdata, int task_id, float lhs_scale, float rhs_scale) { } // namespace int CumSumCPUKernel::Init() { - CHECK_LESS_RETURN(in_tensors_.size(), 2); + CHECK_LESS_RETURN(in_tensors_.size(), kInputSize1); CHECK_LESS_RETURN(out_tensors_.size(), 1); CHECK_NULL_RETURN(param_); if (!InferShapeDone()) { diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc index 4e82a43c206..1780f9f217a 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/fill_fp32.cc @@ -29,7 +29,7 @@ using mindspore::schema::PrimitiveType_Fill; namespace mindspore::kernel { int FillCPUKernel::Init() { - CHECK_LESS_RETURN(in_tensors_.size(), 2); + CHECK_LESS_RETURN(in_tensors_.size(), kInputSize1); CHECK_LESS_RETURN(out_tensors_.size(), 1); if (!InferShapeDone()) { return RET_OK; diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc index aaf18ca64ea..7a779e80191 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/gather_fp32.cc @@ -30,7 +30,7 @@ namespace { constexpr int kSecondInput = 2; } int GatherCPUKernel::Init() { - CHECK_LESS_RETURN(in_tensors_.size(), 3); + CHECK_LESS_RETURN(in_tensors_.size(), kInputSize2); CHECK_LESS_RETURN(out_tensors_.size(), 1); CHECK_NULL_RETURN(in_tensors_.at(kSecondInput)->data()); axis_ = *(reinterpret_cast(in_tensors_.at(kSecondInput)->data())); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc index 6441b7d4567..1b10eeaf6ee 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/layer_norm_fp32.cc @@ -27,7 +27,7 @@ using mindspore::schema::PrimitiveType_LayerNormFusion; namespace mindspore::kernel { int LayerNormCPUKernel::Init() { - CHECK_LESS_RETURN(in_tensors_.size(), 3); + CHECK_LESS_RETURN(in_tensors_.size(), kInputSize2); CHECK_LESS_RETURN(out_tensors_.size(), 1); CHECK_NULL_RETURN(param_); if (!InferShapeDone()) { diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc index 82c1cc24492..23d5ea526c3 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/local_response_norm_fp32.cc @@ -42,7 +42,7 @@ int LocalResponseNormCPUKernel::DoLocalResponseNorm(int task_id) { auto output_ptr = reinterpret_cast(out_tensor->MutableData()); auto in_shape = input_tensor->shape(); - MS_CHECK_TRUE_RET(in_shape.size() == 4, RET_ERROR); + MS_CHECK_TRUE_RET(in_shape.size() == C4NUM, RET_ERROR); int batch = in_shape.at(0); int height = in_shape.at(1); diff --git a/mindspore/lite/src/runtime/kernel/arm/fp32/lstm_fp32.cc b/mindspore/lite/src/runtime/kernel/arm/fp32/lstm_fp32.cc index 3deb6b32b0f..e82f6dc98ed 100644 --- a/mindspore/lite/src/runtime/kernel/arm/fp32/lstm_fp32.cc +++ b/mindspore/lite/src/runtime/kernel/arm/fp32/lstm_fp32.cc @@ -214,11 +214,11 @@ int LstmCPUKernel::InitParam() { } int LstmCPUKernel::Init() { - CHECK_LESS_RETURN(in_tensors_.size(), 6); + CHECK_LESS_RETURN(in_tensors_.size(), DIMENSION_6D); for (size_t i = 0; i < in_tensors_.size(); i++) { CHECK_NULL_RETURN(in_tensors_.at(i)); } - CHECK_LESS_RETURN(out_tensors_.size(), 3); + CHECK_LESS_RETURN(out_tensors_.size(), DIMENSION_3D); for (size_t i = 0; i < out_tensors_.size(); i++) { CHECK_NULL_RETURN(out_tensors_.at(i)); } @@ -254,7 +254,7 @@ int LstmCPUKernel::ReSize() { } int LstmCPUKernel::MallocRunBuffer() { - for (int i = 0; i < 7; i++) { + for (int i = 0; i < DIMENSION_7D; i++) { buffer_[i] = nullptr; } buffer_[packed_input_index] = reinterpret_cast(