From a848303e10b77a61108ec22e48c02d20d4eeafaa Mon Sep 17 00:00:00 2001 From: Xin Pan Date: Tue, 22 May 2018 04:55:21 -0700 Subject: [PATCH] follow comments --- paddle/fluid/framework/executor.cc | 5 ++++- paddle/fluid/operators/detail/sendrecvop_utils.cc | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/framework/executor.cc b/paddle/fluid/framework/executor.cc index 55be9b6c3bb..4e431561f81 100644 --- a/paddle/fluid/framework/executor.cc +++ b/paddle/fluid/framework/executor.cc @@ -350,9 +350,12 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope, } } } - // platform::DeviceContextPool::Instance().Get(place_)->Wait(); + platform::DeviceContextPool::Instance().Get(place_)->Wait(); if (create_vars && create_local_scope) { scope->DeleteScope(local_scope); + } else { + // Delete the local scopes created in operators. + scope->DropKids(); } if (FLAGS_benchmark) { VLOG(2) << "-------------------------------------------------------"; diff --git a/paddle/fluid/operators/detail/sendrecvop_utils.cc b/paddle/fluid/operators/detail/sendrecvop_utils.cc index a9ea80c9173..a0d33456852 100644 --- a/paddle/fluid/operators/detail/sendrecvop_utils.cc +++ b/paddle/fluid/operators/detail/sendrecvop_utils.cc @@ -31,6 +31,10 @@ limitations under the License. */ namespace paddle { namespace operators { namespace detail { +namespace { +const int kStartProfile = 1; +const int kStopProfile = 2; +} // namespace using VarMsg = sendrecv::VariableMessage; @@ -124,9 +128,9 @@ void SerializeToByteBuffer(const std::string& name, framework::Variable* var, // trainer. if (platform::ShouldSendProfileState()) { if (platform::IsProfileEnabled()) { - request.set_profile(1); + request.set_profile(kStartProfile); } else { - request.set_profile(2); + request.set_profile(kStopProfile); } } if (!out_name.empty()) { -- GitLab