From 11b8a58049bbd0f12278cf990b3958665a853d23 Mon Sep 17 00:00:00 2001 From: Megvii Engine Team Date: Wed, 4 Jan 2023 14:09:17 +0800 Subject: [PATCH] fix(opencl): misc fix * config android c++ standard to c++17 to fix build failed when called by add_custom_command * do not print lar summary log when iter 0 GitOrigin-RevId: 6f35b7b62f6f6874d44b5d7fb189c18b01ebce73 --- CMakeLists.txt | 3 ++- .../src/strategys/strategy_normal.cpp | 16 +++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b29b77a3..8d0c56d8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -668,7 +668,8 @@ if(NOT MGE_ENABLE_EXCEPTIONS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions") endif() -if(MGE_BUILD_IMPERATIVE_RT) +if(MGE_BUILD_IMPERATIVE_RT OR ANDROID) + message(STATUS "config cxx standard to 17.") set(CMAKE_CXX_STANDARD 17) endif() diff --git a/lite/load_and_run/src/strategys/strategy_normal.cpp b/lite/load_and_run/src/strategys/strategy_normal.cpp index c0e842ab4..168040b9e 100644 --- a/lite/load_and_run/src/strategys/strategy_normal.cpp +++ b/lite/load_and_run/src/strategys/strategy_normal.cpp @@ -93,13 +93,15 @@ void NormalStrategy::run_subline() { min_time = std::min(min_time, cur); max_time = std::max(max_time, cur); } - mgb_log("=== finished test #%u: time=%.3f ms avg_time=%.3f ms " - "standard_deviation=%.3f ms min=%.3f ms max=%.3f ms", - idx, time_sum, time_sum / run_num, - std::sqrt( - (time_sqrsum * run_num - time_sum * time_sum) / - (run_num * (run_num - 1))), - min_time, max_time); + if (run_num > 0) { + mgb_log("=== finished test #%u: time=%.3f ms avg_time=%.3f ms " + "standard_deviation=%.3f ms min=%.3f ms max=%.3f ms", + idx, time_sum, time_sum / run_num, + std::sqrt( + (time_sqrsum * run_num - time_sum * time_sum) / + (run_num * (run_num - 1))), + min_time, max_time); + } return time_sum; }; -- GitLab