提交 3f56474f 编写于 作者: J jiweibo

test=develop pre-commit command to run clang-format

上级 9d70dd4d
...@@ -39,7 +39,7 @@ class LightPredictorImpl : public PaddlePredictor { ...@@ -39,7 +39,7 @@ class LightPredictorImpl : public PaddlePredictor {
}; };
void LightPredictorImpl::Init(const MobileConfig& config) { void LightPredictorImpl::Init(const MobileConfig& config) {
// LightPredictor Only support NaiveBuffer backend in publish lib // LightPredictor Only support NaiveBuffer backend in publish lib
#ifdef LITE_WITH_ARM #ifdef LITE_WITH_ARM
lite::DeviceInfo::Init(); lite::DeviceInfo::Init();
lite::DeviceInfo::Global().SetRunMode(config.power_mode(), config.threads()); lite::DeviceInfo::Global().SetRunMode(config.power_mode(), config.threads());
......
...@@ -113,9 +113,14 @@ class LITE_API CxxConfig : public ConfigBase { ...@@ -113,9 +113,14 @@ class LITE_API CxxConfig : public ConfigBase {
class LITE_API MobileConfig : public ConfigBase { class LITE_API MobileConfig : public ConfigBase {
PowerMode mode_{LITE_POWER_HIGH}; PowerMode mode_{LITE_POWER_HIGH};
int threads_{1}; int threads_{1};
public:
MobileConfig(Place preferred_place=Place(TARGET(kARM), PRECISION(kFloat), DATALAYOUT(kNCHW)), public:
PowerMode mode=LITE_POWER_HIGH, int threads=1) : mode_(mode), threads_(threads) {} MobileConfig(Place preferred_place = Place(TARGET(kARM),
PRECISION(kFloat),
DATALAYOUT(kNCHW)),
PowerMode mode = LITE_POWER_HIGH,
int threads = 1)
: mode_(mode), threads_(threads) {}
void set_power_mode(PowerMode mode) { mode_ = mode; } void set_power_mode(PowerMode mode) { mode_ = mode; }
void set_threads(int threads) { threads_ = threads; } void set_threads(int threads) { threads_ = threads; }
......
...@@ -827,7 +827,7 @@ void DeviceInfo::RequestPowerHighMode(int thread_num) { ...@@ -827,7 +827,7 @@ void DeviceInfo::RequestPowerHighMode(int thread_num) {
int little_core_size = little_core_ids_.size(); int little_core_size = little_core_ids_.size();
active_ids_.clear(); active_ids_.clear();
if (big_core_size > 0) { if (big_core_size > 0) {
mode_ =lite_api::PowerMode::LITE_POWER_HIGH; mode_ = lite_api::PowerMode::LITE_POWER_HIGH;
if (thread_num > big_core_size) { if (thread_num > big_core_size) {
LOG(ERROR) << "Request thread num: " << thread_num LOG(ERROR) << "Request thread num: " << thread_num
<< ", exceed the big cores size: " << big_core_size << ", exceed the big cores size: " << big_core_size
...@@ -1031,7 +1031,8 @@ int DeviceInfo::Setup() { ...@@ -1031,7 +1031,8 @@ int DeviceInfo::Setup() {
} }
LOG(INFO) << "Total memory: " << mem_size_ << "KB"; LOG(INFO) << "Total memory: " << mem_size_ << "KB";
// set default run mode // set default run mode
SetRunMode(lite_api::PowerMode::LITE_POWER_NO_BIND, 1); // use single thread by default SetRunMode(lite_api::PowerMode::LITE_POWER_NO_BIND,
1); // use single thread by default
return 0; return 0;
} }
......
...@@ -180,7 +180,8 @@ class MatMulComputeTester : public arena::TestCase { ...@@ -180,7 +180,8 @@ class MatMulComputeTester : public arena::TestCase {
if (y_dims_.size() > 2) { if (y_dims_.size() > 2) {
int y_inner = y_dims_[y_dims_.size() - 2] * y_dims_[y_dims_.size() - 1]; int y_inner = y_dims_[y_dims_.size() - 2] * y_dims_[y_dims_.size() - 1];
int o_inner = dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1]; int o_inner =
dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1];
for (size_t i = 0; i < x_dims_.count(0, x_dims_.size() - 2); ++i) { for (size_t i = 0; i < x_dims_.count(0, x_dims_.size() - 2); ++i) {
mul_low_efficiency( mul_low_efficiency(
DDim({x_dims_[x_dims_.size() - 2], x_dims_[x_dims_.size() - 1]}), DDim({x_dims_[x_dims_.size() - 2], x_dims_[x_dims_.size() - 1]}),
...@@ -193,7 +194,8 @@ class MatMulComputeTester : public arena::TestCase { ...@@ -193,7 +194,8 @@ class MatMulComputeTester : public arena::TestCase {
out_data + i * o_inner); out_data + i * o_inner);
} }
} else { } else {
int o_inner = dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1]; int o_inner =
dim_out_vec[x_dims_.size() - 2] * dim_out_vec[x_dims_.size() - 1];
for (size_t i = 0; i < x_dims_.count(0, x_dims_.size() - 2); ++i) { for (size_t i = 0; i < x_dims_.count(0, x_dims_.size() - 2); ++i) {
mul_low_efficiency( mul_low_efficiency(
DDim({x_dims_[x_dims_.size() - 2], x_dims_[x_dims_.size() - 1]}), DDim({x_dims_[x_dims_.size() - 2], x_dims_[x_dims_.size() - 1]}),
......
...@@ -33,7 +33,8 @@ void Run(DebugConfig* conf) { ...@@ -33,7 +33,8 @@ void Run(DebugConfig* conf) {
CHECK(conf); CHECK(conf);
#ifdef LITE_WITH_ARM #ifdef LITE_WITH_ARM
DeviceInfo::Init(); DeviceInfo::Init();
DeviceInfo::Global().SetRunMode(lite_api::LITE_POWER_HIGH, conf->arm_thread_num); DeviceInfo::Global().SetRunMode(lite_api::LITE_POWER_HIGH,
conf->arm_thread_num);
#endif #endif
lite::Predictor predictor; lite::Predictor predictor;
std::vector<Place> valid_places({ std::vector<Place> valid_places({
......
...@@ -18,13 +18,13 @@ ...@@ -18,13 +18,13 @@
*/ */
#pragma once #pragma once
#include <assert.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <string> #include <string>
#include <assert.h>
#include "lite/utils/replace_stl/stream.h" #include "lite/utils/replace_stl/stream.h"
// NOLINTFILE() // NOLINTFILE()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册