Wait fetch op

helinwang-patch-1
Yu Yang 7 years ago
parent b6ca3711b4
commit 76570c2e96

@ -66,6 +66,7 @@ void FetchOpHandle::RunImpl() {
if (platform::is_gpu_place(var->place_)) {
#ifdef PADDLE_WITH_CUDA
TensorCopy(t, cpu, *dev_ctx_[t.place()], &tensors_[i]);
dev_ctx_[t.place()]->Wait();
#endif
} else {
tensors_[i].ShareDataWith(t);

@ -33,9 +33,6 @@ std::string OpHandleBase::DebugString() const {
OpHandleBase::~OpHandleBase() {
#ifdef PADDLE_WITH_CUDA
for (auto &ctx : dev_ctx_) {
ctx.second->Wait();
}
for (auto &ev : events_) {
PADDLE_ENFORCE(cudaEventDestroy(ev.second));
}

Loading…
Cancel
Save