(args)
| 591 | |
| 592 | |
| 593 | def main(args): |
| 594 | logging.info( |
| 595 | "Searching best gemm configurations from {}".format( |
| 596 | args.benchmark_results_dir) |
| 597 | ) |
| 598 | |
| 599 | benchmark_results = extract_benchmark_results( |
| 600 | parse_json(args.benchmark_results_dir) |
| 601 | ) |
| 602 | |
| 603 | # Add all benchmark results to the recorder |
| 604 | benchmark_result_recorder = GEMMBenchmarkResultRecorder(tol=args.tolerance) |
| 605 | for benchmark_result in benchmark_results: |
| 606 | benchmark_result_recorder.add(benchmark_result) |
| 607 | |
| 608 | if args.debug: |
| 609 | recorder_sum_level = GEMMBenchmarkResultRecorder.SummaryLevel.Detailed |
| 610 | else: |
| 611 | recorder_sum_level = GEMMBenchmarkResultRecorder.SummaryLevel.Short |
| 612 | |
| 613 | # Print overall summary of the recorded results |
| 614 | logging.info(benchmark_result_recorder.summary( |
| 615 | sum_level=recorder_sum_level)) |
| 616 | |
| 617 | # Get GEMM configuration distributions for each strategy |
| 618 | all_config_dists = benchmark_result_recorder.get_config_distributions() |
| 619 | |
| 620 | logging.info("=== Result ===") |
| 621 | for strategy, config_dist in all_config_dists.items(): |
| 622 | logging.info("Strategy: {}".format(strategy.name)) |
| 623 | logging.debug("GEMM Config, Votes") |
| 624 | for config, freq in config_dist.frequency(): |
| 625 | logging.debug("{}, {}".format(config, freq)) |
| 626 | logging.info( |
| 627 | "Best GEMM Config: {} with std: {}".format( |
| 628 | config_dist.best_config(), config_dist.std() |
| 629 | ) |
| 630 | ) |
| 631 | |
| 632 | # Save the recorded results to JSON files in output directory |
| 633 | if args.output_dir is not None: |
| 634 | benchmark_result_recorder.save_to_jsons( |
| 635 | args.output_dir, only_best_config=(not args.debug) |
| 636 | ) |
| 637 | |
| 638 | |
| 639 | if __name__ == "__main__": |
no test coverage detected