Merge pull request #11078 from panyx0718/improve_profiler

allow profiler and timeline to work when dev_ctx is nullptr.
wangkuiyi-patch-1
Xin Pan 7 years ago committed by GitHub
commit 7eca286159
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -127,6 +127,7 @@ double Event::CpuElapsedMs(const Event& e) const {
double Event::CudaElapsedMs(const Event& e) const {
#ifdef PADDLE_WITH_CUDA
if (!has_cuda_) return 0.0;
PADDLE_ENFORCE(e.has_cuda() && has_cuda());
PADDLE_ENFORCE(e.device() == device());
PADDLE_ENFORCE(cudaEventSynchronize(event_));

Loading…
Cancel
Save