def summarize_qor(configs): """ Summarize the Qor results """ first = True task_path = Path(configs[0].config_dir).parent if len(configs) > 1 or (task_path.parent / "task_list.txt").is_file(): task_path = task_path.parent task_path = task_path / "task_summary" task_path.mkdir(exist_ok=True) out_file = task_path / (str(Path(find_latest_run_dir(configs[0])).stem) + "_summary.txt") with out_file.open("w+") as out: for config in configs: with (Path(find_latest_run_dir(config)) / QOR_PARSE_FILE).open("r") as in_file: headers = in_file.readline() if first: print("task_name \t{}".format(headers), file=out, end="") first = False for line in in_file: print("{}\t{}".format(config.task_name, line), file=out, end="") pretty_print_table( str(Path(find_latest_run_dir(config)) / QOR_PARSE_FILE))
def parse_files(config_jobs, run_dir, flow_metrics_basename=FIRST_PARSE_FILE): """ Parse the result files from the give jobs """ task_parse_results_filepath = str(PurePath(run_dir) / flow_metrics_basename) with open(task_parse_results_filepath, "w") as out_f: # Start the header header = True for job in config_jobs: # Open the job results file # # The job results file is basically the same format, # but excludes the architecture and circuit fields, # which we prefix to each line of the task result file job_parse_results_filepath = Path(job.work_dir(run_dir)) / flow_metrics_basename if job_parse_results_filepath.exists(): with open(job_parse_results_filepath) as in_f: lines = in_f.readlines() assert len(lines) == 2 if header: # First line is the header print(lines[0], file=out_f, end="") header = False # Second line is the data print(lines[1], file=out_f, end="") pretty_print_table(job_parse_results_filepath) else: print( "Warning: Flow result file not found (task QoR will be incomplete): {} ".format( str(job_parse_results_filepath) ) )
def check_golden_results_for_task(config): """ Copies the latest task run's parse_results.txt into the config directory as golden_results.txt """ num_qor_failures = 0 run_dir = find_latest_run_dir(config) if not config.pass_requirements_file: print( "Warning: no pass requirements file for task {}, QoR will not be checked" .format(config.task_name)) else: # Load the pass requirements file # Load the task's parse results task_results_filepath = str( PurePath(run_dir).joinpath(FIRST_PARSE_FILE)) # Load the golden reference if config.second_parse_file: second_results_filepath = str( PurePath(run_dir).joinpath(SECOND_PARSE_FILE)) num_qor_failures = check_two_files( config, task_results_filepath, second_results_filepath, second_name="second parse file", ) pretty_print_table(second_results_filepath) else: golden_results_filepath = str( PurePath(config.config_dir).joinpath("golden_results.txt")) num_qor_failures = check_two_files( config, task_results_filepath, golden_results_filepath, ) pretty_print_table(task_results_filepath) if num_qor_failures == 0: print("{}...[Pass]".format("/".join( str((Path(config.config_dir).parent)).split("/")[-3:]))) return num_qor_failures