Skip to content

Commit fd454f0

Browse files
authored
[scoreboard] Fix for '?' in A and E columns (#542)
1 parent af5df88 commit fd454f0

File tree

4 files changed

+81
-18
lines changed

4 files changed

+81
-18
lines changed

.github/workflows/pages.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ jobs:
7676
- name: Install dependencies
7777
run: |
7878
python3 -m pip install -r requirements.txt
79+
- name: Download performance data
80+
uses: actions/download-artifact@v4
81+
with:
82+
name: perf-stat
83+
- name: Extract performance data
84+
run: |
85+
mkdir -p build/perf_stat_dir
86+
unzip -o perf-stat.zip -d .
7987
- name: CMake configure
8088
run: |
8189
cmake -S . -B build -DUSE_SCOREBOARD=ON

scoreboard/main.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313

1414
task_types = ["all", "mpi", "omp", "seq", "stl", "tbb"]
1515

16-
tasks_dir = Path("tasks")
16+
script_dir = Path(__file__).parent
17+
tasks_dir = script_dir.parent / "tasks"
1718

1819
directories = defaultdict(dict)
1920

@@ -46,7 +47,7 @@
4647

4748

4849
perf_stat_file_path = (
49-
Path(__file__).parent.parent / "build" / "perf_stat_dir" / "task_run_perf_table.csv"
50+
script_dir.parent / "build" / "perf_stat_dir" / "task_run_perf_table.csv"
5051
)
5152

5253
# Read and parse performance statistics CSV
@@ -93,13 +94,15 @@
9394

9495
perf_val = perf_stats.get(dir, {}).get(task_type, "?")
9596

96-
# Calculate efficiency if performance data is available
97+
# Calculate acceleration and efficiency if performance data is available
98+
acceleration = "?"
9799
efficiency = "?"
98100
try:
99101
perf_float = float(perf_val)
100102
if perf_float > 0:
101103
speedup = 1.0 / perf_float
102-
efficiency = f"{speedup / eff_num_proc * 100:.2f}"
104+
acceleration = f"{speedup:.2f}"
105+
efficiency = f"{speedup / eff_num_proc * 100:.2f}%"
103106
except (ValueError, TypeError):
104107
pass
105108

@@ -114,7 +117,11 @@
114117
"log",
115118
"-1",
116119
"--format=%ct",
117-
str(tasks_dir / (dir + ("_disabled" if status == "disabled" else "")) / task_type),
120+
str(
121+
tasks_dir
122+
/ (dir + ("_disabled" if status == "disabled" else ""))
123+
/ task_type
124+
),
118125
]
119126
result = subprocess.run(git_cmd, capture_output=True, text=True)
120127
if result.stdout.strip().isdigit():
@@ -130,6 +137,7 @@
130137
"solution_points": sol_points,
131138
"solution_style": solution_style,
132139
"perf": perf_val,
140+
"acceleration": acceleration,
133141
"efficiency": efficiency,
134142
"deadline_points": deadline_points,
135143
"plagiarised": is_cheated,

scoreboard/templates/index.html.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
<td>{{ row.task }}</td>
3737
{% for cell in row.types %}
3838
<td style="text-align: center{% if cell.solution_style %};{{ cell.solution_style }}{% endif %}">{{ cell.solution_points }}</td>
39-
<td style="text-align: center;background-color: lavender;">{{ cell.perf }}</td>
39+
<td style="text-align: center;background-color: lavender;">{{ cell.acceleration }}</td>
4040
<td style="text-align: center;background-color: lavender;">{{ cell.efficiency }}</td>
4141
<td style="text-align: center;">{{ cell.deadline_points }}</td>
4242
<td style="text-align: center{% if cell.plagiarised %}; background-color: pink{% endif %}">{{ cell.plagiarism_points }}</td>

scripts/create_perf_table.py

Lines changed: 59 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,76 @@
2323
logs_file = open(logs_path, "r")
2424
logs_lines = logs_file.readlines()
2525
for line in logs_lines:
26-
pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)"
27-
result = re.findall(pattern, line)
28-
if len(result):
29-
task_name = result[0][1]
30-
perf_type = result[0][2]
26+
# Handle both old format: tasks/task_type/task_name:perf_type:time
27+
# and new format: namespace_task_type_enabled:perf_type:time
28+
old_pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)"
29+
new_pattern = (
30+
r"(\w+_test_task_(threads|processes))_(\w+)_enabled:(\w*):(-*\d*\.\d*)"
31+
)
32+
33+
old_result = re.findall(old_pattern, line)
34+
new_result = re.findall(new_pattern, line)
35+
36+
if len(old_result):
37+
task_name = old_result[0][1]
38+
perf_type = old_result[0][2]
3139
set_of_task_name.append(task_name)
3240
result_tables[perf_type][task_name] = {}
3341

3442
for ttype in list_of_type_of_tasks:
3543
result_tables[perf_type][task_name][ttype] = -1.0
44+
elif len(new_result):
45+
# Extract task name from namespace (e.g., "example_threads" from "nesterov_a_test_task_threads")
46+
full_task_name = new_result[0][0]
47+
task_category = new_result[0][1] # "threads" or "processes"
48+
task_name = f"example_{task_category}"
49+
perf_type = new_result[0][3]
50+
51+
if task_name not in set_of_task_name:
52+
set_of_task_name.append(task_name)
53+
54+
if perf_type not in result_tables:
55+
result_tables[perf_type] = {}
56+
if task_name not in result_tables[perf_type]:
57+
result_tables[perf_type][task_name] = {}
58+
for ttype in list_of_type_of_tasks:
59+
result_tables[perf_type][task_name][ttype] = -1.0
3660

3761
for line in logs_lines:
38-
pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)"
39-
result = re.findall(pattern, line)
40-
if len(result):
41-
task_type = result[0][0]
42-
task_name = result[0][1]
43-
perf_type = result[0][2]
44-
perf_time = float(result[0][3])
62+
# Handle both old format: tasks/task_type/task_name:perf_type:time
63+
# and new format: namespace_task_type_enabled:perf_type:time
64+
old_pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)"
65+
new_pattern = (
66+
r"(\w+_test_task_(threads|processes))_(\w+)_enabled:(\w*):(-*\d*\.\d*)"
67+
)
68+
69+
old_result = re.findall(old_pattern, line)
70+
new_result = re.findall(new_pattern, line)
71+
72+
if len(old_result):
73+
task_type = old_result[0][0]
74+
task_name = old_result[0][1]
75+
perf_type = old_result[0][2]
76+
perf_time = float(old_result[0][3])
4577
if perf_time < 0.1:
4678
msg = f"Performance time = {perf_time} < 0.1 second : for {task_type} - {task_name} - {perf_type} \n"
4779
raise Exception(msg)
4880
result_tables[perf_type][task_name][task_type] = perf_time
81+
elif len(new_result):
82+
# Extract task details from namespace format
83+
full_task_name = new_result[0][0]
84+
task_category = new_result[0][1] # "threads" or "processes"
85+
task_type = new_result[0][2] # "all", "omp", "seq", etc.
86+
perf_type = new_result[0][3]
87+
perf_time = float(new_result[0][4])
88+
task_name = f"example_{task_category}"
89+
90+
if perf_time < 0.1:
91+
msg = f"Performance time = {perf_time} < 0.1 second : for {task_type} - {task_name} - {perf_type} \n"
92+
raise Exception(msg)
93+
94+
if task_name in result_tables[perf_type]:
95+
result_tables[perf_type][task_name][task_type] = perf_time
4996

5097

5198
for table_name in result_tables:

0 commit comments

Comments
 (0)