未验证 提交 4d530acc 编写于 作者: J juncaipeng 提交者: GitHub

fix benchmark, test=develop (#2188)

* fix benchmark, test=develop
上级 435f942b
...@@ -246,14 +246,14 @@ endif() ...@@ -246,14 +246,14 @@ endif()
# Some bins # Some bins
if(NOT IOS) if(NOT IOS)
lite_cc_binary(test_model_bin SRCS model_test.cc DEPS paddle_api_full paddle_api_light gflags utils 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} ARM_DEPS ${arm_kernels}
NPU_DEPS ${npu_kernels} NPU_DEPS ${npu_kernels}
CL_DEPS ${opencl_kernels} CL_DEPS ${opencl_kernels}
FPGA_DEPS ${fpga_kernels} FPGA_DEPS ${fpga_kernels}
X86_DEPS ${x86_kernels}) X86_DEPS ${x86_kernels})
lite_cc_binary(benchmark_bin SRCS benchmark.cc DEPS paddle_api_full paddle_api_light gflags utils 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} ARM_DEPS ${arm_kernels}
NPU_DEPS ${npu_kernels} NPU_DEPS ${npu_kernels}
CL_DEPS ${opencl_kernels} CL_DEPS ${opencl_kernels}
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "lite/api/paddle_api.h" #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/api/test_helper.h"
#include "lite/core/device_info.h" #include "lite/core/device_info.h"
#include "lite/utils/cp_logging.h" #include "lite/utils/cp_logging.h"
...@@ -39,11 +42,14 @@ void OutputOptModel(const std::string& load_model_dir, ...@@ -39,11 +42,14 @@ void OutputOptModel(const std::string& load_model_dir,
const std::vector<std::vector<int64_t>>& input_shapes) { const std::vector<std::vector<int64_t>>& input_shapes) {
lite_api::CxxConfig config; lite_api::CxxConfig config;
config.set_model_dir(load_model_dir); config.set_model_dir(load_model_dir);
config.set_preferred_place(Place{TARGET(kX86), PRECISION(kFloat)});
config.set_valid_places({ config.set_valid_places({
Place{TARGET(kX86), PRECISION(kFloat)},
Place{TARGET(kARM), 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); auto predictor = lite_api::CreatePaddlePredictor(config);
int ret = system( int ret = system(
...@@ -67,11 +73,7 @@ void Run(const std::vector<std::vector<int64_t>>& input_shapes, ...@@ -67,11 +73,7 @@ void Run(const std::vector<std::vector<int64_t>>& input_shapes,
const std::string model_name) { const std::string model_name) {
lite_api::MobileConfig config; lite_api::MobileConfig config;
config.set_threads(thread_num); config.set_threads(thread_num);
if (thread_num == 1) {
config.set_power_mode(LITE_POWER_NO_BIND); config.set_power_mode(LITE_POWER_NO_BIND);
} else {
config.set_power_mode(LITE_POWER_NO_BIND);
}
config.set_model_dir(model_dir); config.set_model_dir(model_dir);
auto predictor = lite_api::CreatePaddlePredictor(config); auto predictor = lite_api::CreatePaddlePredictor(config);
......
...@@ -16,6 +16,9 @@ ...@@ -16,6 +16,9 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "lite/api/paddle_api.h" #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/api/test_helper.h"
#include "lite/core/device_info.h" #include "lite/core/device_info.h"
#include "lite/utils/cp_logging.h" #include "lite/utils/cp_logging.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册