From 55e2cc3d878237b026b301a0e46c816d43703bbb Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Tue, 27 Mar 2018 13:49:45 +0800 Subject: [PATCH] FetchOp Force sync --- paddle/fluid/framework/details/fetch_op_handle.cc | 4 +++- paddle/fluid/framework/details/threaded_ssa_graph_executor.cc | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/paddle/fluid/framework/details/fetch_op_handle.cc b/paddle/fluid/framework/details/fetch_op_handle.cc index c697a1c9378..03323e3da7b 100644 --- a/paddle/fluid/framework/details/fetch_op_handle.cc +++ b/paddle/fluid/framework/details/fetch_op_handle.cc @@ -47,9 +47,11 @@ void FetchOpHandle::WaitAndMergeCPUTensors() const { } void FetchOpHandle::RunImpl() { + auto cpu_ctx = + platform::DeviceContextPool::Instance().Get(platform::CPUPlace()); for (auto *input : inputs_) { auto *var = static_cast(input); - var->generated_op_->Wait(this->dev_ctx_[var->place_]); + var->generated_op_->Wait(cpu_ctx); } tensors_.resize(inputs_.size()); diff --git a/paddle/fluid/framework/details/threaded_ssa_graph_executor.cc b/paddle/fluid/framework/details/threaded_ssa_graph_executor.cc index 501e1dfad76..7d1f7e46b84 100644 --- a/paddle/fluid/framework/details/threaded_ssa_graph_executor.cc +++ b/paddle/fluid/framework/details/threaded_ssa_graph_executor.cc @@ -209,10 +209,6 @@ void ThreadedSSAGraphExecutor::RunOp( VLOG(10) << op->DebugString(); op->Run(use_event_); - for (auto &dev_ctx : op->dev_ctx_) { - dev_ctx.second->Wait(); // Sync error - } - for (auto *ready : *ready_buffer) { ready->store(true, std::memory_order_release); } -- GitLab