| 514 | } // namespace xla |
| 515 | |
| 516 | int main(int argc, char** argv) { |
| 517 | xla::tools::Options opts; |
| 518 | const std::vector<tensorflow::Flag> flag_list = { |
| 519 | tensorflow::Flag("use_fake_data", &opts.use_fake_data, |
| 520 | "Replay computation using fake data"), |
| 521 | tensorflow::Flag("print_result", &opts.print_result, |
| 522 | "Print the result of the computation to stdout"), |
| 523 | tensorflow::Flag("num_runs", &opts.num_runs, |
| 524 | "Number of times to run each computation"), |
| 525 | tensorflow::Flag("fake_infeed_shape", &opts.fake_infeed_shape, |
| 526 | "Shape of fake data to construct for (infinite) infeed"), |
| 527 | tensorflow::Flag("fake_outfeed_shape", &opts.fake_outfeed_shape, |
| 528 | "Shape of fake data to outfeed from computation"), |
| 529 | tensorflow::Flag("generate_fake_infeed", &opts.generate_fake_infeed, |
| 530 | "Whether a fake infeed shape should be derived " |
| 531 | "from the computation"), |
| 532 | tensorflow::Flag("generate_fake_outfeed", &opts.generate_fake_outfeed, |
| 533 | "Whether a fake outfeed shape should be derived " |
| 534 | "from the computation"), |
| 535 | tensorflow::Flag("intra_op_thread_pool_size", |
| 536 | &opts.intra_op_thread_pool_size, |
| 537 | "How many threads to use in the intra-op thread pool. " |
| 538 | "Defaults to the number of CPUs."), |
| 539 | tensorflow::Flag("compile_only", &opts.compile_only, |
| 540 | "Whether the input should only be compiled, as opposed " |
| 541 | "to compiled and executed."), |
| 542 | }; |
| 543 | xla::string usage = tensorflow::Flags::Usage(argv[0], flag_list); |
| 544 | bool parse_ok = tensorflow::Flags::Parse(&argc, argv, flag_list); |
| 545 | tensorflow::port::InitMain(argv[0], &argc, &argv); |
| 546 | if (argc < 2 || !parse_ok) { |
| 547 | LOG(QFATAL) << usage; |
| 548 | } |
| 549 | |
| 550 | absl::Span<char* const> args(argv, argc); |
| 551 | args.remove_prefix(1); // Pop off the binary name, argv[0] |
| 552 | return xla::tools::RealMain(args, opts); |
| 553 | } |