From 9c2d7df8ad6d41df116ab9b2f5ab942af2fc8637 Mon Sep 17 00:00:00 2001 From: qiaolongfei Date: Fri, 20 Apr 2018 14:55:39 +0800 Subject: [PATCH] optimize code --- paddle/fluid/operators/listen_and_serv_op.cc | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/paddle/fluid/operators/listen_and_serv_op.cc b/paddle/fluid/operators/listen_and_serv_op.cc index ec00a959f..f6256fc60 100644 --- a/paddle/fluid/operators/listen_and_serv_op.cc +++ b/paddle/fluid/operators/listen_and_serv_op.cc @@ -48,6 +48,13 @@ static void ParallelExecuteBlocks( for (size_t i = 0; i < fs.size(); ++i) fs[i].wait(); } +static void SavePort(std::shared_ptr rpc_service) { + std::ofstream port_file; + port_file.open("/tmp/paddle.selected_port"); + port_file << rpc_service->GetSelectedPort(); + port_file.close(); +} + ListenAndServOp::ListenAndServOp(const std::string &type, const framework::VariableNameMap &inputs, const framework::VariableNameMap &outputs, @@ -66,9 +73,8 @@ void ListenAndServOp::Stop() { void ListenAndServOp::PreparePrefetchCtx( framework::Executor *executor, framework::BlockDesc *prefetch_block, framework::ProgramDesc *program) const { - // TODO(qiao) set proper fields for table lookup and update - rpc_service_->SetExecutor(executor); VLOG(3) << "prefetch block id is " << prefetch_block->ID(); + rpc_service_->SetExecutor(executor); auto prefetch_prepared = executor->Prepare(*program, prefetch_block->ID()); rpc_service_->SetPrefetchBlkdId(prefetch_block->ID()); rpc_service_->SetPrefetchPreparedCtx(prefetch_prepared.get()); @@ -134,7 +140,7 @@ void ListenAndServOp::RunSyncUpdate( break; } - // NOTE: if is_gpu_place, CUDA kernels are launch by multiple threads + // NOTE: if is_gpu_place, CUDA kernels are launched by multiple threads // and this will still work. // The optimize blocks which have the same parent ID would run parallel @@ -173,13 +179,6 @@ void ListenAndServOp::RunSyncUpdate( } // while(true) } -static void SavePort(std::shared_ptr rpc_service) { - std::ofstream port_file; - port_file.open("/tmp/paddle.selected_port"); - port_file << rpc_service->GetSelectedPort(); - port_file.close(); -} - void ListenAndServOp::RunImpl(const framework::Scope &scope, const platform::Place &dev_place) const { platform::DeviceContextPool &pool = platform::DeviceContextPool::Instance(); -- GitLab