Skip to content

Commit 7eca286

Browse files
authored
Merge pull request #11078 from panyx0718/improve_profiler
allow profiler and timeline to work when dev_ctx is nullptr.
2 parents 6915d51 + 75ea577 commit 7eca286

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

paddle/fluid/platform/profiler.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ double Event::CpuElapsedMs(const Event& e) const {
127127

128128
double Event::CudaElapsedMs(const Event& e) const {
129129
#ifdef PADDLE_WITH_CUDA
130+
if (!has_cuda_) return 0.0;
130131
PADDLE_ENFORCE(e.has_cuda() && has_cuda());
131132
PADDLE_ENFORCE(e.device() == device());
132133
PADDLE_ENFORCE(cudaEventSynchronize(event_));

0 commit comments

Comments
 (0)