Log output for incorrect set of flags updated.
PiperOrigin-RevId: 257170572
This commit is contained in:
parent
5bb817c1e4
commit
dffe85688b
@ -52,7 +52,7 @@ namespace xla {
|
|||||||
namespace tools {
|
namespace tools {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
bool ReadLine(const char *prompt, string *line) {
|
bool ReadLine(const char* prompt, string* line) {
|
||||||
#if defined(PLATFORM_GOOGLE)
|
#if defined(PLATFORM_GOOGLE)
|
||||||
return util::ReadLine(prompt, line);
|
return util::ReadLine(prompt, line);
|
||||||
#else
|
#else
|
||||||
@ -628,28 +628,22 @@ void InteractiveDumpGraphs(const Options& opts, const HloModule& module) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckFlags(const Options &opts) {
|
void CheckFlags(const Options& opts) {
|
||||||
std::vector<string> nonempty_proto_flags;
|
int nonempty_flags_amount = 0;
|
||||||
if (!opts.hlo_proto.empty()) {
|
if (!opts.hlo_proto.empty()) {
|
||||||
nonempty_proto_flags.push_back("--hlo_proto");
|
++nonempty_flags_amount;
|
||||||
}
|
}
|
||||||
if (!opts.hlo_snapshot.empty()) {
|
if (!opts.hlo_snapshot.empty()) {
|
||||||
nonempty_proto_flags.push_back("--hlo_snapshot");
|
++nonempty_flags_amount;
|
||||||
}
|
}
|
||||||
if (!opts.hlo_text.empty()) {
|
if (!opts.hlo_text.empty()) {
|
||||||
nonempty_proto_flags.push_back("--hlo_text");
|
++nonempty_flags_amount;
|
||||||
}
|
}
|
||||||
switch (nonempty_proto_flags.size()) {
|
if (nonempty_flags_amount == 1) {
|
||||||
case 1:
|
return;
|
||||||
// We're good to go.
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
LOG(FATAL) << "Need one of the following options: "
|
|
||||||
<< absl::StrJoin(nonempty_proto_flags, ", ");
|
|
||||||
default:
|
|
||||||
LOG(FATAL) << "Can only specify one of "
|
|
||||||
<< absl::StrJoin(nonempty_proto_flags, ", ");
|
|
||||||
}
|
}
|
||||||
|
LOG(FATAL) << "Can only specify one and only one of '--hlo_proto', "
|
||||||
|
"'--hlo_snapshot', '--hlo_text' flags.";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RealMain(const Options& opts) {
|
void RealMain(const Options& opts) {
|
||||||
@ -726,8 +720,7 @@ int main(int argc, char** argv) {
|
|||||||
"Platform to compile for: CPU, CUDA, etc"),
|
"Platform to compile for: CPU, CUDA, etc"),
|
||||||
tensorflow::Flag("browser", &opts.browser,
|
tensorflow::Flag("browser", &opts.browser,
|
||||||
"Path to web browser used to display produced graphs."),
|
"Path to web browser used to display produced graphs."),
|
||||||
tensorflow::Flag("help", &need_help,
|
tensorflow::Flag("help", &need_help, "Prints this help message"),
|
||||||
"Prints this help message"),
|
|
||||||
};
|
};
|
||||||
xla::string usage = tensorflow::Flags::Usage(argv[0], flag_list);
|
xla::string usage = tensorflow::Flags::Usage(argv[0], flag_list);
|
||||||
bool parse_ok = tensorflow::Flags::Parse(&argc, argv, flag_list);
|
bool parse_ok = tensorflow::Flags::Parse(&argc, argv, flag_list);
|
||||||
|
Loading…
Reference in New Issue
Block a user