提交 76570c2e 编写于 作者: Y Yu Yang

Wait fetch op

上级 b6ca3711
...@@ -66,6 +66,7 @@ void FetchOpHandle::RunImpl() { ...@@ -66,6 +66,7 @@ void FetchOpHandle::RunImpl() {
if (platform::is_gpu_place(var->place_)) { if (platform::is_gpu_place(var->place_)) {
#ifdef PADDLE_WITH_CUDA #ifdef PADDLE_WITH_CUDA
TensorCopy(t, cpu, *dev_ctx_[t.place()], &tensors_[i]); TensorCopy(t, cpu, *dev_ctx_[t.place()], &tensors_[i]);
dev_ctx_[t.place()]->Wait();
#endif #endif
} else { } else {
tensors_[i].ShareDataWith(t); tensors_[i].ShareDataWith(t);
......
...@@ -33,9 +33,6 @@ std::string OpHandleBase::DebugString() const { ...@@ -33,9 +33,6 @@ std::string OpHandleBase::DebugString() const {
OpHandleBase::~OpHandleBase() { OpHandleBase::~OpHandleBase() {
#ifdef PADDLE_WITH_CUDA #ifdef PADDLE_WITH_CUDA
for (auto &ctx : dev_ctx_) {
ctx.second->Wait();
}
for (auto &ev : events_) { for (auto &ev : events_) {
PADDLE_ENFORCE(cudaEventDestroy(ev.second)); PADDLE_ENFORCE(cudaEventDestroy(ev.second));
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册