Справочник API

Модуль выполнения

namespace runners

Функции

int Init(int argc, char **argv)

Initializes the testing environment (e.g., MPI, logging).

Параметры:
  • argc – Argument count.

  • argv – Argument vector.

Результат:

Exit code from RUN_ALL_TESTS or MPI error code if initialization/ finalization fails.

int SimpleInit(int argc, char **argv)

Initializes the testing environment only for gtest.

Параметры:
  • argc – Argument count.

  • argv – Argument vector.

Результат:

Exit code from RUN_ALL_TESTS.

class UnreadMessagesDetector : public testing::EmptyTestEventListener
#include <runners.hpp>

GTest event listener that checks for unread MPI messages after each test.

Примечание

Used to detect unexpected inter-process communication leftovers.

class WorkerTestFailurePrinter : public testing::EmptyTestEventListener
#include <runners.hpp>

GTest event listener that prints additional information on test failures in worker processes.

Includes MPI rank info in failure output for debugging.

Модуль задач

namespace task

Псевдонимы типов

using TaskMapping = std::pair<TypeOfTask, std::string_view>
using TaskMappingArray = std::array<TaskMapping, 6>
template<typename InType, typename OutType>
using TaskPtr = std::unique_ptr<Task<InType, OutType>>

Smart pointer alias for Task.

Параметры шаблона:
  • InType – Input data type.

  • OutType – Output data type.

Перечисления

enum class TypeOfTask : uint8_t

Represents the type of task (parallelization technology).

Used to select the implementation type in tests and execution logic.

Values:

enumerator kALL

Use all available implementations.

enumerator kMPI

MPI (Message Passing Interface).

enumerator kOMP

OpenMP (Open Multi-Processing).

enumerator kSEQ

Sequential implementation.

enumerator kSTL

Standard Thread Library (STL threads).

enumerator kTBB

Intel Threading Building Blocks (TBB).

enumerator kUnknown

Unknown task type.

enum class StatusOfTask : uint8_t

Indicates whether a task is enabled or disabled.

Values:

enumerator kEnabled

Task is enabled and should be executed.

enumerator kDisabled

Task is disabled and will be skipped.

enum class TaskCategory : uint8_t

Values:

enumerator kUnknown
enumerator kThreads
enumerator kProcesses
enum class StateOfTesting : uint8_t

Values:

enumerator kFunc
enumerator kPerf

Функции

std::string_view TypeOfTaskToString(TypeOfTask type)
TypeOfTask TypeOfTaskFromString(std::string_view type)
std::string_view StatusOfTaskToString(StatusOfTask status_of_task)
inline StatusOfTask StatusOfTaskFromString(std::string_view status_of_task)
inline std::string GetStringTaskStatus(StatusOfTask status_of_task)

Returns a string representation of the task status.

Параметры:

status_of_taskTask status (enabled or disabled).

Результат:

«enabled» if the task is enabled, otherwise «disabled».

std::string_view TaskCategoryToString(TaskCategory category)
TaskCategory TaskCategoryFromSettingsPath(std::string_view settings_task_path)
inline StatusOfTask GetTaskStatus(TypeOfTask type_of_task, const std::string &settings_file_path, std::string_view settings_task_path = {})

Returns a string representation of the task type based on the JSON settings file.

Параметры:
  • type_of_task – Type of the task.

  • settings_file_path – Path to the JSON file containing task type strings.

  • settings_task_path – Optional dot-separated nested path inside the tasks object.

Бросает исключение:

std::runtime_error – If the file cannot be opened or the requested settings key is missing.

Результат:

Formatted string combining the task type and its corresponding value from the file.

inline std::string GetStringTaskType(TypeOfTask type_of_task, const std::string &settings_file_path, std::string_view settings_task_path = {})
template<typename TaskType, typename InType>
std::unique_ptr<TaskType> TaskGetter(const InType &in)

Constructs and returns a pointer to a task with the given input.

Параметры шаблона:
  • TaskType – Type of the task to create.

  • InType – Type of the input.

Параметры:

in – Input to pass to the task constructor.

Результат:

Unique pointer to the newly created task.

Переменные

TaskMappingArray kTaskTypeMappings = {{{TypeOfTask::kALL, "all"}, {TypeOfTask::kMPI, "mpi"}, {TypeOfTask::kOMP, "omp"}, {TypeOfTask::kSEQ, "seq"}, {TypeOfTask::kSTL, "stl"}, {TypeOfTask::kTBB, "tbb"}}}
struct TaskDescriptor
#include <task.hpp>
template<typename InType, typename OutType>
class Task
#include <task.hpp>

Base abstract class representing a generic task with a defined pipeline.

Параметры шаблона:
  • InType – Input data type.

  • OutType – Output data type.

Вспомогательный модуль (модуль с утилитами)

namespace util

Псевдонимы типов

template<typename InType, typename OutType, typename TestType = void>
using FuncTestParam = std::tuple<std::function<ppc::task::TaskPtr<InType, OutType>(InType)>, std::string, TestType, ppc::task::TaskDescriptor>
template<typename InType, typename OutType, typename TestType = void>
using GTestFuncParam = ::testing::TestParamInfo<FuncTestParam<InType, OutType, TestType>>
template<typename InType, typename OutType>
using PerfTestParam = std::tuple<std::function<ppc::task::TaskPtr<InType, OutType>(InType)>, std::string, ppc::task::TaskCategory, ppc::task::TaskDescriptor>

