diff --git a/cmake/functions.cmake b/cmake/functions.cmake index 0c8c3cc57..4a89f3672 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -97,3 +97,54 @@ function(ppc_configure_subproject SUBDIR) "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}") endforeach() endfunction() + +function(ppc_configure_meta_part PROJ_NAME BASE_DIR) + set(TEST_DIR "${BASE_DIR}/tests") + set(TEST_EXECUTABLES "") + + add_tests(USE_FUNC_TESTS ${FUNC_TEST_EXEC} functional) + add_tests(USE_PERF_TESTS ${PERF_TEST_EXEC} performance) + + message(STATUS " -- ${PROJ_NAME}") + + foreach(IMPL IN LISTS PPC_IMPLEMENTATIONS) + setup_implementation( + NAME + ${IMPL} + PROJ_NAME + ${PROJ_NAME} + TESTS + "${TEST_EXECUTABLES}" + BASE_DIR + "${BASE_DIR}") + endforeach() +endfunction() + +function(ppc_configure_meta_project SUBDIR) + add_compile_definitions( + PPC_SETTINGS_${SUBDIR}="${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/settings.json" + PPC_ID_${SUBDIR}="${SUBDIR}") + + project(${SUBDIR}) + message(STATUS "${SUBDIR}") + + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/threads") + ppc_configure_meta_part(${SUBDIR}_threads + "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/threads") + endif() + + file( + GLOB process_task_dirs + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/processes" + "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/processes/*") + list(SORT process_task_dirs) + foreach(PROCESS_TASK IN LISTS process_task_dirs) + if(NOT IS_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/processes/${PROCESS_TASK}") + continue() + endif() + ppc_configure_meta_part( + ${SUBDIR}_processes_${PROCESS_TASK} + "${CMAKE_CURRENT_SOURCE_DIR}/${SUBDIR}/processes/${PROCESS_TASK}") + endforeach() +endfunction() diff --git a/modules/task/include/task.hpp b/modules/task/include/task.hpp index 1b1512371..4ad826073 100644 --- a/modules/task/include/task.hpp +++ b/modules/task/include/task.hpp @@ -78,9 +78,11 @@ inline std::string GetStringTaskStatus(StatusOfTask status_of_task) { /// @brief Returns a string representation of the task type based on the JSON settings file. /// @param type_of_task Type of the task. /// @param settings_file_path Path to the JSON file containing task type strings. +/// @param settings_task_path Optional dot-separated nested path inside the `tasks` object. /// @return Formatted string combining the task type and its corresponding value from the file. -/// @throws std::runtime_error If the file cannot be opened. -inline std::string GetStringTaskType(TypeOfTask type_of_task, const std::string &settings_file_path) { +/// @throws std::runtime_error If the file cannot be opened or the requested settings key is missing. +inline std::string GetStringTaskType(TypeOfTask type_of_task, const std::string &settings_file_path, + std::string_view settings_task_path = {}) { std::ifstream file(settings_file_path); if (!file.is_open()) { throw std::runtime_error("Failed to open " + settings_file_path); @@ -94,8 +96,36 @@ inline std::string GetStringTaskType(TypeOfTask type_of_task, const std::string return std::string(type_str); } - const auto &tasks = list_settings->at("tasks"); - return std::string(type_str) + "_" + std::string(tasks.at(std::string(type_str))); + auto get_required_node = [&settings_file_path](const nlohmann::json &node, const std::string &key, + const std::string &settings_key_path) -> const nlohmann::json & { + if (!node.is_object() || !node.contains(key)) { + throw std::runtime_error("Missing settings key '" + settings_key_path + "' in " + settings_file_path); + } + return *node.find(key); + }; + + std::string settings_key_path = "tasks"; + const auto *settings_node = &get_required_node(*list_settings, "tasks", settings_key_path); + for (size_t start = 0; start < settings_task_path.size();) { + const size_t separator = settings_task_path.find('.', start); + const size_t key_size = separator == std::string_view::npos ? settings_task_path.size() - start : separator - start; + if (key_size == 0) { + throw std::runtime_error("Empty settings key in '" + std::string(settings_task_path) + "' from " + + settings_file_path); + } + const std::string key(settings_task_path.substr(start, key_size)); + settings_key_path += "." + key; + settings_node = &get_required_node(*settings_node, key, settings_key_path); + if (separator == std::string_view::npos) { + break; + } + start = separator + 1; + } + + const std::string type_key(type_str); + settings_key_path += "." + type_key; + const auto &type_node = get_required_node(*settings_node, type_key, settings_key_path); + return type_key + "_" + type_node.get(); } enum class StateOfTesting : uint8_t { diff --git a/modules/task/tests/task_tests.cpp b/modules/task/tests/task_tests.cpp index 91572832e..70d7c67a2 100644 --- a/modules/task/tests/task_tests.cpp +++ b/modules/task/tests/task_tests.cpp @@ -210,6 +210,32 @@ TEST(TaskTest, GetStringTaskTypeEachTypeWithValidFile) { EXPECT_NO_THROW(GetStringTaskType(TypeOfTask::kSEQ, path)); } +TEST(TaskTest, GetStringTaskTypeReadsNestedTaskPath) { + std::string path = "settings_nested.json"; + ScopedFile cleaner(path); + std::ofstream file(path); + file << R"({"tasks": {"processes": {"t2": {"mpi": "disabled", "seq": "enabled"}}}})"; + file.close(); + + EXPECT_EQ(GetStringTaskType(TypeOfTask::kMPI, path, "processes.t2"), "mpi_disabled"); + EXPECT_EQ(GetStringTaskType(TypeOfTask::kSEQ, path, "processes.t2"), "seq_enabled"); +} + +TEST(TaskTest, GetStringTaskTypeReportsMissingNestedTaskPath) { + std::string path = "settings_missing_nested.json"; + ScopedFile cleaner(path); + std::ofstream file(path); + file << R"({"tasks": {"processes": {"t1": {"mpi": "enabled"}}}})"; + file.close(); + + try { + GetStringTaskType(TypeOfTask::kMPI, path, "processes.t2"); + FAIL() << "Expected std::runtime_error"; + } catch (const std::runtime_error &e) { + EXPECT_NE(std::string(e.what()).find("tasks.processes.t2"), std::string::npos); + } +} + TEST(TaskTest, GetStringTaskTypeReturnsUnknownOnDefault) { std::string path = "settings_valid_unknown.json"; ScopedFile cleaner(path); diff --git a/modules/util/include/func_test_util.hpp b/modules/util/include/func_test_util.hpp index 9564b765d..6af48e4cf 100644 --- a/modules/util/include/func_test_util.hpp +++ b/modules/util/include/func_test_util.hpp @@ -4,11 +4,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include @@ -133,22 +133,25 @@ auto ExpandToValues(const Tuple &t) { template auto GenTaskTuplesImpl(const SizesContainer &sizes, const std::string &settings_path, - std::index_sequence /*unused*/) { - return std::make_tuple(std::make_tuple(ppc::task::TaskGetter, - std::string(GetNamespace()) + "_" + - ppc::task::GetStringTaskType(Task::GetStaticTypeOfTask(), settings_path), - std::get(sizes))...); + std::string_view settings_task_path, std::index_sequence /*unused*/) { + return std::make_tuple( + std::make_tuple(ppc::task::TaskGetter, + std::string(GetNamespace()) + "_" + + ppc::task::GetStringTaskType(Task::GetStaticTypeOfTask(), settings_path, settings_task_path), + std::get(sizes))...); } template -auto TaskListGenerator(const SizesContainer &sizes, const std::string &settings_path) { - return GenTaskTuplesImpl(sizes, settings_path, +auto TaskListGenerator(const SizesContainer &sizes, const std::string &settings_path, + std::string_view settings_task_path = {}) { + return GenTaskTuplesImpl(sizes, settings_path, settings_task_path, std::make_index_sequence>>{}); } template -constexpr auto AddFuncTask(const SizesContainer &sizes, const std::string &settings_path) { - return TaskListGenerator(sizes, settings_path); +constexpr auto AddFuncTask(const SizesContainer &sizes, const std::string &settings_path, + std::string_view settings_task_path = {}) { + return TaskListGenerator(sizes, settings_path, settings_task_path); } } // namespace ppc::util diff --git a/modules/util/include/perf_test_util.hpp b/modules/util/include/perf_test_util.hpp index 8fb0a2abc..13c4e3f81 100644 --- a/modules/util/include/perf_test_util.hpp +++ b/modules/util/include/perf_test_util.hpp @@ -5,12 +5,12 @@ #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -77,7 +77,8 @@ class BaseRunPerfTests : public ::testing::TestWithParam -auto MakePerfTaskTuples(const std::string &settings_path) { +auto MakePerfTaskTuples(const std::string &settings_path, std::string_view settings_task_path = {}) { const auto name = std::string(GetNamespace()) + "_" + - ppc::task::GetStringTaskType(TaskType::GetStaticTypeOfTask(), settings_path); + ppc::task::GetStringTaskType(TaskType::GetStaticTypeOfTask(), settings_path, settings_task_path); return std::make_tuple(std::make_tuple(ppc::task::TaskGetter, name, ppc::performance::PerfResults::TypeOfRunning::kPipeline), @@ -133,8 +134,8 @@ auto TupleToGTestValues(Tuple &&tup) { } template -auto MakeAllPerfTasks(const std::string &settings_path) { - return std::tuple_cat(MakePerfTaskTuples(settings_path)...); +auto MakeAllPerfTasks(const std::string &settings_path, std::string_view settings_task_path = {}) { + return std::tuple_cat(MakePerfTaskTuples(settings_path, settings_task_path)...); } } // namespace ppc::util diff --git a/scoreboard/data/copying.yml b/scoreboard/data/copying.yml index f38f6fbad..0831cc679 100644 --- a/scoreboard/data/copying.yml +++ b/scoreboard/data/copying.yml @@ -9,6 +9,6 @@ threads: processes: copying: mpi: - - example_processes + - example_processes_t1 seq: - - example_processes + - example_processes_t1 diff --git a/scoreboard/main.py b/scoreboard/main.py index b279fc12e..a9f8b50d5 100644 --- a/scoreboard/main.py +++ b/scoreboard/main.py @@ -23,6 +23,9 @@ script_dir = Path(__file__).parent tasks_dir = script_dir.parent / "tasks" +task_physical_dirs: dict[str, Path] = {} +task_info_paths: dict[str, Path] = {} +process_task_indices: dict[str, int] = {} # Salt is derived from the repository root directory name (dynamic) REPO_ROOT = script_dir.parent.resolve() # Salt format: "learning_process/" @@ -54,22 +57,7 @@ def _now_msk(): return datetime.now() -def _read_tasks_type(task_dir: Path) -> str | None: - """Read tasks_type from settings.json in the task directory (if present).""" - settings_path = task_dir / "settings.json" - if settings_path.exists(): - try: - import json - - with open(settings_path, "r") as f: - data = json.load(f) - return data.get("tasks_type") # "threads" or "processes" - except Exception as e: - logger.warning("Failed to parse %s: %s", settings_path, e) - return None - - -def _read_task_statuses(task_dir: Path) -> dict[str, str]: +def _read_task_statuses(task_dir: Path) -> dict: """Read per-task-type statuses (enabled/disabled) from settings.json if present.""" settings_path = task_dir / "settings.json" if settings_path.exists(): @@ -80,29 +68,129 @@ def _read_task_statuses(task_dir: Path) -> dict[str, str]: data = json.load(f) tasks_block = data.get("tasks", {}) if isinstance(tasks_block, dict): - return {k: str(v) for k, v in tasks_block.items()} + return tasks_block except Exception as e: logger.warning("Failed to parse task statuses in %s: %s", settings_path, e) return {} +def _read_status_at(status_tree: dict, keys: list[str]) -> str | None: + node = status_tree + for key in keys: + if not isinstance(node, dict) or key not in node: + return None + node = node[key] + return str(node) if isinstance(node, str) else None + + +def _task_info_path(dir_name: str) -> Path: + return task_info_paths.get(dir_name, tasks_dir / dir_name / "info.json") + + +def _student_info_for_dir(dir_name: str) -> dict: + info_path = _task_info_path(dir_name) + if not info_path.exists(): + return {} + try: + with open(info_path, "r") as f: + data = json.load(f) + if isinstance(data.get("student"), dict): + return data.get("student", {}) + except Exception as e: + logger.warning("Failed to parse %s: %s", info_path, e) + return {} + + +def _student_full_name(student: dict) -> str: + return str(student.get("full_name", "")).strip() + + +def _task_physical_dir(dir_name: str) -> Path: + return task_physical_dirs.get(dir_name, tasks_dir / dir_name) + + +def _task_report_exists(dir_name: str, task_type: str) -> bool: + base_dir = _task_physical_dir(dir_name) + typed_report = base_dir / task_type / "report.md" + return typed_report.exists() or (base_dir / "report.md").exists() + + +def _process_task_index_from_name(name: str, fallback: int) -> int: + import re + + match = re.fullmatch(r"t(\d+)", name) + if match: + return int(match.group(1)) + return fallback + + def discover_tasks(tasks_dir, task_types): """Discover tasks and their implementation status from the filesystem. Returns: directories: dict[task_name][task_type] -> status - tasks_type_map: dict[task_name] -> "threads" | "processes" | None + task_category_map: dict[task_name] -> "threads" | "processes" | None """ directories = defaultdict(dict) - tasks_type_map: dict[str, str | None] = {} + task_category_map: dict[str, str | None] = {} 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"]: task_name = task_name_dir.name - # Save tasks_type from settings.json if present - tasks_type_map[task_name] = _read_tasks_type(task_name_dir) status_overrides = _read_task_statuses(task_name_dir) + task_info_paths[task_name] = task_name_dir / "info.json" + task_physical_dirs[task_name] = task_name_dir + + threads_dir = task_name_dir / "threads" + processes_dir = task_name_dir / "processes" + is_meta_task = threads_dir.is_dir() or processes_dir.is_dir() + if is_meta_task: + if threads_dir.is_dir(): + logical_name = f"{task_name}_threads" + task_category_map[logical_name] = "threads" + task_info_paths[logical_name] = task_name_dir / "info.json" + task_physical_dirs[logical_name] = threads_dir + for task_type in task_types: + task_type_dir = threads_dir / task_type + if task_type_dir.exists() and task_type_dir.is_dir(): + status = _read_status_at( + status_overrides, ["threads", task_type] + ) + directories[logical_name][task_type] = ( + "disabled" if status == "disabled" else "done" + ) + + if processes_dir.is_dir(): + process_task_dirs = sorted( + p for p in processes_dir.iterdir() if p.is_dir() + ) + for index, process_task_dir in enumerate( + process_task_dirs, start=1 + ): + process_task_name = process_task_dir.name + logical_name = f"{task_name}_processes_{process_task_name}" + task_category_map[logical_name] = "processes" + task_info_paths[logical_name] = task_name_dir / "info.json" + task_physical_dirs[logical_name] = process_task_dir + process_task_indices[logical_name] = ( + _process_task_index_from_name(process_task_name, index) + ) + for task_type in task_types: + task_type_dir = process_task_dir / task_type + if task_type_dir.exists() and task_type_dir.is_dir(): + status = _read_status_at( + status_overrides, + ["processes", process_task_name, task_type], + ) + directories[logical_name][task_type] = ( + "disabled" if status == "disabled" else "done" + ) + continue + + task_category_map[task_name] = ( + "processes" if (task_name_dir / "mpi").is_dir() else "threads" + ) 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(): @@ -114,10 +202,10 @@ def discover_tasks(tasks_dir, task_types): else: directories[task_name][task_type] = "done" - return directories, tasks_type_map + return directories, task_category_map -directories, tasks_type_map = discover_tasks(tasks_dir, task_types) +directories, task_category_map = discover_tasks(tasks_dir, task_types) def load_performance_data_threads(perf_stat_file_path: Path) -> dict: @@ -206,18 +294,7 @@ def load_performance_data_processes(perf_stat_file_path: Path) -> dict: mode = lbl break - # Normalize example perf task names to example_processes[_N] - def _norm(name: str) -> str: - import re - - m = re.match(r".*test_task_processes(?P(_\\d+)?)$", name) - if m: - return f"example_processes{m.group('suffix') or ''}" - return name - - base_name_norm = _norm(base_name) - - entry = perf_stats.setdefault(base_name_norm, {"seq": "?", "mpi": "?"}) + entry = perf_stats.setdefault(base_name, {"seq": "?", "mpi": "?"}) if mode == "seq": if seq_val and seq_val != "?": entry["seq"] = seq_val @@ -355,12 +432,12 @@ def _calc_perf_points_from_efficiency(efficiency_str: str, max_points: int) -> f return round(pts, 2) -def _find_process_report_max(points_info, task_number: int) -> int: +def _find_process_report_max(points_info, process_task_index: int) -> int: """Get max report (R) points for process task by ordinal (1..3). Looks up processes.tasks with names like 'mpi_task_1'. """ proc = (points_info.get("processes", {}) or {}).get("tasks", []) - key = f"mpi_task_{task_number}" + key = f"mpi_task_{process_task_index}" for t in proc: if str(t.get("name")) == key: try: @@ -370,12 +447,14 @@ def _find_process_report_max(points_info, task_number: int) -> int: return 0 -def _find_process_points(points_info, task_number: int) -> tuple[int, int, int, int]: +def _find_process_points( + points_info, process_task_index: int +) -> tuple[int, int, int, int]: """Return (S_mpi, S_seq, A_mpi, R) maxima for a given process task ordinal (1..3). Supports both mapping and list-of-maps (per user's YAML example). """ proc_tasks = (points_info.get("processes", {}) or {}).get("tasks", []) - key = f"mpi_task_{task_number}" + key = f"mpi_task_{process_task_index}" for t in proc_tasks: if str(t.get("name")) == key: @@ -404,9 +483,9 @@ def _extract(obj, k): return 0, 0, 0, 0 -def _find_process_variants_max(points_info, task_number: int) -> int: +def _find_process_variants_max(points_info, process_task_index: int) -> int: proc_tasks = (points_info.get("processes", {}) or {}).get("tasks", []) - key = f"mpi_task_{task_number}" + key = f"mpi_task_{process_task_index}" for t in proc_tasks: if str(t.get("name")) == key: try: @@ -491,8 +570,9 @@ def calculate_deadline_penalty(dir, task_type, status, deadlines_cfg, tasks_dir) "-1", "--format=%ct", str( - tasks_dir - / (dir + ("_disabled" if status == "disabled" else "")) + _task_physical_dir( + dir[: -len("_disabled")] if dir.endswith("_disabled") else dir + ) / task_type ), ] @@ -538,34 +618,16 @@ def _build_rows_for_task_types( rows = [] def _load_student_info_label(dir_name: str): - import json - - info_path = tasks_dir / dir_name / "info.json" - if not info_path.exists(): - return None - try: - with open(info_path, "r") as f: - data = json.load(f) - s = data.get("student", {}) - parts = [p for p in str(s.get("full_name", "")).strip().split() if p] - label = "
".join(parts) - return label if label else None - except Exception: - return None + s = _student_info_for_dir(dir_name) + parts = [p for p in _student_full_name(s).split() if p] + label = "
".join(parts) + return label if label else None def _load_student_fields(dir_name: str): - import json - - info_path = tasks_dir / dir_name / "info.json" - if not info_path.exists(): - return None - try: - with open(info_path, "r") as f: - data = json.load(f) - s = data.get("student", {}) - return str(s.get("full_name", "")).strip(), str(s.get("group_number", "")) - except Exception: + s = _student_info_for_dir(dir_name) + if not s: return None + return _student_full_name(s), str(s.get("group_number", "")) for dir in sorted(dir_names): row_types = [] @@ -595,7 +657,7 @@ def _load_student_fields(dir_name: str): ) # Report presence: award R only if report.md exists inside the task directory - report_present = (tasks_dir / dir / "report.md").exists() + report_present = _task_report_exists(dir, task_type) report_points = _find_report_max(cfg, task_type) if report_present else 0 # Performance points P for non-seq types, based on efficiency @@ -795,9 +857,8 @@ def _compute_display_deadlines_processes(n_items: int) -> list[date]: def _aggregate_process_csv( perf_stat_file_path: Path, base: dict[str, dict] ) -> dict: - """Parse CSV again to ensure merged entries (handles example*_2, _3, etc.).""" + """Parse CSV again to ensure merged seq/mpi entries.""" import csv - import re perf_stats_local = dict(base) if not perf_stat_file_path.exists(): @@ -817,11 +878,7 @@ def _aggregate_process_csv( base_name = task_name[: -len(suff)] mode = lbl break - m = re.match(r".*test_task_processes(?P_\\d+)?$", base_name) - base_norm = ( - f"example_processes{m.group('suffix') or ''}" if m else base_name - ) - entry = perf_stats_local.setdefault(base_norm, {"seq": "?", "mpi": "?"}) + entry = perf_stats_local.setdefault(base_name, {"seq": "?", "mpi": "?"}) if mode == "seq": if seq_val and seq_val != "?": entry["seq"] = seq_val @@ -837,45 +894,22 @@ def _aggregate_process_csv( perf_stats_processes = _aggregate_process_csv(processes_csv, perf_stats_processes) - # Generic aliasing for example process tasks: normalize any *test_task_processes* keys - def _normalize_example_proc_name(name: str) -> str: - import re - - m = re.match(r".*test_task_processes(?P(_\\d+)?)$", name) - if m: - suffix = m.group("suffix") or "" - return f"example_processes{suffix}" - return name - - perf_stats_processes = { - _normalize_example_proc_name(k): v for k, v in perf_stats_processes.items() - } - - # Map example process tasks (nesterov_a_test_task_processes[_2|_3]) to dir names - example_aliases = { - "nesterov_a_test_task_processes": "example_processes", - "nesterov_a_test_task_processes_2": "example_processes_2", - "nesterov_a_test_task_processes_3": "example_processes_3", - } - for src, dst in example_aliases.items(): - if src in perf_stats_processes and dst not in perf_stats_processes: - perf_stats_processes[dst] = perf_stats_processes[src] perf_stats_raw: dict[str, dict] = {} perf_stats_raw.update(perf_stats_threads) for k, v in perf_stats_processes.items(): perf_stats_raw[k] = {**perf_stats_raw.get(k, {}), **v} - # Partition tasks by tasks_type from settings.json + # Partition tasks by category derived from the filesystem layout. threads_task_dirs = [ - name for name, ttype in tasks_type_map.items() if ttype == "threads" + name for name, category in task_category_map.items() if category == "threads" ] processes_task_dirs = [ - name for name, ttype in tasks_type_map.items() if ttype == "processes" + name for name, category in task_category_map.items() if category == "processes" ] - # Fallback: if settings.json is missing, guess by directory name heuristic + # Fallback for directories discovered before category assignment. for name in directories.keys(): - if name not in tasks_type_map or tasks_type_map[name] is None: + if name not in task_category_map or task_category_map[name] is None: if "threads" in name: threads_task_dirs.append(name) elif "processes" in name: @@ -900,22 +934,11 @@ def _merge_perf_maps(existing: dict, updates: dict) -> dict: merged[k] = v return merged - # Precompute mapping: task_number (processes tasks) -> list of directories + # Precompute mapping: process task number -> list of directories. Meta-layout + # tasks derive this from processes/t1, processes/t2, etc. process_tasknum_map: dict[int, list[str]] = {} - for d in directories.keys(): - info_path = tasks_dir / d / "info.json" - if not info_path.exists(): - continue - try: - with open(info_path, "r") as _f: - data = json.load(_f) - num = data.get("student", {}).get("task_number") - if num is None: - continue - num = int(str(num)) - process_tasknum_map.setdefault(num, []).append(d) - except Exception: - continue + for d, num in process_task_indices.items(): + process_tasknum_map.setdefault(num, []).append(d) def _match_dir(csv_key: str) -> str | None: # Strip common suffixes like "_mpi_enabled" etc. to improve matching @@ -931,7 +954,7 @@ def _match_dir(csv_key: str) -> str | None: target = _match_dir(key) if target: targets.add(target) - # 2) If key encodes processes_N, spread to all dirs with that task_number + # 2) If a legacy key encodes processes_N, spread to dirs with that task number m_num = _re.search(r"processes_(\d+)", key) if m_num: try: @@ -939,10 +962,6 @@ def _match_dir(csv_key: str) -> str | None: targets.update(process_tasknum_map.get(num, [])) except Exception: pass - # 3) Fallback: if nothing matched and "threads" in key, apply to example_threads only - if not targets and "threads" in key: - if "example_threads" in directories: - targets.add("example_threads") # Apply merged values to all targets for t in targets: perf_stats[t] = _merge_perf_maps(perf_stats.get(t, {}), vals) @@ -959,21 +978,12 @@ def _match_dir(csv_key: str) -> str | None: # Processes page: build 3 tasks as columns for a single student def _load_student_info(dir_name: str): - info_path = tasks_dir / dir_name / "info.json" - if not info_path.exists(): - return None - try: - with open(info_path, "r") as f: - data = json.load(f) - return data.get("student", {}) - except Exception as e: - logger.warning("Failed to parse %s: %s", info_path, e) - return None + return _student_info_for_dir(dir_name) or None def _identity_key(student: dict) -> str: return "|".join( [ - str(student.get("full_name", "")).strip(), + _student_full_name(student), str(student.get("group_number", "")), ] ) @@ -1037,7 +1047,7 @@ def _build_cell(dir_name: str, ttype: str, perf_map: dict[str, dict]): def _sort_identity(student: dict): return ( - str(student.get("full_name", "")).strip(), + _student_full_name(student), str(student.get("group_number", "")), ) @@ -1050,11 +1060,11 @@ def _build_process_rows(processes_dirs: list[str]): continue key = _identity_key(s) entry = identity_map.setdefault(key, {"student": s, "dir_map": {}}) - try: - tn = int(str(s.get("task_number", "0"))) - except Exception: - tn = 0 - # If task_number is outside expected range (1..3), map to fallback (task-1) + if d in process_task_indices: + tn = process_task_indices[d] + else: + tn = fallback_process_tasknum + # If ordinal is outside expected range (1..3), map to fallback (task-1) if tn not in expected_numbers: tn = fallback_process_tasknum entry["dir_map"][tn] = d @@ -1084,7 +1094,9 @@ def _build_process_rows(processes_dirs: list[str]): status_seq = directories[clean_d].get("seq") has_mpi = status_mpi in ("done", "disabled") has_seq = status_seq in ("done", "disabled") - report_present = (tasks_dir / d / "report.md").exists() + report_present = _task_report_exists( + d, "seq" + ) or _task_report_exists(d, "mpi") mpi_eff = group_cells[0].get("efficiency", "N/A") perf_points_mpi = ( @@ -1165,9 +1177,8 @@ def _build_process_rows(processes_dirs: list[str]): ) proc_r_values.append(0) - name_parts = [ - p for p in str(student.get("full_name", "")).strip().split() if p - ] + student_full_name = _student_full_name(student) + name_parts = [p for p in student_full_name.split() if p] name_html = "
".join([p for p in name_parts if p]) or "processes" variants_render = [] @@ -1175,7 +1186,7 @@ def _build_process_rows(processes_dirs: list[str]): vmax = _find_process_variants_max(cfg, n) try: v_idx = assign_variant( - full_name=str(student.get("full_name", "")).strip(), + full_name=student_full_name, group=str(student.get("group_number", "")), repo=f"{REPO_SALT}/processes/task-{n}", num_variants=vmax, @@ -1309,7 +1320,7 @@ def _build_process_rows(processes_dirs: list[str]): def _load_group_number(dir_name: str): import json - info_path = tasks_dir / dir_name / "info.json" + info_path = _task_info_path(dir_name) if not info_path.exists(): return None try: @@ -1389,7 +1400,7 @@ def _slugify(text: str) -> str: # Reuse earlier logic but limited to filtered_dirs def _load_student_info_group(dir_name: str): - info_path = tasks_dir / dir_name / "info.json" + info_path = _task_info_path(dir_name) if not info_path.exists(): return None try: @@ -1402,7 +1413,7 @@ def _load_student_info_group(dir_name: str): def _id_key(stud: dict) -> str: return "|".join( [ - str(stud.get("full_name", "")).strip(), + _student_full_name(stud), str(stud.get("group_number", "")), ] ) diff --git a/scripts/create_perf_table.py b/scripts/create_perf_table.py index a8950e291..14b6d3105 100644 --- a/scripts/create_perf_table.py +++ b/scripts/create_perf_table.py @@ -18,8 +18,8 @@ r"(\w+_test_task_(threads|processes))_(\w+)_enabled:(\w*):(-*\d*\.\d*)" ) # Example formats: -# example_threads_omp_enabled:task_run:0.4749 -# example_processes_2_mpi_enabled:pipeline:0.0507 +# _threads_omp_enabled:task_run:0.4749 +# _processes_t2_mpi_enabled:pipeline:0.0507 # Accept optional suffix after `_enabled` (e.g., `_enabled_size1000000`) before the colon SIMPLE_PATTERN = re.compile( r"(.+?)_(omp|seq|tbb|stl|all|mpi)_enabled[^:]*:(task_run|pipeline):(-*\d*\.\d*)" @@ -165,12 +165,15 @@ def _write_csv(path: str, header: list[str], tasks_list: list[str], table: dict) task_categories[task_name] = "threads" tasks_by_category["threads"].add(task_name) elif len(new_result): - # Extract task name from namespace format; keep it specific (no collapsing to example_*), - # so per-task-number data (processes_2, processes_3, etc.) is preserved. - base = new_result[0][0] # e.g., nesterov_a_test_task_processes + # Extract task name from namespace format and keep it specific. + base = new_result[0][0] # e.g., task_namespace_processes task_category = new_result[0][1] # "threads" or "processes" task_type_token = new_result[0][2] # e.g., "all", "omp", or "2_mpi" task_name = f"{base}_{task_type_token}" + if "_" in task_type_token: + suffix, impl = task_type_token.rsplit("_", 1) + if impl in list_of_type_of_tasks: + task_name = f"{base}_{suffix}" perf_type = new_result[0][3] _ensure_task_tables(result_tables, perf_type, task_name) diff --git a/tasks/CMakeLists.txt b/tasks/CMakeLists.txt index 3905200f7..685457716 100644 --- a/tasks/CMakeLists.txt +++ b/tasks/CMakeLists.txt @@ -42,5 +42,10 @@ foreach(sub IN LISTS selected_tasks) string(JOIN ", " available_tasks_message ${available_tasks}) message(FATAL_ERROR "Unknown PPC_TASKS entry '${sub}'. Available tasks: ${available_tasks_message}") endif() - ppc_configure_subproject(${sub}) + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${sub}/threads" + OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${sub}/processes") + ppc_configure_meta_project(${sub}) + else() + ppc_configure_subproject(${sub}) + endif() endforeach() diff --git a/tasks/example/common/include/common.hpp b/tasks/example/common/include/common.hpp new file mode 100644 index 000000000..0f2d03c48 --- /dev/null +++ b/tasks/example/common/include/common.hpp @@ -0,0 +1,51 @@ +#pragma once + +#include +#include + +#include "task/include/task.hpp" + +namespace example_common { + +using InType = int; +using OutType = int; +using TestType = std::tuple; +using BaseTask = ppc::task::Task; + +} // namespace example_common + +namespace example_threads { + +using example_common::BaseTask; +using example_common::InType; +using example_common::OutType; +using example_common::TestType; + +} // namespace example_threads + +namespace example_processes_t1 { + +using example_common::BaseTask; +using example_common::InType; +using example_common::OutType; +using example_common::TestType; + +} // namespace example_processes_t1 + +namespace example_processes_t2 { + +using example_common::BaseTask; +using example_common::InType; +using example_common::OutType; +using example_common::TestType; + +} // namespace example_processes_t2 + +namespace example_processes_t3 { + +using example_common::BaseTask; +using example_common::InType; +using example_common::OutType; +using example_common::TestType; + +} // namespace example_processes_t3 diff --git a/tasks/example_processes/data/pic.ppm b/tasks/example/data/pic.ppm similarity index 100% rename from tasks/example_processes/data/pic.ppm rename to tasks/example/data/pic.ppm diff --git a/tasks/example/info.json b/tasks/example/info.json new file mode 100644 index 000000000..76db715f9 --- /dev/null +++ b/tasks/example/info.json @@ -0,0 +1,6 @@ +{ + "student": { + "full_name": "full_name", + "group_number": "group_number" + } +} diff --git a/tasks/example/processes/report.md b/tasks/example/processes/report.md new file mode 100644 index 000000000..3af7abdb1 --- /dev/null +++ b/tasks/example/processes/report.md @@ -0,0 +1,9 @@ +# Example Processes + +This section aggregates the MPI/process example tasks. + +Child reports: + +- `t1/report.md` +- `t2/report.md` +- `t3/report.md` diff --git a/tasks/example_processes/mpi/include/ops_mpi.hpp b/tasks/example/processes/t1/mpi/include/ops_mpi.hpp similarity index 74% rename from tasks/example_processes/mpi/include/ops_mpi.hpp rename to tasks/example/processes/t1/mpi/include/ops_mpi.hpp index c85254560..26a76c0e4 100644 --- a/tasks/example_processes/mpi/include/ops_mpi.hpp +++ b/tasks/example/processes/t1/mpi/include/ops_mpi.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_processes/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_processes { +namespace example_processes_t1 { class NesterovATestTaskMPI : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskMPI : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_processes +} // namespace example_processes_t1 diff --git a/tasks/example/processes/t1/mpi/report.md b/tasks/example/processes/t1/mpi/report.md new file mode 100644 index 000000000..a74a4413b --- /dev/null +++ b/tasks/example/processes/t1/mpi/report.md @@ -0,0 +1,3 @@ +# Example Processes T1 MPI + +MPI implementation for process example task T1. diff --git a/tasks/example_processes/mpi/src/ops_mpi.cpp b/tasks/example/processes/t1/mpi/src/ops_mpi.cpp similarity index 87% rename from tasks/example_processes/mpi/src/ops_mpi.cpp rename to tasks/example/processes/t1/mpi/src/ops_mpi.cpp index 84cafe1f5..32f79bbe6 100644 --- a/tasks/example_processes/mpi/src/ops_mpi.cpp +++ b/tasks/example/processes/t1/mpi/src/ops_mpi.cpp @@ -1,14 +1,14 @@ -#include "example_processes/mpi/include/ops_mpi.hpp" +#include "example/processes/t1/mpi/include/ops_mpi.hpp" #include #include #include -#include "example_processes/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes { +namespace example_processes_t1 { NesterovATestTaskMPI::NesterovATestTaskMPI(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -69,4 +69,4 @@ bool NesterovATestTaskMPI::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_processes +} // namespace example_processes_t1 diff --git a/tasks/example/processes/t1/report.md b/tasks/example/processes/t1/report.md new file mode 100644 index 000000000..9e98694eb --- /dev/null +++ b/tasks/example/processes/t1/report.md @@ -0,0 +1,8 @@ +# Example Processes T1 + +First process example task. + +Child reports: + +- `seq/report.md` +- `mpi/report.md` diff --git a/tasks/example_threads/seq/include/ops_seq.hpp b/tasks/example/processes/t1/seq/include/ops_seq.hpp similarity index 75% rename from tasks/example_threads/seq/include/ops_seq.hpp rename to tasks/example/processes/t1/seq/include/ops_seq.hpp index 16eac94de..ced07076a 100644 --- a/tasks/example_threads/seq/include/ops_seq.hpp +++ b/tasks/example/processes/t1/seq/include/ops_seq.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_threads { +namespace example_processes_t1 { class NesterovATestTaskSEQ : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskSEQ : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_threads +} // namespace example_processes_t1 diff --git a/tasks/example/processes/t1/seq/report.md b/tasks/example/processes/t1/seq/report.md new file mode 100644 index 000000000..9ea9d286b --- /dev/null +++ b/tasks/example/processes/t1/seq/report.md @@ -0,0 +1,3 @@ +# Example Processes T1 Seq + +Sequential baseline for process example task T1. diff --git a/tasks/example_threads/seq/src/ops_seq.cpp b/tasks/example/processes/t1/seq/src/ops_seq.cpp similarity index 86% rename from tasks/example_threads/seq/src/ops_seq.cpp rename to tasks/example/processes/t1/seq/src/ops_seq.cpp index 8888b3258..01d753109 100644 --- a/tasks/example_threads/seq/src/ops_seq.cpp +++ b/tasks/example/processes/t1/seq/src/ops_seq.cpp @@ -1,12 +1,12 @@ -#include "example_threads/seq/include/ops_seq.hpp" +#include "example/processes/t1/seq/include/ops_seq.hpp" #include #include -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_threads { +namespace example_processes_t1 { NesterovATestTaskSEQ::NesterovATestTaskSEQ(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -57,4 +57,4 @@ bool NesterovATestTaskSEQ::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_threads +} // namespace example_processes_t1 diff --git a/tasks/example_processes/tests/.clang-tidy b/tasks/example/processes/t1/tests/.clang-tidy similarity index 100% rename from tasks/example_processes/tests/.clang-tidy rename to tasks/example/processes/t1/tests/.clang-tidy diff --git a/tasks/example_processes/tests/functional/main.cpp b/tasks/example/processes/t1/tests/functional/main.cpp similarity index 80% rename from tasks/example_processes/tests/functional/main.cpp rename to tasks/example/processes/t1/tests/functional/main.cpp index 53d325282..1c32faa93 100644 --- a/tasks/example_processes/tests/functional/main.cpp +++ b/tasks/example/processes/t1/tests/functional/main.cpp @@ -12,13 +12,13 @@ #include #include -#include "example_processes/common/include/common.hpp" -#include "example_processes/mpi/include/ops_mpi.hpp" -#include "example_processes/seq/include/ops_seq.hpp" +#include "example/common/include/common.hpp" +#include "example/processes/t1/mpi/include/ops_mpi.hpp" +#include "example/processes/t1/seq/include/ops_seq.hpp" #include "util/include/func_test_util.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes { +namespace example_processes_t1 { class NesterovARunFuncTestsProcesses : public ppc::util::BaseRunFuncTests { public: @@ -45,7 +45,7 @@ class NesterovARunFuncTestsProcesses : public ppc::util::BaseRunFuncTests img; // Read image in RGB to ensure consistent channel count { - std::string abs_path = ppc::util::GetAbsoluteTaskPath(PPC_ID_example_processes, "pic.ppm"); + std::string abs_path = ppc::util::GetAbsoluteTaskPath(PPC_ID_example, "pic.ppm"); auto *data = stbi_load(abs_path.c_str(), &width, &height, &channels, STBI_rgb); if (data == nullptr) { throw std::runtime_error("Failed to load image: " + std::string(stbi_failure_reason())); @@ -77,9 +77,9 @@ namespace { const std::array kTestParam = {std::make_tuple(3, "3"), std::make_tuple(5, "5"), std::make_tuple(7, "7")}; -const auto kTestTasksList = - std::tuple_cat(ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_processes), - ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_processes)); +const auto kTestTasksList = std::tuple_cat( + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "processes.t1"), + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "processes.t1")); } // namespace @@ -87,4 +87,4 @@ TEST_F(NesterovARunFuncTestsProcesses, MatmulFromPic) { std::apply([this](const auto &...test_params) { (RunTestCase(test_params), ...); }, kTestTasksList); } -} // namespace nesterov_a_test_task_processes +} // namespace example_processes_t1 diff --git a/tasks/example_processes/tests/performance/main.cpp b/tasks/example/processes/t1/tests/performance/main.cpp similarity index 62% rename from tasks/example_processes/tests/performance/main.cpp rename to tasks/example/processes/t1/tests/performance/main.cpp index d6240bce4..b4fc6e9db 100644 --- a/tasks/example_processes/tests/performance/main.cpp +++ b/tasks/example/processes/t1/tests/performance/main.cpp @@ -2,12 +2,12 @@ #include -#include "example_processes/common/include/common.hpp" -#include "example_processes/mpi/include/ops_mpi.hpp" -#include "example_processes/seq/include/ops_seq.hpp" +#include "example/common/include/common.hpp" +#include "example/processes/t1/mpi/include/ops_mpi.hpp" +#include "example/processes/t1/seq/include/ops_seq.hpp" #include "util/include/perf_test_util.hpp" -namespace nesterov_a_test_task_processes { +namespace example_processes_t1 { class ExampleRunPerfTestProcesses : public ppc::util::BaseRunPerfTests { protected: @@ -30,8 +30,8 @@ class ExampleRunPerfTestProcesses : public ppc::util::BaseRunPerfTests(PPC_SETTINGS_example_processes); +const auto kAllPerfTasks = ppc::util::MakeAllPerfTasks( + PPC_SETTINGS_example, "processes.t1"); } // namespace @@ -39,4 +39,4 @@ TEST_F(ExampleRunPerfTestProcesses, RunPerfModes) { std::apply([this](const auto &...test_params) { (ExecuteTest(test_params), ...); }, kAllPerfTasks); } -} // namespace nesterov_a_test_task_processes +} // namespace example_processes_t1 diff --git a/tasks/example_processes_2/mpi/include/ops_mpi.hpp b/tasks/example/processes/t2/mpi/include/ops_mpi.hpp similarity index 73% rename from tasks/example_processes_2/mpi/include/ops_mpi.hpp rename to tasks/example/processes/t2/mpi/include/ops_mpi.hpp index f39ac9489..aac5dd642 100644 --- a/tasks/example_processes_2/mpi/include/ops_mpi.hpp +++ b/tasks/example/processes/t2/mpi/include/ops_mpi.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_processes_2/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_processes_2 { +namespace example_processes_t2 { class NesterovATestTaskMPI : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskMPI : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_processes_2 +} // namespace example_processes_t2 diff --git a/tasks/example/processes/t2/mpi/report.md b/tasks/example/processes/t2/mpi/report.md new file mode 100644 index 000000000..5ce48d217 --- /dev/null +++ b/tasks/example/processes/t2/mpi/report.md @@ -0,0 +1,3 @@ +# Example Processes T2 MPI + +MPI implementation for process example task T2. diff --git a/tasks/example_processes_3/mpi/src/ops_mpi.cpp b/tasks/example/processes/t2/mpi/src/ops_mpi.cpp similarity index 87% rename from tasks/example_processes_3/mpi/src/ops_mpi.cpp rename to tasks/example/processes/t2/mpi/src/ops_mpi.cpp index 7cef9dbb6..13781a6c2 100644 --- a/tasks/example_processes_3/mpi/src/ops_mpi.cpp +++ b/tasks/example/processes/t2/mpi/src/ops_mpi.cpp @@ -1,14 +1,14 @@ -#include "example_processes_3/mpi/include/ops_mpi.hpp" +#include "example/processes/t2/mpi/include/ops_mpi.hpp" #include #include #include -#include "example_processes_3/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes_3 { +namespace example_processes_t2 { NesterovATestTaskMPI::NesterovATestTaskMPI(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -69,4 +69,4 @@ bool NesterovATestTaskMPI::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_processes_3 +} // namespace example_processes_t2 diff --git a/tasks/example/processes/t2/report.md b/tasks/example/processes/t2/report.md new file mode 100644 index 000000000..9ec20d493 --- /dev/null +++ b/tasks/example/processes/t2/report.md @@ -0,0 +1,8 @@ +# Example Processes T2 + +Second process example task. + +Child reports: + +- `seq/report.md` +- `mpi/report.md` diff --git a/tasks/example_processes/seq/include/ops_seq.hpp b/tasks/example/processes/t2/seq/include/ops_seq.hpp similarity index 74% rename from tasks/example_processes/seq/include/ops_seq.hpp rename to tasks/example/processes/t2/seq/include/ops_seq.hpp index c9608cf0d..b32aa89da 100644 --- a/tasks/example_processes/seq/include/ops_seq.hpp +++ b/tasks/example/processes/t2/seq/include/ops_seq.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_processes/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_processes { +namespace example_processes_t2 { class NesterovATestTaskSEQ : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskSEQ : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_processes +} // namespace example_processes_t2 diff --git a/tasks/example/processes/t2/seq/report.md b/tasks/example/processes/t2/seq/report.md new file mode 100644 index 000000000..e7bf712bf --- /dev/null +++ b/tasks/example/processes/t2/seq/report.md @@ -0,0 +1,3 @@ +# Example Processes T2 Seq + +Sequential baseline for process example task T2. diff --git a/tasks/example_processes/seq/src/ops_seq.cpp b/tasks/example/processes/t2/seq/src/ops_seq.cpp similarity index 85% rename from tasks/example_processes/seq/src/ops_seq.cpp rename to tasks/example/processes/t2/seq/src/ops_seq.cpp index 2599c518e..60d962f28 100644 --- a/tasks/example_processes/seq/src/ops_seq.cpp +++ b/tasks/example/processes/t2/seq/src/ops_seq.cpp @@ -1,12 +1,12 @@ -#include "example_processes/seq/include/ops_seq.hpp" +#include "example/processes/t2/seq/include/ops_seq.hpp" #include #include -#include "example_processes/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes { +namespace example_processes_t2 { NesterovATestTaskSEQ::NesterovATestTaskSEQ(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -57,4 +57,4 @@ bool NesterovATestTaskSEQ::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_processes +} // namespace example_processes_t2 diff --git a/tasks/example_processes_2/tests/.clang-tidy b/tasks/example/processes/t2/tests/.clang-tidy similarity index 100% rename from tasks/example_processes_2/tests/.clang-tidy rename to tasks/example/processes/t2/tests/.clang-tidy diff --git a/tasks/example_processes_2/tests/functional/main.cpp b/tasks/example/processes/t2/tests/functional/main.cpp similarity index 80% rename from tasks/example_processes_2/tests/functional/main.cpp rename to tasks/example/processes/t2/tests/functional/main.cpp index 08e3b4495..0ea55456c 100644 --- a/tasks/example_processes_2/tests/functional/main.cpp +++ b/tasks/example/processes/t2/tests/functional/main.cpp @@ -12,13 +12,13 @@ #include #include -#include "example_processes_2/common/include/common.hpp" -#include "example_processes_2/mpi/include/ops_mpi.hpp" -#include "example_processes_2/seq/include/ops_seq.hpp" +#include "example/common/include/common.hpp" +#include "example/processes/t2/mpi/include/ops_mpi.hpp" +#include "example/processes/t2/seq/include/ops_seq.hpp" #include "util/include/func_test_util.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes_2 { +namespace example_processes_t2 { class NesterovARunFuncTestsProcesses2 : public ppc::util::BaseRunFuncTests { public: @@ -45,7 +45,7 @@ class NesterovARunFuncTestsProcesses2 : public ppc::util::BaseRunFuncTests img; // Read image in RGB to ensure consistent channel count { - std::string abs_path = ppc::util::GetAbsoluteTaskPath(PPC_ID_example_processes_2, "pic.ppm"); + std::string abs_path = ppc::util::GetAbsoluteTaskPath(PPC_ID_example, "pic.ppm"); auto *data = stbi_load(abs_path.c_str(), &width, &height, &channels, STBI_rgb); if (data == nullptr) { throw std::runtime_error("Failed to load image: " + std::string(stbi_failure_reason())); @@ -77,9 +77,9 @@ namespace { const std::array kTestParam = {std::make_tuple(3, "3"), std::make_tuple(5, "5"), std::make_tuple(7, "7")}; -const auto kTestTasksList = - std::tuple_cat(ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_processes_2), - ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_processes_2)); +const auto kTestTasksList = std::tuple_cat( + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "processes.t2"), + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "processes.t2")); } // namespace @@ -87,4 +87,4 @@ TEST_F(NesterovARunFuncTestsProcesses2, MatmulFromPic) { std::apply([this](const auto &...test_params) { (RunTestCase(test_params), ...); }, kTestTasksList); } -} // namespace nesterov_a_test_task_processes_2 +} // namespace example_processes_t2 diff --git a/tasks/example_processes_2/tests/performance/main.cpp b/tasks/example/processes/t2/tests/performance/main.cpp similarity index 62% rename from tasks/example_processes_2/tests/performance/main.cpp rename to tasks/example/processes/t2/tests/performance/main.cpp index dd184c15a..130159aeb 100644 --- a/tasks/example_processes_2/tests/performance/main.cpp +++ b/tasks/example/processes/t2/tests/performance/main.cpp @@ -2,12 +2,12 @@ #include -#include "example_processes_2/common/include/common.hpp" -#include "example_processes_2/mpi/include/ops_mpi.hpp" -#include "example_processes_2/seq/include/ops_seq.hpp" +#include "example/common/include/common.hpp" +#include "example/processes/t2/mpi/include/ops_mpi.hpp" +#include "example/processes/t2/seq/include/ops_seq.hpp" #include "util/include/perf_test_util.hpp" -namespace nesterov_a_test_task_processes_2 { +namespace example_processes_t2 { class ExampleRunPerfTestProcesses2 : public ppc::util::BaseRunPerfTests { protected: @@ -30,8 +30,8 @@ class ExampleRunPerfTestProcesses2 : public ppc::util::BaseRunPerfTests(PPC_SETTINGS_example_processes_2); +const auto kAllPerfTasks = ppc::util::MakeAllPerfTasks( + PPC_SETTINGS_example, "processes.t2"); } // namespace @@ -39,4 +39,4 @@ TEST_F(ExampleRunPerfTestProcesses2, RunPerfModes) { std::apply([this](const auto &...test_params) { (ExecuteTest(test_params), ...); }, kAllPerfTasks); } -} // namespace nesterov_a_test_task_processes_2 +} // namespace example_processes_t2 diff --git a/tasks/example_processes_3/mpi/include/ops_mpi.hpp b/tasks/example/processes/t3/mpi/include/ops_mpi.hpp similarity index 73% rename from tasks/example_processes_3/mpi/include/ops_mpi.hpp rename to tasks/example/processes/t3/mpi/include/ops_mpi.hpp index a1433dc8f..e17999c71 100644 --- a/tasks/example_processes_3/mpi/include/ops_mpi.hpp +++ b/tasks/example/processes/t3/mpi/include/ops_mpi.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_processes_3/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_processes_3 { +namespace example_processes_t3 { class NesterovATestTaskMPI : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskMPI : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_processes_3 +} // namespace example_processes_t3 diff --git a/tasks/example/processes/t3/mpi/report.md b/tasks/example/processes/t3/mpi/report.md new file mode 100644 index 000000000..be49f9579 --- /dev/null +++ b/tasks/example/processes/t3/mpi/report.md @@ -0,0 +1,3 @@ +# Example Processes T3 MPI + +MPI implementation for process example task T3. diff --git a/tasks/example_processes_2/mpi/src/ops_mpi.cpp b/tasks/example/processes/t3/mpi/src/ops_mpi.cpp similarity index 87% rename from tasks/example_processes_2/mpi/src/ops_mpi.cpp rename to tasks/example/processes/t3/mpi/src/ops_mpi.cpp index d3570f350..6dc99e99e 100644 --- a/tasks/example_processes_2/mpi/src/ops_mpi.cpp +++ b/tasks/example/processes/t3/mpi/src/ops_mpi.cpp @@ -1,14 +1,14 @@ -#include "example_processes_2/mpi/include/ops_mpi.hpp" +#include "example/processes/t3/mpi/include/ops_mpi.hpp" #include #include #include -#include "example_processes_2/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes_2 { +namespace example_processes_t3 { NesterovATestTaskMPI::NesterovATestTaskMPI(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -69,4 +69,4 @@ bool NesterovATestTaskMPI::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_processes_2 +} // namespace example_processes_t3 diff --git a/tasks/example/processes/t3/report.md b/tasks/example/processes/t3/report.md new file mode 100644 index 000000000..74925a018 --- /dev/null +++ b/tasks/example/processes/t3/report.md @@ -0,0 +1,8 @@ +# Example Processes T3 + +Third process example task. + +Child reports: + +- `seq/report.md` +- `mpi/report.md` diff --git a/tasks/example_processes_3/seq/include/ops_seq.hpp b/tasks/example/processes/t3/seq/include/ops_seq.hpp similarity index 73% rename from tasks/example_processes_3/seq/include/ops_seq.hpp rename to tasks/example/processes/t3/seq/include/ops_seq.hpp index df27f2273..3591bb1cf 100644 --- a/tasks/example_processes_3/seq/include/ops_seq.hpp +++ b/tasks/example/processes/t3/seq/include/ops_seq.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_processes_3/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_processes_3 { +namespace example_processes_t3 { class NesterovATestTaskSEQ : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskSEQ : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_processes_3 +} // namespace example_processes_t3 diff --git a/tasks/example/processes/t3/seq/report.md b/tasks/example/processes/t3/seq/report.md new file mode 100644 index 000000000..2d526ea71 --- /dev/null +++ b/tasks/example/processes/t3/seq/report.md @@ -0,0 +1,3 @@ +# Example Processes T3 Seq + +Sequential baseline for process example task T3. diff --git a/tasks/example_processes_2/seq/src/ops_seq.cpp b/tasks/example/processes/t3/seq/src/ops_seq.cpp similarity index 85% rename from tasks/example_processes_2/seq/src/ops_seq.cpp rename to tasks/example/processes/t3/seq/src/ops_seq.cpp index ea4a0c629..91b89b399 100644 --- a/tasks/example_processes_2/seq/src/ops_seq.cpp +++ b/tasks/example/processes/t3/seq/src/ops_seq.cpp @@ -1,12 +1,12 @@ -#include "example_processes_2/seq/include/ops_seq.hpp" +#include "example/processes/t3/seq/include/ops_seq.hpp" #include #include -#include "example_processes_2/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes_2 { +namespace example_processes_t3 { NesterovATestTaskSEQ::NesterovATestTaskSEQ(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -57,4 +57,4 @@ bool NesterovATestTaskSEQ::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_processes_2 +} // namespace example_processes_t3 diff --git a/tasks/example_processes_3/tests/.clang-tidy b/tasks/example/processes/t3/tests/.clang-tidy similarity index 100% rename from tasks/example_processes_3/tests/.clang-tidy rename to tasks/example/processes/t3/tests/.clang-tidy diff --git a/tasks/example_processes_3/tests/functional/main.cpp b/tasks/example/processes/t3/tests/functional/main.cpp similarity index 80% rename from tasks/example_processes_3/tests/functional/main.cpp rename to tasks/example/processes/t3/tests/functional/main.cpp index e1e3675e5..02672a54a 100644 --- a/tasks/example_processes_3/tests/functional/main.cpp +++ b/tasks/example/processes/t3/tests/functional/main.cpp @@ -12,13 +12,13 @@ #include #include -#include "example_processes_3/common/include/common.hpp" -#include "example_processes_3/mpi/include/ops_mpi.hpp" -#include "example_processes_3/seq/include/ops_seq.hpp" +#include "example/common/include/common.hpp" +#include "example/processes/t3/mpi/include/ops_mpi.hpp" +#include "example/processes/t3/seq/include/ops_seq.hpp" #include "util/include/func_test_util.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes_3 { +namespace example_processes_t3 { class NesterovARunFuncTestsProcesses3 : public ppc::util::BaseRunFuncTests { public: @@ -45,7 +45,7 @@ class NesterovARunFuncTestsProcesses3 : public ppc::util::BaseRunFuncTests img; // Read image in RGB to ensure consistent channel count { - std::string abs_path = ppc::util::GetAbsoluteTaskPath(PPC_ID_example_processes_3, "pic.ppm"); + std::string abs_path = ppc::util::GetAbsoluteTaskPath(PPC_ID_example, "pic.ppm"); auto *data = stbi_load(abs_path.c_str(), &width, &height, &channels, STBI_rgb); if (data == nullptr) { throw std::runtime_error("Failed to load image: " + std::string(stbi_failure_reason())); @@ -77,9 +77,9 @@ namespace { const std::array kTestParam = {std::make_tuple(3, "3"), std::make_tuple(5, "5"), std::make_tuple(7, "7")}; -const auto kTestTasksList = - std::tuple_cat(ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_processes_3), - ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_processes_3)); +const auto kTestTasksList = std::tuple_cat( + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "processes.t3"), + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "processes.t3")); } // namespace @@ -87,4 +87,4 @@ TEST_F(NesterovARunFuncTestsProcesses3, MatmulFromPic) { std::apply([this](const auto &...test_params) { (RunTestCase(test_params), ...); }, kTestTasksList); } -} // namespace nesterov_a_test_task_processes_3 +} // namespace example_processes_t3 diff --git a/tasks/example_processes_3/tests/performance/main.cpp b/tasks/example/processes/t3/tests/performance/main.cpp similarity index 61% rename from tasks/example_processes_3/tests/performance/main.cpp rename to tasks/example/processes/t3/tests/performance/main.cpp index a50ec2736..42e3c6e95 100644 --- a/tasks/example_processes_3/tests/performance/main.cpp +++ b/tasks/example/processes/t3/tests/performance/main.cpp @@ -2,12 +2,12 @@ #include -#include "example_processes_3/common/include/common.hpp" -#include "example_processes_3/mpi/include/ops_mpi.hpp" -#include "example_processes_3/seq/include/ops_seq.hpp" +#include "example/common/include/common.hpp" +#include "example/processes/t3/mpi/include/ops_mpi.hpp" +#include "example/processes/t3/seq/include/ops_seq.hpp" #include "util/include/perf_test_util.hpp" -namespace nesterov_a_test_task_processes_3 { +namespace example_processes_t3 { class ExampleRunPerfTestProcesses3 : public ppc::util::BaseRunPerfTests { protected: @@ -28,11 +28,11 @@ class ExampleRunPerfTestProcesses3 : public ppc::util::BaseRunPerfTests(PPC_SETTINGS_example_processes_3); +const auto kAllPerfTasks = ppc::util::MakeAllPerfTasks( + PPC_SETTINGS_example, "processes.t3"); TEST_F(ExampleRunPerfTestProcesses3, RunPerfModes) { std::apply([this](const auto &...test_params) { (ExecuteTest(test_params), ...); }, kAllPerfTasks); } -} // namespace nesterov_a_test_task_processes_3 +} // namespace example_processes_t3 diff --git a/tasks/example/report.md b/tasks/example/report.md new file mode 100644 index 000000000..9a7d7f828 --- /dev/null +++ b/tasks/example/report.md @@ -0,0 +1,3 @@ +# Example Task + +This task contains the shared example implementations for threads and processes. diff --git a/tasks/example/settings.json b/tasks/example/settings.json new file mode 100644 index 000000000..c89c5817b --- /dev/null +++ b/tasks/example/settings.json @@ -0,0 +1,25 @@ +{ + "tasks": { + "processes": { + "t1": { + "mpi": "enabled", + "seq": "enabled" + }, + "t2": { + "mpi": "enabled", + "seq": "enabled" + }, + "t3": { + "mpi": "enabled", + "seq": "enabled" + } + }, + "threads": { + "all": "enabled", + "omp": "enabled", + "seq": "enabled", + "stl": "enabled", + "tbb": "enabled" + } + } +} diff --git a/tasks/example_threads/all/include/ops_all.hpp b/tasks/example/threads/all/include/ops_all.hpp similarity index 75% rename from tasks/example_threads/all/include/ops_all.hpp rename to tasks/example/threads/all/include/ops_all.hpp index d4638d337..8de651fc6 100644 --- a/tasks/example_threads/all/include/ops_all.hpp +++ b/tasks/example/threads/all/include/ops_all.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { class NesterovATestTaskALL : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskALL : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example/threads/all/report.md b/tasks/example/threads/all/report.md new file mode 100644 index 000000000..a88b49a2e --- /dev/null +++ b/tasks/example/threads/all/report.md @@ -0,0 +1,3 @@ +# Example Threads All + +Combined implementation for the thread-based example. diff --git a/tasks/example_threads/all/src/ops_all.cpp b/tasks/example/threads/all/src/ops_all.cpp similarity index 90% rename from tasks/example_threads/all/src/ops_all.cpp rename to tasks/example/threads/all/src/ops_all.cpp index 2f6995878..ec36fb726 100644 --- a/tasks/example_threads/all/src/ops_all.cpp +++ b/tasks/example/threads/all/src/ops_all.cpp @@ -1,4 +1,4 @@ -#include "example_threads/all/include/ops_all.hpp" +#include "example/threads/all/include/ops_all.hpp" #include @@ -7,11 +7,11 @@ #include #include -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "oneapi/tbb/parallel_for.h" #include "util/include/util.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { NesterovATestTaskALL::NesterovATestTaskALL(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -82,4 +82,4 @@ bool NesterovATestTaskALL::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example_threads/omp/include/ops_omp.hpp b/tasks/example/threads/omp/include/ops_omp.hpp similarity index 75% rename from tasks/example_threads/omp/include/ops_omp.hpp rename to tasks/example/threads/omp/include/ops_omp.hpp index 2e857114e..cb99081fe 100644 --- a/tasks/example_threads/omp/include/ops_omp.hpp +++ b/tasks/example/threads/omp/include/ops_omp.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { class NesterovATestTaskOMP : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskOMP : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example/threads/omp/report.md b/tasks/example/threads/omp/report.md new file mode 100644 index 000000000..529ee371f --- /dev/null +++ b/tasks/example/threads/omp/report.md @@ -0,0 +1,3 @@ +# Example Threads OMP + +OpenMP implementation for the thread-based example. diff --git a/tasks/example_threads/omp/src/ops_omp.cpp b/tasks/example/threads/omp/src/ops_omp.cpp similarity index 86% rename from tasks/example_threads/omp/src/ops_omp.cpp rename to tasks/example/threads/omp/src/ops_omp.cpp index 63c16a9f6..c06c01a22 100644 --- a/tasks/example_threads/omp/src/ops_omp.cpp +++ b/tasks/example/threads/omp/src/ops_omp.cpp @@ -1,13 +1,13 @@ -#include "example_threads/omp/include/ops_omp.hpp" +#include "example/threads/omp/include/ops_omp.hpp" #include #include #include -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { NesterovATestTaskOMP::NesterovATestTaskOMP(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -51,4 +51,4 @@ bool NesterovATestTaskOMP::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example/threads/report.md b/tasks/example/threads/report.md new file mode 100644 index 000000000..0c918948c --- /dev/null +++ b/tasks/example/threads/report.md @@ -0,0 +1,11 @@ +# Example Threads + +This section aggregates the thread-based example implementations. + +Child reports: + +- `seq/report.md` +- `omp/report.md` +- `tbb/report.md` +- `stl/report.md` +- `all/report.md` diff --git a/tasks/example_processes_2/seq/include/ops_seq.hpp b/tasks/example/threads/seq/include/ops_seq.hpp similarity index 73% rename from tasks/example_processes_2/seq/include/ops_seq.hpp rename to tasks/example/threads/seq/include/ops_seq.hpp index 33e2311bf..1fc6d383b 100644 --- a/tasks/example_processes_2/seq/include/ops_seq.hpp +++ b/tasks/example/threads/seq/include/ops_seq.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_processes_2/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_processes_2 { +namespace example_threads { class NesterovATestTaskSEQ : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskSEQ : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_processes_2 +} // namespace example_threads diff --git a/tasks/example/threads/seq/report.md b/tasks/example/threads/seq/report.md new file mode 100644 index 000000000..7dcc61a2a --- /dev/null +++ b/tasks/example/threads/seq/report.md @@ -0,0 +1,3 @@ +# Example Threads Seq + +Sequential baseline for the thread-based example. diff --git a/tasks/example_processes_3/seq/src/ops_seq.cpp b/tasks/example/threads/seq/src/ops_seq.cpp similarity index 85% rename from tasks/example_processes_3/seq/src/ops_seq.cpp rename to tasks/example/threads/seq/src/ops_seq.cpp index 1db5c7340..7198ba1ae 100644 --- a/tasks/example_processes_3/seq/src/ops_seq.cpp +++ b/tasks/example/threads/seq/src/ops_seq.cpp @@ -1,12 +1,12 @@ -#include "example_processes_3/seq/include/ops_seq.hpp" +#include "example/threads/seq/include/ops_seq.hpp" #include #include -#include "example_processes_3/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_processes_3 { +namespace example_threads { NesterovATestTaskSEQ::NesterovATestTaskSEQ(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -57,4 +57,4 @@ bool NesterovATestTaskSEQ::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_processes_3 +} // namespace example_threads diff --git a/tasks/example_threads/stl/include/ops_stl.hpp b/tasks/example/threads/stl/include/ops_stl.hpp similarity index 75% rename from tasks/example_threads/stl/include/ops_stl.hpp rename to tasks/example/threads/stl/include/ops_stl.hpp index fb153a3e0..38dd6fd22 100644 --- a/tasks/example_threads/stl/include/ops_stl.hpp +++ b/tasks/example/threads/stl/include/ops_stl.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { class NesterovATestTaskSTL : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskSTL : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example/threads/stl/report.md b/tasks/example/threads/stl/report.md new file mode 100644 index 000000000..bb74545c2 --- /dev/null +++ b/tasks/example/threads/stl/report.md @@ -0,0 +1,3 @@ +# Example Threads STL + +STL threads implementation for the thread-based example. diff --git a/tasks/example_threads/stl/src/ops_stl.cpp b/tasks/example/threads/stl/src/ops_stl.cpp similarity index 86% rename from tasks/example_threads/stl/src/ops_stl.cpp rename to tasks/example/threads/stl/src/ops_stl.cpp index 1dcf1201d..da2e29c47 100644 --- a/tasks/example_threads/stl/src/ops_stl.cpp +++ b/tasks/example/threads/stl/src/ops_stl.cpp @@ -1,14 +1,14 @@ -#include "example_threads/stl/include/ops_stl.hpp" +#include "example/threads/stl/include/ops_stl.hpp" #include #include #include #include -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { NesterovATestTaskSTL::NesterovATestTaskSTL(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -55,4 +55,4 @@ bool NesterovATestTaskSTL::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example_threads/tbb/include/ops_tbb.hpp b/tasks/example/threads/tbb/include/ops_tbb.hpp similarity index 75% rename from tasks/example_threads/tbb/include/ops_tbb.hpp rename to tasks/example/threads/tbb/include/ops_tbb.hpp index c6160094c..24bc12c68 100644 --- a/tasks/example_threads/tbb/include/ops_tbb.hpp +++ b/tasks/example/threads/tbb/include/ops_tbb.hpp @@ -1,9 +1,9 @@ #pragma once -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "task/include/task.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { class NesterovATestTaskTBB : public BaseTask { public: @@ -19,4 +19,4 @@ class NesterovATestTaskTBB : public BaseTask { bool PostProcessingImpl() override; }; -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example/threads/tbb/report.md b/tasks/example/threads/tbb/report.md new file mode 100644 index 000000000..6ce972719 --- /dev/null +++ b/tasks/example/threads/tbb/report.md @@ -0,0 +1,3 @@ +# Example Threads TBB + +TBB implementation for the thread-based example. diff --git a/tasks/example_threads/tbb/src/ops_tbb.cpp b/tasks/example/threads/tbb/src/ops_tbb.cpp similarity index 86% rename from tasks/example_threads/tbb/src/ops_tbb.cpp rename to tasks/example/threads/tbb/src/ops_tbb.cpp index 1d606b8df..49cc425cf 100644 --- a/tasks/example_threads/tbb/src/ops_tbb.cpp +++ b/tasks/example/threads/tbb/src/ops_tbb.cpp @@ -1,4 +1,4 @@ -#include "example_threads/tbb/include/ops_tbb.hpp" +#include "example/threads/tbb/include/ops_tbb.hpp" #include @@ -7,10 +7,10 @@ #include #include -#include "example_threads/common/include/common.hpp" +#include "example/common/include/common.hpp" #include "oneapi/tbb/parallel_for.h" -namespace nesterov_a_test_task_threads { +namespace example_threads { NesterovATestTaskTBB::NesterovATestTaskTBB(const InType &in) { SetTypeOfTask(GetStaticTypeOfTask()); @@ -53,4 +53,4 @@ bool NesterovATestTaskTBB::PostProcessingImpl() { return GetOutput() > 0; } -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example_threads/tests/.clang-tidy b/tasks/example/threads/tests/.clang-tidy similarity index 100% rename from tasks/example_threads/tests/.clang-tidy rename to tasks/example/threads/tests/.clang-tidy diff --git a/tasks/example_threads/tests/functional/main.cpp b/tasks/example/threads/tests/functional/main.cpp similarity index 79% rename from tasks/example_threads/tests/functional/main.cpp rename to tasks/example/threads/tests/functional/main.cpp index 6cee61ab4..1ae1ff426 100644 --- a/tasks/example_threads/tests/functional/main.cpp +++ b/tasks/example/threads/tests/functional/main.cpp @@ -12,16 +12,16 @@ #include #include -#include "example_threads/all/include/ops_all.hpp" -#include "example_threads/common/include/common.hpp" -#include "example_threads/omp/include/ops_omp.hpp" -#include "example_threads/seq/include/ops_seq.hpp" -#include "example_threads/stl/include/ops_stl.hpp" -#include "example_threads/tbb/include/ops_tbb.hpp" +#include "example/common/include/common.hpp" +#include "example/threads/all/include/ops_all.hpp" +#include "example/threads/omp/include/ops_omp.hpp" +#include "example/threads/seq/include/ops_seq.hpp" +#include "example/threads/stl/include/ops_stl.hpp" +#include "example/threads/tbb/include/ops_tbb.hpp" #include "util/include/func_test_util.hpp" #include "util/include/util.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { class NesterovARunFuncTestsThreads : public ppc::util::BaseRunFuncTests { public: @@ -48,7 +48,7 @@ class NesterovARunFuncTestsThreads : public ppc::util::BaseRunFuncTests img; // Read image in RGB to ensure consistent channel count { - std::string abs_path = ppc::util::GetAbsoluteTaskPath(std::string(PPC_ID_example_threads), "pic.ppm"); + std::string abs_path = ppc::util::GetAbsoluteTaskPath(std::string(PPC_ID_example), "pic.ppm"); auto *data = stbi_load(abs_path.c_str(), &width, &height, &channels, STBI_rgb); if (data == nullptr) { throw std::runtime_error("Failed to load image: " + std::string(stbi_failure_reason())); @@ -81,11 +81,11 @@ namespace { const std::array kTestParam = {std::make_tuple(3, "3"), std::make_tuple(5, "5"), std::make_tuple(7, "7")}; const auto kTestTasksList = - std::tuple_cat(ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_threads), - ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_threads), - ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_threads), - ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_threads), - ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example_threads)); + std::tuple_cat(ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "threads"), + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "threads"), + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "threads"), + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "threads"), + ppc::util::AddFuncTask(kTestParam, PPC_SETTINGS_example, "threads")); } // namespace @@ -93,4 +93,4 @@ TEST_F(NesterovARunFuncTestsThreads, MatmulFromPic) { std::apply([this](const auto &...test_params) { (RunTestCase(test_params), ...); }, kTestTasksList); } -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example_threads/tests/performance/main.cpp b/tasks/example/threads/tests/performance/main.cpp similarity index 66% rename from tasks/example_threads/tests/performance/main.cpp rename to tasks/example/threads/tests/performance/main.cpp index ee84bc2de..82ea9356d 100644 --- a/tasks/example_threads/tests/performance/main.cpp +++ b/tasks/example/threads/tests/performance/main.cpp @@ -2,15 +2,15 @@ #include -#include "example_threads/all/include/ops_all.hpp" -#include "example_threads/common/include/common.hpp" -#include "example_threads/omp/include/ops_omp.hpp" -#include "example_threads/seq/include/ops_seq.hpp" -#include "example_threads/stl/include/ops_stl.hpp" -#include "example_threads/tbb/include/ops_tbb.hpp" +#include "example/common/include/common.hpp" +#include "example/threads/all/include/ops_all.hpp" +#include "example/threads/omp/include/ops_omp.hpp" +#include "example/threads/seq/include/ops_seq.hpp" +#include "example/threads/stl/include/ops_stl.hpp" +#include "example/threads/tbb/include/ops_tbb.hpp" #include "util/include/perf_test_util.hpp" -namespace nesterov_a_test_task_threads { +namespace example_threads { class ExampleRunPerfTestThreads : public ppc::util::BaseRunPerfTests { protected: @@ -35,7 +35,7 @@ namespace { const auto kAllPerfTasks = ppc::util::MakeAllPerfTasks(PPC_SETTINGS_example_threads); + NesterovATestTaskSTL, NesterovATestTaskTBB>(PPC_SETTINGS_example, "threads"); } // namespace @@ -43,4 +43,4 @@ TEST_F(ExampleRunPerfTestThreads, RunPerfModes) { std::apply([this](const auto &...test_params) { (ExecuteTest(test_params), ...); }, kAllPerfTasks); } -} // namespace nesterov_a_test_task_threads +} // namespace example_threads diff --git a/tasks/example_processes/common/include/common.hpp b/tasks/example_processes/common/include/common.hpp deleted file mode 100644 index 127d96c4c..000000000 --- a/tasks/example_processes/common/include/common.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -#include "task/include/task.hpp" - -namespace nesterov_a_test_task_processes { - -using InType = int; -using OutType = int; -using TestType = std::tuple; -using BaseTask = ppc::task::Task; - -} // namespace nesterov_a_test_task_processes diff --git a/tasks/example_processes/info.json b/tasks/example_processes/info.json deleted file mode 100644 index 265b20e50..000000000 --- a/tasks/example_processes/info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "student": { - "full_name": "full_name_p", - "group_number": "2222222_p", - "task_number": "1" - } -} diff --git a/tasks/example_processes/report.md b/tasks/example_processes/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_processes/settings.json b/tasks/example_processes/settings.json deleted file mode 100644 index 16f25e426..000000000 --- a/tasks/example_processes/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "tasks": { - "mpi": "enabled", - "seq": "enabled" - }, - "tasks_type": "processes" -} diff --git a/tasks/example_processes_2/common/include/common.hpp b/tasks/example_processes_2/common/include/common.hpp deleted file mode 100644 index 145054df0..000000000 --- a/tasks/example_processes_2/common/include/common.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -#include "task/include/task.hpp" - -namespace nesterov_a_test_task_processes_2 { - -using InType = int; -using OutType = int; -using TestType = std::tuple; -using BaseTask = ppc::task::Task; - -} // namespace nesterov_a_test_task_processes_2 diff --git a/tasks/example_processes_2/data/pic.ppm b/tasks/example_processes_2/data/pic.ppm deleted file mode 100644 index 637624238..000000000 Binary files a/tasks/example_processes_2/data/pic.ppm and /dev/null differ diff --git a/tasks/example_processes_2/info.json b/tasks/example_processes_2/info.json deleted file mode 100644 index 788722ab0..000000000 --- a/tasks/example_processes_2/info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "student": { - "full_name": "full_name_p", - "group_number": "2222222_p", - "task_number": "2" - } -} diff --git a/tasks/example_processes_2/report.md b/tasks/example_processes_2/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_processes_2/settings.json b/tasks/example_processes_2/settings.json deleted file mode 100644 index 16f25e426..000000000 --- a/tasks/example_processes_2/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "tasks": { - "mpi": "enabled", - "seq": "enabled" - }, - "tasks_type": "processes" -} diff --git a/tasks/example_processes_3/common/include/common.hpp b/tasks/example_processes_3/common/include/common.hpp deleted file mode 100644 index ac343ab8f..000000000 --- a/tasks/example_processes_3/common/include/common.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -#include "task/include/task.hpp" - -namespace nesterov_a_test_task_processes_3 { - -using InType = int; -using OutType = int; -using TestType = std::tuple; -using BaseTask = ppc::task::Task; - -} // namespace nesterov_a_test_task_processes_3 diff --git a/tasks/example_processes_3/data/pic.ppm b/tasks/example_processes_3/data/pic.ppm deleted file mode 100644 index 637624238..000000000 Binary files a/tasks/example_processes_3/data/pic.ppm and /dev/null differ diff --git a/tasks/example_processes_3/info.json b/tasks/example_processes_3/info.json deleted file mode 100644 index 69c8619ff..000000000 --- a/tasks/example_processes_3/info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "student": { - "full_name": "full_name_p", - "group_number": "2222222_p", - "task_number": "3" - } -} diff --git a/tasks/example_processes_3/report.md b/tasks/example_processes_3/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_processes_3/settings.json b/tasks/example_processes_3/settings.json deleted file mode 100644 index 16f25e426..000000000 --- a/tasks/example_processes_3/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "tasks": { - "mpi": "enabled", - "seq": "enabled" - }, - "tasks_type": "processes" -} diff --git a/tasks/example_threads/all/report.md b/tasks/example_threads/all/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_threads/common/include/common.hpp b/tasks/example_threads/common/include/common.hpp deleted file mode 100644 index f75fe1779..000000000 --- a/tasks/example_threads/common/include/common.hpp +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#include -#include - -#include "task/include/task.hpp" - -namespace nesterov_a_test_task_threads { - -using InType = int; -using OutType = int; -using TestType = std::tuple; -using BaseTask = ppc::task::Task; - -} // namespace nesterov_a_test_task_threads diff --git a/tasks/example_threads/data/pic.ppm b/tasks/example_threads/data/pic.ppm deleted file mode 100644 index 637624238..000000000 Binary files a/tasks/example_threads/data/pic.ppm and /dev/null differ diff --git a/tasks/example_threads/info.json b/tasks/example_threads/info.json deleted file mode 100644 index d46b81143..000000000 --- a/tasks/example_threads/info.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "student": { - "full_name": "full_name_t", - "group_number": "2222222_t", - "task_number": "1" - } -} diff --git a/tasks/example_threads/omp/report.md b/tasks/example_threads/omp/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_threads/report.md b/tasks/example_threads/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_threads/seq/report.md b/tasks/example_threads/seq/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_threads/settings.json b/tasks/example_threads/settings.json deleted file mode 100644 index 0be0208fc..000000000 --- a/tasks/example_threads/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "tasks": { - "all": "enabled", - "omp": "enabled", - "seq": "enabled", - "stl": "enabled", - "tbb": "enabled" - }, - "tasks_type": "threads" -} diff --git a/tasks/example_threads/stl/report.md b/tasks/example_threads/stl/report.md deleted file mode 100644 index e69de29bb..000000000 diff --git a/tasks/example_threads/tbb/report.md b/tasks/example_threads/tbb/report.md deleted file mode 100644 index e69de29bb..000000000