allow profiler and timeline to work when dev_ctx is nullptr.

Sometimes dev_ctx is not available when RecordEvent.
wangkuiyi-patch-1
Xin Pan 7 years ago
parent 82e5738f53
commit 75ea577fd3

@ -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