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
18 changes: 9 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,32 @@

import os

project = 'Parallel Programming Course'
copyright = '2025, Learning Process'
author = 'Learning Process'
project = "Parallel Programming Course"
copyright = "2025, Learning Process"
author = "Learning Process"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'breathe',
"breathe",
]

breathe_projects = {
"ParallelProgrammingCourse": os.path.join(os.path.dirname(__file__), "..", "xml"),
}
breathe_default_project = "ParallelProgrammingCourse"

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
locale_dirs = ['locale']
templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
locale_dirs = ["locale"]
gettext_compact = False

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_theme = "sphinx_rtd_theme"
html_static_path = ["_static"]

html_sidebars = {
"**": [
Expand Down
36 changes: 19 additions & 17 deletions scoreboard/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,54 @@
import csv
from jinja2 import Environment, FileSystemLoader

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

tasks_dir = Path('tasks')
tasks_dir = Path("tasks")

directories = defaultdict(dict)

if tasks_dir.exists() and tasks_dir.is_dir():
for task_name_dir in tasks_dir.iterdir():
if task_name_dir.is_dir() and task_name_dir.name not in ['common']:
if task_name_dir.is_dir() and task_name_dir.name not in ["common"]:
task_name = task_name_dir.name
for task_type in task_types:
task_type_dir = task_name_dir / task_type
if task_type_dir.exists() and task_type_dir.is_dir():
if task_name.endswith("_disabled"):
clean_task_name = task_name[:-len("_disabled")]
clean_task_name = task_name[: -len("_disabled")]
directories[clean_task_name][task_type] = "disabled"
else:
directories[task_name][task_type] = "done"

config_path = Path(__file__).parent / "data" / "threads-config.yml"
assert config_path.exists(), f"Config file not found: {config_path}"
with open(config_path, 'r') as file:
with open(config_path, "r") as file:
cfg = yaml.safe_load(file)
assert cfg, "Configuration is empty"
plagiarism_config_path = Path(__file__).parent / "data" / "plagiarism.yml"
with open(plagiarism_config_path, 'r') as file:
with open(plagiarism_config_path, "r") as file:
plagiarism_cfg = yaml.safe_load(file)
assert plagiarism_cfg, "Plagiarism configuration is empty"

env = Environment(loader=FileSystemLoader(Path(__file__).parent / "templates"))


perf_stat_file_path = Path(__file__).parent.parent / "build" / "perf_stat_dir" / "task_run_perf_table.csv"
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:
with open(perf_stat_file_path, "r", newline="") as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
perf_stats[row['Task']] = {
"seq": row['SEQ'],
"omp": row['OMP'],
"tbb": row['TBB'],
"stl": row['STL'],
"all": row['ALL'],
perf_stats[row["Task"]] = {
"seq": row["SEQ"],
"omp": row["OMP"],
"tbb": row["TBB"],
"stl": row["STL"],
"all": row["ALL"],
"mpi": "N/A",
}
else:
Expand Down Expand Up @@ -99,12 +101,12 @@
template = env.get_template("index.html.j2")
html_content = template.render(task_types=task_types, rows=rows)

parser = argparse.ArgumentParser(description='Generate HTML scoreboard.')
parser.add_argument('-o', '--output', type=str, required=True, help='Output file path')
parser = argparse.ArgumentParser(description="Generate HTML scoreboard.")
parser.add_argument("-o", "--output", type=str, required=True, help="Output file path")
args = parser.parse_args()

output_file = Path(args.output) / "index.html"
with open(output_file, 'w') as file:
with open(output_file, "w") as file:
file.write(html_content)

print(f"HTML page generated at {output_file}")
99 changes: 73 additions & 26 deletions scripts/create_perf_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
import csv

parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', help='Input file path (logs of perf tests, .txt)', required=True)
parser.add_argument('-o', '--output', help='Output file path (path to .xlsx table)', required=True)
parser.add_argument(
"-i", "--input", help="Input file path (logs of perf tests, .txt)", required=True
)
parser.add_argument(
"-o", "--output", help="Output file path (path to .xlsx table)", required=True
)
args = parser.parse_args()
logs_path = os.path.abspath(args.input)
xlsx_path = os.path.abspath(args.output)
Expand All @@ -19,7 +23,7 @@
logs_file = open(logs_path, "r")
logs_lines = logs_file.readlines()
for line in logs_lines:
pattern = r'tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)'
pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)"
result = re.findall(pattern, line)
if len(result):
task_name = result[0][1]
Expand All @@ -31,7 +35,7 @@
result_tables[perf_type][task_name][ttype] = -1.0

for line in logs_lines:
pattern = r'tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)'
pattern = r"tasks[\/|\\](\w*)[\/|\\](\w*):(\w*):(-*\d*\.\d*)"
result = re.findall(pattern, line)
if len(result):
task_type = result[0][0]
Expand All @@ -45,37 +49,72 @@


for table_name in result_tables:
workbook = xlsxwriter.Workbook(os.path.join(xlsx_path, table_name + '_perf_table.xlsx'))
workbook = xlsxwriter.Workbook(
os.path.join(xlsx_path, table_name + "_perf_table.xlsx")
)
worksheet = workbook.add_worksheet()
worksheet.set_column('A:Z', 23)
right_bold_border = workbook.add_format({'bold': True, 'right': 2, 'bottom': 2})
bottom_bold_border = workbook.add_format({'bold': True, 'bottom': 2})
worksheet.set_column("A:Z", 23)
right_bold_border = workbook.add_format({"bold": True, "right": 2, "bottom": 2})
bottom_bold_border = workbook.add_format({"bold": True, "bottom": 2})
cpu_num = os.environ.get("PPC_NUM_PROC")
if cpu_num is None:
raise EnvironmentError("Required environment variable 'PPC_NUM_PROC' is not set.")
raise EnvironmentError(
"Required environment variable 'PPC_NUM_PROC' is not set."
)
cpu_num = int(cpu_num)
worksheet.write(0, 0, "cpu_num = " + str(cpu_num), right_bold_border)

it = 1
for type_of_task in list_of_type_of_tasks:
worksheet.write(0, it, "T_" + type_of_task + "(" + str(cpu_num) + ")", bottom_bold_border)
worksheet.write(
0, it, "T_" + type_of_task + "(" + str(cpu_num) + ")", bottom_bold_border
)
it += 1
worksheet.write(0, it, "S(" + str(cpu_num) + ")" + " = " +
"T_seq(" + str(cpu_num) + ")" + " / " +
"T_" + type_of_task + "(" + str(cpu_num) + ")", bottom_bold_border)
worksheet.write(
0,
it,
"S("
+ str(cpu_num)
+ ")"
+ " = "
+ "T_seq("
+ str(cpu_num)
+ ")"
+ " / "
+ "T_"
+ type_of_task
+ "("
+ str(cpu_num)
+ ")",
bottom_bold_border,
)
it += 1
worksheet.write(0, it, "Eff(" + str(cpu_num) + ")" + " = " +
"S(" + str(cpu_num) + ")" + " / " + str(cpu_num), right_bold_border)
worksheet.write(
0,
it,
"Eff("
+ str(cpu_num)
+ ")"
+ " = "
+ "S("
+ str(cpu_num)
+ ")"
+ " / "
+ str(cpu_num),
right_bold_border,
)
it += 1

it = 1
for task_name in list(set(set_of_task_name)):
worksheet.write(it, 0, task_name, workbook.add_format({'bold': True, 'right': 2}))
worksheet.write(
it, 0, task_name, workbook.add_format({"bold": True, "right": 2})
)
it += 1

it_i = 1
it_j = 1
right_border = workbook.add_format({'right': 2})
right_border = workbook.add_format({"right": 2})
for task_name in list(set(set_of_task_name)):
for type_of_task in list_of_type_of_tasks:
if task_name not in result_tables[table_name].keys():
Expand Down Expand Up @@ -104,19 +143,27 @@
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:
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'])
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']
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 '?',
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)
Loading
Loading