diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index 124e0da571d657e02a0d81634dcc8c27d2728e4e..410a6db6b3570c984f8d136de1665c65e8beb305 100644 --- a/paddle/fluid/platform/profiler.cc +++ b/paddle/fluid/platform/profiler.cc @@ -472,7 +472,10 @@ void ParseEvents(const std::vector> &events, if (rit != pushed_events.rend()) { double event_time = 0; - double gpu_time = rit->CudaElapsedMs((*analyze_events)[i][j]); + double gpu_time = 0.0f; +#ifdef PADDLE_WITH_CUDA + gpu_time = rit->CudaElapsedMs((*analyze_events)[i][j]); +#endif double cpu_time = rit->CpuElapsedMs((*analyze_events)[i][j]); if (g_state == ProfilerState::kCUDA) { event_time = gpu_time;