Code review

This commit is contained in:
ZPaC 2021-08-04 16:27:50 +08:00
parent a83f8f6f5d
commit 638b241345
6 changed files with 6 additions and 8 deletions

View File

@ -38,6 +38,8 @@ bool ConsistentHashRing::Erase(uint32_t rank) {
for (auto iterator = ring_.begin(); iterator != ring_.end();) {
if (iterator->second == rank) {
(void)ring_.erase(iterator++);
} else {
iterator++;
}
}
return true;

View File

@ -103,6 +103,7 @@ bool DistributedCountService::Count(const std::string &name, const std::string &
return false;
}
MS_ERROR_IF_NULL_W_RET_VAL(report_cnt_rsp_msg, false);
CountResponse count_rsp;
(void)count_rsp.ParseFromArray(report_cnt_rsp_msg->data(), SizeToInt(report_cnt_rsp_msg->size()));
if (!count_rsp.result()) {

View File

@ -76,7 +76,7 @@ class OptimizerKernel : public CPUKernel {
}
size_t output_num = AnfAlgo::GetOutputTensorNum(kernel_node);
for (size_t output_index = 0; output_index < output_num; ++output_index) {
std::vector<size_t> shape = AnfAlgo::GetPrevNodeOutputInferShape(kernel_node, output_index);
std::vector<size_t> shape = AnfAlgo::GetOutputInferShape(kernel_node, output_index);
size_t tensor_size =
shape.empty() ? type_size : std::accumulate(shape.begin(), shape.end(), type_size, std::multiplies<size_t>());
output_size_list_.emplace_back(tensor_size);

View File

@ -129,10 +129,6 @@ std::shared_ptr<MemoryRegister> ModelStore::AssignNewModelMemory() {
MS_ERROR_IF_NULL_W_RET_VAL(weight_data, nullptr);
MS_ERROR_IF_NULL_W_RET_VAL(weight.second, nullptr);
MS_ERROR_IF_NULL_W_RET_VAL(weight.second->addr, nullptr);
if (weight_data == nullptr) {
MS_LOG(EXCEPTION) << "Assign memory for weight failed.";
return nullptr;
}
auto src_data_size = weight_size;
auto dst_data_size = weight_size;

View File

@ -339,7 +339,8 @@ std::vector<std::string> ParameterAggregator::SelectAggregationAlgorithm(const C
} else if (ps::PSContext::instance()->server_mode() == ps::kServerModePS) {
(void)aggregation_algorithm.emplace_back("DenseGradAccum");
} else {
MS_LOG(ERROR) << "Server doesn't support mode " << ps::PSContext::instance()->server_mode();
MS_LOG(EXCEPTION) << "Server doesn't support mode " << ps::PSContext::instance()->server_mode();
return aggregation_algorithm;
}
MS_LOG(INFO) << "Aggregation algorithm selection result: " << aggregation_algorithm;

View File

@ -169,7 +169,6 @@ bool Round::check_timeout() const { return check_timeout_; }
size_t Round::time_window() const { return time_window_; }
void Round::OnFirstCountEvent(const std::shared_ptr<ps::core::MessageHandler> &message) {
MS_ERROR_IF_NULL_WO_RET_VAL(message);
MS_ERROR_IF_NULL_WO_RET_VAL(kernel_);
MS_ERROR_IF_NULL_WO_RET_VAL(iter_timer_);
MS_LOG(INFO) << "Round " << name_ << " first count event is triggered.";
@ -184,7 +183,6 @@ void Round::OnFirstCountEvent(const std::shared_ptr<ps::core::MessageHandler> &m
}
void Round::OnLastCountEvent(const std::shared_ptr<ps::core::MessageHandler> &message) {
MS_ERROR_IF_NULL_WO_RET_VAL(message);
MS_ERROR_IF_NULL_WO_RET_VAL(kernel_);
MS_ERROR_IF_NULL_WO_RET_VAL(iter_timer_);
MS_LOG(INFO) << "Round " << name_ << " last count event is triggered.";