From 4d530acc29a7345a5310c4236c379c35eabcbb51 Mon Sep 17 00:00:00 2001 From: juncaipeng <52520497+juncaipeng@users.noreply.github.com> Date: Tue, 15 Oct 2019 16:03:17 +0800 Subject: [PATCH] fix benchmark, test=develop (#2188) * fix benchmark, test=develop --- lite/api/CMakeLists.txt | 4 ++-- lite/api/benchmark.cc | 16 +++++++++------- lite/api/model_test.cc | 3 +++ 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lite/api/CMakeLists.txt b/lite/api/CMakeLists.txt index 39b3cc2485..438d0f9c97 100644 --- a/lite/api/CMakeLists.txt +++ b/lite/api/CMakeLists.txt @@ -246,14 +246,14 @@ endif() # Some bins if(NOT IOS) lite_cc_binary(test_model_bin SRCS model_test.cc DEPS paddle_api_full paddle_api_light gflags utils - ${ops} + ${ops} ${host_kernels} ARM_DEPS ${arm_kernels} NPU_DEPS ${npu_kernels} CL_DEPS ${opencl_kernels} FPGA_DEPS ${fpga_kernels} X86_DEPS ${x86_kernels}) lite_cc_binary(benchmark_bin SRCS benchmark.cc DEPS paddle_api_full paddle_api_light gflags utils - ${ops} + ${ops} ${host_kernels} ARM_DEPS ${arm_kernels} NPU_DEPS ${npu_kernels} CL_DEPS ${opencl_kernels} diff --git a/lite/api/benchmark.cc b/lite/api/benchmark.cc index 3fabd33dc0..02313554d9 100644 --- a/lite/api/benchmark.cc +++ b/lite/api/benchmark.cc @@ -18,6 +18,9 @@ #include #include #include "lite/api/paddle_api.h" +#include "lite/api/paddle_use_kernels.h" +#include "lite/api/paddle_use_ops.h" +#include "lite/api/paddle_use_passes.h" #include "lite/api/test_helper.h" #include "lite/core/device_info.h" #include "lite/utils/cp_logging.h" @@ -39,11 +42,14 @@ void OutputOptModel(const std::string& load_model_dir, const std::vector>& input_shapes) { lite_api::CxxConfig config; config.set_model_dir(load_model_dir); - config.set_preferred_place(Place{TARGET(kX86), PRECISION(kFloat)}); config.set_valid_places({ - Place{TARGET(kX86), PRECISION(kFloat)}, Place{TARGET(kARM), PRECISION(kFloat)}, + Place{TARGET(kARM), PRECISION(kInt8)}, + Place{TARGET(kX86), PRECISION(kFloat)}, + Place{TARGET(kOpenCL), PRECISION(kFloat)}, + Place{TARGET(kHost), PRECISION(kFloat)}, }); + config.set_preferred_place(Place{TARGET(kARM), PRECISION(kFloat)}); auto predictor = lite_api::CreatePaddlePredictor(config); int ret = system( @@ -67,11 +73,7 @@ void Run(const std::vector>& input_shapes, const std::string model_name) { lite_api::MobileConfig config; config.set_threads(thread_num); - if (thread_num == 1) { - config.set_power_mode(LITE_POWER_NO_BIND); - } else { - config.set_power_mode(LITE_POWER_NO_BIND); - } + config.set_power_mode(LITE_POWER_NO_BIND); config.set_model_dir(model_dir); auto predictor = lite_api::CreatePaddlePredictor(config); diff --git a/lite/api/model_test.cc b/lite/api/model_test.cc index 4db08f7004..114d1acdbe 100644 --- a/lite/api/model_test.cc +++ b/lite/api/model_test.cc @@ -16,6 +16,9 @@ #include #include #include "lite/api/paddle_api.h" +#include "lite/api/paddle_use_kernels.h" +#include "lite/api/paddle_use_ops.h" +#include "lite/api/paddle_use_passes.h" #include "lite/api/test_helper.h" #include "lite/core/device_info.h" #include "lite/utils/cp_logging.h" -- GitLab