From 932aca162d88f5f3c7885967c337f716bb5b7cdd Mon Sep 17 00:00:00 2001 From: wangchaochaohu Date: Thu, 5 Dec 2019 00:24:11 -0600 Subject: [PATCH] Add Branch to avoid CPU profiler warning print (#21556) * fix profiler warning message in cpu profile mode test=develop --- paddle/fluid/platform/profiler.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paddle/fluid/platform/profiler.cc b/paddle/fluid/platform/profiler.cc index 124e0da571..410a6db6b3 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; -- GitLab