Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions scoreboard/data/threads-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,12 @@ scoreboard:
visible: true
plagiarism:
coefficient: 0.5
efficiency:
num_proc: 4
deadlines:
mpi: "2025-12-31"
omp: "2025-12-31"
seq: "2025-12-31"
stl: "2025-12-31"
tbb: "2025-12-31"
all: "2025-12-31"
38 changes: 38 additions & 0 deletions scoreboard/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from pathlib import Path
from collections import defaultdict
from datetime import datetime
import argparse
import subprocess
import yaml
import csv
from jinja2 import Environment, FileSystemLoader
Expand Down Expand Up @@ -29,6 +31,8 @@
with open(config_path, 'r') as file:
cfg = yaml.safe_load(file)
assert cfg, "Configuration is empty"
eff_num_proc = int(cfg["scoreboard"].get("efficiency", {}).get("num_proc", 1))
deadlines_cfg = cfg["scoreboard"].get("deadlines", {})
plagiarism_config_path = Path(__file__).parent / "data" / "plagiarism.yml"
with open(plagiarism_config_path, 'r') as file:
plagiarism_cfg = yaml.safe_load(file)
Expand Down Expand Up @@ -83,11 +87,45 @@

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

# Calculate efficiency if performance data is available
efficiency = "?"
try:
perf_float = float(perf_val)
if perf_float > 0:
speedup = 1.0 / perf_float
efficiency = f"{speedup / eff_num_proc * 100:.2f}"
except (ValueError, TypeError):
pass

# Calculate deadline penalty points
deadline_points = 0
deadline_str = deadlines_cfg.get(task_type)
if status == "done" and deadline_str:
try:
deadline_dt = datetime.fromisoformat(deadline_str)
git_cmd = [
"git",
"log",
"-1",
"--format=%ct",
str(tasks_dir / (dir + ("_disabled" if status == "disabled" else "")) / task_type),
]
result = subprocess.run(git_cmd, capture_output=True, text=True)
if result.stdout.strip().isdigit():
commit_dt = datetime.fromtimestamp(int(result.stdout.strip()))
days_late = (commit_dt - deadline_dt).days
if days_late > 0:
deadline_points = -days_late
except Exception:
pass

row_types.append(
{
"solution_points": sol_points,
"solution_style": solution_style,
"perf": perf_val,
"efficiency": efficiency,
"deadline_points": deadline_points,
"plagiarised": is_cheated,
"plagiarism_points": plagiarism_points,
}
Expand Down
4 changes: 2 additions & 2 deletions scoreboard/templates/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
{% for cell in row.types %}
<td style="text-align: center{% if cell.solution_style %};{{ cell.solution_style }}{% endif %}">{{ cell.solution_points }}</td>
<td style="text-align: center;background-color: lavender;">{{ cell.perf }}</td>
<td style="text-align: center;background-color: lavender;">0</td>
<td style="text-align: center;">0</td>
<td style="text-align: center;background-color: lavender;">{{ cell.efficiency }}</td>
<td style="text-align: center;">{{ cell.deadline_points }}</td>
<td style="text-align: center{% if cell.plagiarised %}; background-color: pink{% endif %}">{{ cell.plagiarism_points }}</td>
{% endfor %}
<td style="text-align: center;">{{ row.total }}</td>
Expand Down
Loading