Перечисления

enum class GTestParamIndex : uint8_t

Values:

enumerator kTaskGetter
enumerator kNameTest
enumerator kTestParams
enumerator kTaskDescriptor

Функции

template<typename TestTasksList, typename RunTestCase>
void RunTestCasesWithTag(const TestTasksList &test_tasks_list, std::string_view task_tag, RunTestCase run_test_case)
template<typename Tuple, std::size_t... Is>
auto ExpandToValuesImpl(const Tuple &t, std::index_sequence<Is...>)
template<typename Tuple>
auto ExpandToValues(const Tuple &t)
template<typename Task, typename InType, typename SizesContainer, std::size_t... Is>
auto GenTaskTuplesImpl(const SizesContainer &sizes, const std::string &settings_path, std::string_view settings_task_path, std::index_sequence<Is...>)
template<typename Task, typename InType, typename SizesContainer>
auto TaskListGenerator(const SizesContainer &sizes, const std::string &settings_path, std::string_view settings_task_path = {})
template<typename Task, typename InType, typename SizesContainer>
auto AddFuncTask(const SizesContainer &sizes, const std::string &settings_path, std::string_view settings_task_path = {})
inline double DefaultTimer()
template<typename TaskType, typename InputType>
auto MakePerfTaskTuples(const std::string &settings_path, std::string_view settings_task_path = {})
template<typename Tuple, std::size_t... I>
auto TupleToGTestValuesImpl(const Tuple &tup, std::index_sequence<I...>)
template<typename Tuple>
auto TupleToGTestValues(Tuple &&tup)
template<typename InputType, typename ...TaskTypes>
auto MakeAllPerfTasks(const std::string &settings_path, std::string_view settings_task_path = {})
inline ppc::task::TaskDescriptor MakeTaskDescriptor(std::string_view task_namespace, ppc::task::TypeOfTask task_type, const std::string &settings_path, std::string_view settings_task_path = {})
template<typename TestParam>
const ppc::task::TaskDescriptor &GetTaskDescriptor(const TestParam &test_param)
inline bool IsMpiTaskType(ppc::task::TypeOfTask type)
std::string GetAbsoluteTaskPath(const std::string &id_path, const std::string &relative_path)
int GetNumThreads()
int GetNumProc()
double GetTaskMaxTime()
double GetPerfMaxTime()
double GetTimeMPI()
int GetMPIRank()
void ConfigureMpiEnvironment()
void SynchronizeMpiRanks()
template<typename T>
std::string GetNamespace()
inline std::shared_ptr<nlohmann::json> InitJSONPtr()
bool IsUnderMpirun()
template<typename InType, typename OutType, typename TestType = void>
class BaseRunFuncTests : public testing::TestWithParam<FuncTestParam<InType, OutType, void>>
#include <func_test_util.hpp>

Base class for running functional tests on parallel tasks.

Параметры шаблона:
  • InType – Type of input data.

  • OutType – Type of output data.

  • TestType – Type of the test case or parameter.

struct PerfAttr
#include <perf_test_util.hpp>
template<typename InType, typename OutType>
class BaseRunPerfTests : public testing::TestWithParam<PerfTestParam<InType, OutType>>
#include <perf_test_util.hpp>

Base class for performance testing of parallel tasks.

Параметры шаблона:
  • InType – Input data type.

  • OutType – Output data type.

class DestructorFailureFlag
#include <util.hpp>

Utility class for tracking destructor failure across tests.

Provides thread-safe methods to set, unset, and check the failure flag.

class PerformanceFailureFlag
#include <util.hpp>
namespace detail

Функции

inline ppc::task::TypeOfTask TaskTypeFromFuncTestTag(std::string_view task_tag)
inline bool ContainsDescriptorToken(std::string_view filter, std::string_view descriptor_token)
inline bool ShouldRunBenchmark(const ppc::task::TaskDescriptor &descriptor)
template<typename InType, typename OutType>
void RunTaskForValidation(const ppc::task::TaskPtr<InType, OutType> &task)
inline std::function<double()> MakeTechnologyTimer(ppc::task::TypeOfTask task_type)
inline double MaxElapsedTimeAcrossMpiRanks(double elapsed, ppc::task::TypeOfTask task_type)
inline void SkipBenchmarkWithError(benchmark::State &state, const char *message) noexcept
inline void CheckPerfTimeLimit(double elapsed)
template<typename InType, typename OutType>
double RunTaskForBenchmark(const ppc::task::TaskPtr<InType, OutType> &task)
template<typename TaskGetter, typename InType>
void RunBenchmarkBody(const TaskGetter &task_getter, const InType &input_data, const std::string &test_env_token, benchmark::State &state) noexcept
template<typename TaskGetter, typename InType>
class BenchmarkTaskBody
#include <perf_test_util.hpp>
namespace test

Функции

inline std::string SanitizeToken(std::string_view token_sv)
inline std::string MakeCurrentGTestToken(std::string_view fallback_name)
inline ScopedPerTestEnv MakePerTestEnvForCurrentGTest(std::string_view fallback_name)
class ScopedPerTestEnv
#include <util.hpp>