From b31852967d3509fbf2ebe805ccb271341974f17a Mon Sep 17 00:00:00 2001 From: zmxdream Date: Tue, 7 Dec 2021 11:20:49 +0800 Subject: [PATCH] [heterps]fix heter service (#37860) * fix heter service. test=develop * fix heter section worker in debug mode --- paddle/fluid/distributed/service/heter_server.h | 4 ++-- paddle/fluid/framework/heter_section_worker.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/distributed/service/heter_server.h b/paddle/fluid/distributed/service/heter_server.h index 66141622f8..5f062755c9 100644 --- a/paddle/fluid/distributed/service/heter_server.h +++ b/paddle/fluid/distributed/service/heter_server.h @@ -336,7 +336,7 @@ class HeterServer { bool IsExit() { return service_.IsExit(); } - HeterServer() { this->ready_ = 0; } + HeterServer() : service_(), ready_(0) {} void RegisterServiceHandler(std::string message_name, HeterServiceHandler func); @@ -391,7 +391,7 @@ class HeterServer { DISABLE_COPY_AND_ASSIGN(HeterServer); std::mutex mutex_ready_; - int ready_ = 0; + int ready_; }; } // end namespace distributed diff --git a/paddle/fluid/framework/heter_section_worker.cc b/paddle/fluid/framework/heter_section_worker.cc index a8db38f807..69a4a180a9 100644 --- a/paddle/fluid/framework/heter_section_worker.cc +++ b/paddle/fluid/framework/heter_section_worker.cc @@ -277,7 +277,7 @@ void HeterSectionWorker::CopyParameters(int microbatch_id, void HeterSectionWorker::Run() { if (debug_) { size_t total_ops_size = forward_ops_.size() + backward_ops_.size(); - op_name_.resize(total_ops_size); + op_name_.reserve(total_ops_size); op_total_time_.resize(total_ops_size); platform::SetNumThreads(1); // forward op + backward op -- GitLab