update benchmark help info

time_profile add fp16 option
pull/4977/head
zhaozhenlong 5 years ago
parent 026bbc46ff
commit 488c991eba

@ -160,7 +160,7 @@ std::string FlagParser::Usage(const Option<std::string> &usgMsg) const {
std::string flagName = flag->second.flagName; std::string flagName = flag->second.flagName;
std::string helpInfo = flag->second.helpInfo; std::string helpInfo = flag->second.helpInfo;
// parameter line // parameter line
std::string thisLine = flag->second.isBoolean ? " --[no-]" + flagName : " --" + flagName + "=VALUE"; std::string thisLine = flagName == "help" ? " --" + flagName : " --" + flagName + "=VALUE";
if (++i <= flags.size()) { if (++i <= flags.size()) {
// add parameter help message of each line // add parameter help message of each line
thisLine += " " + helpInfo; thisLine += " " + helpInfo;

@ -33,7 +33,7 @@ struct Nothing {};
class FlagParser { class FlagParser {
public: public:
FlagParser() { AddFlag(&FlagParser::help, "help", "print usage message", false); } FlagParser() { AddFlag(&FlagParser::help, "help", "print usage message", ""); }
virtual ~FlagParser() {} virtual ~FlagParser() {}
@ -298,4 +298,3 @@ void FlagParser::AddFlag(Option<T> Flags::*t, const std::string &flagName, const
} // namespace mindspore } // namespace mindspore
#endif // PREDICT_COMMON_FLAG_PARSER_H_ #endif // PREDICT_COMMON_FLAG_PARSER_H_

@ -109,7 +109,7 @@ int TimeProfile::InitSession() {
ctx->cpu_bind_mode_ = static_cast<CpuBindMode>(_flags->cpu_bind_mode_); ctx->cpu_bind_mode_ = static_cast<CpuBindMode>(_flags->cpu_bind_mode_);
ctx->device_ctx_.type = lite::DT_CPU; ctx->device_ctx_.type = lite::DT_CPU;
ctx->thread_num_ = _flags->num_threads_; ctx->thread_num_ = _flags->num_threads_;
ctx->float16_priority = _flags->fp16_priority;
session_ = session::LiteSession::CreateSession(ctx); session_ = session::LiteSession::CreateSession(ctx);
if (session_ == nullptr) { if (session_ == nullptr) {
MS_LOG(ERROR) << "New session failed while running."; MS_LOG(ERROR) << "New session failed while running.";
@ -175,6 +175,7 @@ int TimeProfile::Init() {
MS_LOG(INFO) << "InDataPath = " << _flags->in_data_path_; MS_LOG(INFO) << "InDataPath = " << _flags->in_data_path_;
MS_LOG(INFO) << "LoopCount = " << _flags->loop_count_; MS_LOG(INFO) << "LoopCount = " << _flags->loop_count_;
MS_LOG(INFO) << "NumThreads = " << _flags->num_threads_; MS_LOG(INFO) << "NumThreads = " << _flags->num_threads_;
MS_LOG(INFO) << "Fp16Priority = " << _flags->fp16_priority;
if (_flags->num_threads_ < 1) { if (_flags->num_threads_ < 1) {
MS_LOG(ERROR) << "NumThreads: " << _flags->num_threads_ << " must greater than or equal 1"; MS_LOG(ERROR) << "NumThreads: " << _flags->num_threads_ << " must greater than or equal 1";

@ -40,6 +40,7 @@ class MS_API TimeProfileFlags : public virtual FlagParser {
"Input -1 for MID_CPU, 1 for HIGHER_CPU, 0 for NO_BIND, defalut value: 1", 1); "Input -1 for MID_CPU, 1 for HIGHER_CPU, 0 for NO_BIND, defalut value: 1", 1);
AddFlag(&TimeProfileFlags::loop_count_, "loopCount", "Run loop count", 10); AddFlag(&TimeProfileFlags::loop_count_, "loopCount", "Run loop count", 10);
AddFlag(&TimeProfileFlags::num_threads_, "numThreads", "Run threads number", 2); AddFlag(&TimeProfileFlags::num_threads_, "numThreads", "Run threads number", 2);
AddFlag(&TimeProfileFlags::fp16_priority, "fp16Priority", "Run fp16 ops prior", false);
} }
~TimeProfileFlags() override = default; ~TimeProfileFlags() override = default;
@ -50,6 +51,7 @@ class MS_API TimeProfileFlags : public virtual FlagParser {
int cpu_bind_mode_ = 1; int cpu_bind_mode_ = 1;
int loop_count_; int loop_count_;
int num_threads_; int num_threads_;
bool fp16_priority;
}; };
class MS_API TimeProfile { class MS_API TimeProfile {

Loading…
Cancel
Save