!4977 correct benchmark help info

Merge pull request !4977 from zhaozhenlong/lite/tool/benchmark_modify_help_info
This commit is contained in:
mindspore-ci-bot 2020-08-22 15:50:30 +08:00 committed by Gitee
commit 31a04ea1fe
4 changed files with 6 additions and 4 deletions

View File

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

View File

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

View File

@ -109,7 +109,7 @@ int TimeProfile::InitSession() {
ctx->cpu_bind_mode_ = static_cast<CpuBindMode>(_flags->cpu_bind_mode_);
ctx->device_ctx_.type = lite::DT_CPU;
ctx->thread_num_ = _flags->num_threads_;
ctx->float16_priority = _flags->fp16_priority;
session_ = session::LiteSession::CreateSession(ctx);
if (session_ == nullptr) {
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) << "LoopCount = " << _flags->loop_count_;
MS_LOG(INFO) << "NumThreads = " << _flags->num_threads_;
MS_LOG(INFO) << "Fp16Priority = " << _flags->fp16_priority;
if (_flags->num_threads_ < 1) {
MS_LOG(ERROR) << "NumThreads: " << _flags->num_threads_ << " must greater than or equal 1";

View File

@ -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);
AddFlag(&TimeProfileFlags::loop_count_, "loopCount", "Run loop count", 10);
AddFlag(&TimeProfileFlags::num_threads_, "numThreads", "Run threads number", 2);
AddFlag(&TimeProfileFlags::fp16_priority, "fp16Priority", "Run fp16 ops prior", false);
}
~TimeProfileFlags() override = default;
@ -50,6 +51,7 @@ class MS_API TimeProfileFlags : public virtual FlagParser {
int cpu_bind_mode_ = 1;
int loop_count_;
int num_threads_;
bool fp16_priority;
};
class MS_API TimeProfile {