diff --git a/scoreboard/main.py b/scoreboard/main.py index a1fa5817..f38f65e4 100644 --- a/scoreboard/main.py +++ b/scoreboard/main.py @@ -2,6 +2,7 @@ from collections import defaultdict import argparse import yaml +import csv task_types = ['all', 'mpi', 'omp', 'seq', 'stl', 'tbb'] @@ -67,6 +68,27 @@ """ + +perf_stat_file_path = Path(__file__).parent.parent / "build" / "perf_stat_dir" / "task_run_perf_table.csv" + +# Read and parse performance statistics CSV +perf_stats = dict() +if perf_stat_file_path.exists(): + with open(perf_stat_file_path, 'r', newline='') as csvfile: + reader = csv.DictReader(csvfile) + for row in reader: + perf_stats[row[0]] = { + "seq": row[1], + "omp": row[2], + "tbb": row[3], + "stl": row[4], + "all": row[5], + "mpi": "N/A", + } +else: + print(f"Warning: Performance stats CSV not found at {perf_stat_file_path}") + + for dir in sorted(directories.keys()): html_content += f"{dir}" total_count = 0 @@ -81,7 +103,12 @@ task_count += max_sol_points else: html_content += '0' - html_content += '0' + html_content += '' + if row[0] in perf_stats.keys(): + html_content += perf_stats[row[0]][task_type] + else: + html_content += '?' + html_content += '' html_content += '0' html_content += '0' is_cheated = \ diff --git a/scripts/create_perf_table.py b/scripts/create_perf_table.py index 3a3cb701..e588af85 100644 --- a/scripts/create_perf_table.py +++ b/scripts/create_perf_table.py @@ -2,6 +2,7 @@ import os import re import xlsxwriter +import csv parser = argparse.ArgumentParser() parser.add_argument('-i', '--input', help='Input file path (logs of perf tests, .txt)', required=True) @@ -102,3 +103,20 @@ it_i = 1 it_j += 1 workbook.close() + # Dump CSV for performance times + csv_file = os.path.join(xlsx_path, table_name + '_perf_table.csv') + with open(csv_file, 'w', newline='') as csvfile: + writer = csv.writer(csvfile) + # Write header: Task, SEQ, OMP, TBB, STL, ALL + writer.writerow(['Task', 'SEQ', 'OMP', 'TBB', 'STL', 'ALL']) + for task_name in sorted(result_tables[table_name].keys()): + seq_time = result_tables[table_name][task_name]['seq'] + row = [ + task_name, + 1.0 if seq_time != 0 else '?', + (result_tables[table_name][task_name]['omp'] / seq_time) if seq_time != 0 else '?', + (result_tables[table_name][task_name]['tbb'] / seq_time) if seq_time != 0 else '?', + (result_tables[table_name][task_name]['stl'] / seq_time) if seq_time != 0 else '?', + (result_tables[table_name][task_name]['all'] / seq_time) if seq_time != 0 else '?', + ] + writer.writerow(row)