Skip to content

Commit 415c957

Browse files
authored
Final state of scoreboard (#647)
<!-- Solution for PR template choice: https://stackoverflow.com/a/75030350/24543008 --> Please go to the `Preview` tab and select the appropriate template: * [Submit Student task (English)](?expand=1&template=task_submission_en.md) * [Submit Student task (Russian)](?expand=1&template=task_submission_ru.md)
1 parent 94272d1 commit 415c957

File tree

68 files changed

+1894
-240
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1894
-240
lines changed

modules/performance/include/performance.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ template <typename InType, typename OutType>
3939
class Perf {
4040
public:
4141
// Init performance analysis with an initialized task and initialized data
42-
explicit Perf(const ppc::task::TaskPtr<InType, OutType>& task_ptr) : task_(task_ptr) {
42+
explicit Perf(const ppc::task::TaskPtr<InType, OutType> &task_ptr) : task_(task_ptr) {
4343
task_ptr->GetStateOfTesting() = ppc::task::StateOfTesting::kPerf;
4444
}
4545
// Check performance of full task's pipeline: PreProcessing() ->
4646
// Validation() -> Run() -> PostProcessing()
47-
void PipelineRun(const PerfAttr& perf_attr) {
47+
void PipelineRun(const PerfAttr &perf_attr) {
4848
perf_results_.type_of_running = PerfResults::TypeOfRunning::kPipeline;
4949

5050
CommonRun(perf_attr, [&] {
@@ -55,7 +55,7 @@ class Perf {
5555
}, perf_results_);
5656
}
5757
// Check performance of task's Run() function
58-
void TaskRun(const PerfAttr& perf_attr) {
58+
void TaskRun(const PerfAttr &perf_attr) {
5959
perf_results_.type_of_running = PerfResults::TypeOfRunning::kTaskRun;
6060

6161
task_->Validation();
@@ -69,7 +69,7 @@ class Perf {
6969
task_->PostProcessing();
7070
}
7171
// Print results for automation checkers
72-
void PrintPerfStatistic(const std::string& test_id) const {
72+
void PrintPerfStatistic(const std::string &test_id) const {
7373
std::string type_test_name;
7474
if (perf_results_.type_of_running == PerfResults::TypeOfRunning::kTaskRun) {
7575
type_test_name = "task_run";
@@ -106,7 +106,7 @@ class Perf {
106106
private:
107107
PerfResults perf_results_;
108108
std::shared_ptr<ppc::task::Task<InType, OutType>> task_;
109-
static void CommonRun(const PerfAttr& perf_attr, const std::function<void()>& pipeline, PerfResults& perf_results) {
109+
static void CommonRun(const PerfAttr &perf_attr, const std::function<void()> &pipeline, PerfResults &perf_results) {
110110
auto begin = perf_attr.current_timer();
111111
for (uint64_t i = 0; i < perf_attr.num_running; i++) {
112112
pipeline();

modules/performance/tests/perf_tests.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace ppc::test {
2525
template <typename InType, typename OutType>
2626
class TestPerfTask : public ppc::task::Task<InType, OutType> {
2727
public:
28-
explicit TestPerfTask(const InType& in) {
28+
explicit TestPerfTask(const InType &in) {
2929
this->GetInput() = in;
3030
}
3131

@@ -53,7 +53,7 @@ class TestPerfTask : public ppc::task::Task<InType, OutType> {
5353
template <typename InType, typename OutType>
5454
class FakePerfTask : public TestPerfTask<InType, OutType> {
5555
public:
56-
explicit FakePerfTask(const InType& in) : TestPerfTask<InType, OutType>(in) {}
56+
explicit FakePerfTask(const InType &in) : TestPerfTask<InType, OutType>(in) {}
5757

5858
bool RunImpl() override {
5959
std::this_thread::sleep_for(std::chrono::seconds(11));
@@ -164,31 +164,31 @@ TEST(PerfTests, CheckPerfTaskFloat) {
164164
struct ParamTestCase {
165165
PerfResults::TypeOfRunning input;
166166
std::string expected_output;
167-
friend void PrintTo(const ParamTestCase& param, std::ostream* os) {
167+
friend void PrintTo(const ParamTestCase &param, std::ostream *os) {
168168
*os << "{ input = " << static_cast<int>(param.input) << ", expected = " << param.expected_output << " }";
169169
}
170170
};
171171

172172
class GetStringParamNameParamTest : public ::testing::TestWithParam<ParamTestCase> {};
173173

174174
TEST_P(GetStringParamNameParamTest, ReturnsExpectedString) {
175-
const auto& param = GetParam();
175+
const auto &param = GetParam();
176176
EXPECT_EQ(GetStringParamName(param.input), param.expected_output);
177177
}
178178

179179
INSTANTIATE_TEST_SUITE_P(ParamTests, GetStringParamNameParamTest,
180180
::testing::Values(ParamTestCase{PerfResults::TypeOfRunning::kTaskRun, "task_run"},
181181
ParamTestCase{PerfResults::TypeOfRunning::kPipeline, "pipeline"},
182182
ParamTestCase{PerfResults::TypeOfRunning::kNone, "none"}),
183-
[](const ::testing::TestParamInfo<ParamTestCase>& info) {
183+
[](const ::testing::TestParamInfo<ParamTestCase> &info) {
184184
return info.param.expected_output;
185185
});
186186

187187
struct TaskTypeTestCase {
188188
TypeOfTask type;
189189
std::string expected;
190190
std::string label;
191-
friend void PrintTo(const TaskTypeTestCase& param, std::ostream* os) {
191+
friend void PrintTo(const TaskTypeTestCase &param, std::ostream *os) {
192192
*os << "{ type = " << static_cast<int>(param.type) << ", expected = " << param.expected
193193
<< ", label = " << param.label << " }";
194194
}
@@ -217,7 +217,7 @@ class GetStringTaskTypeTest : public ::testing::TestWithParam<TaskTypeTestCase>
217217
};
218218

219219
TEST_P(GetStringTaskTypeTest, ReturnsExpectedString) {
220-
const auto& param = GetParam();
220+
const auto &param = GetParam();
221221
EXPECT_EQ(GetStringTaskType(param.type, temp_path), param.expected) << "Failed on: " << param.label;
222222
}
223223

@@ -236,7 +236,7 @@ TEST(GetStringTaskTypeStandaloneTest, ThrowsIfFileMissing) {
236236

237237
TEST(GetStringTaskTypeStandaloneTest, ExceptionMessageContainsPath) {
238238
const std::string missing_path = "non_existent_settings.json";
239-
EXPECT_THROW(try { GetStringTaskType(TypeOfTask::kSEQ, missing_path); } catch (const std::runtime_error& e) {
239+
EXPECT_THROW(try { GetStringTaskType(TypeOfTask::kSEQ, missing_path); } catch (const std::runtime_error &e) {
240240
EXPECT_NE(std::string(e.what()).find(missing_path), std::string::npos);
241241
throw;
242242
},

modules/runners/include/runners.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class UnreadMessagesDetector : public ::testing::EmptyTestEventListener {
1313
public:
1414
UnreadMessagesDetector() = default;
1515
/// @brief Called by GTest after a test ends. Checks for unread messages.
16-
void OnTestEnd(const ::testing::TestInfo& /*test_info*/) override;
16+
void OnTestEnd(const ::testing::TestInfo & /*test_info*/) override;
1717

1818
private:
1919
};
@@ -26,9 +26,9 @@ class WorkerTestFailurePrinter : public ::testing::EmptyTestEventListener {
2626
/// @param base A shared pointer to another GTest event listener.
2727
explicit WorkerTestFailurePrinter(std::shared_ptr<::testing::TestEventListener> base) : base_(std::move(base)) {}
2828
/// @brief Called after a test ends. Passes call base listener and print failures with rank.
29-
void OnTestEnd(const ::testing::TestInfo& test_info) override;
29+
void OnTestEnd(const ::testing::TestInfo &test_info) override;
3030
/// @brief Called when a test part fails. Prints MPI rank info along with the failure.
31-
void OnTestPartResult(const ::testing::TestPartResult& test_part_result) override;
31+
void OnTestPartResult(const ::testing::TestPartResult &test_part_result) override;
3232

3333
private:
3434
/// @brief Prints the MPI rank of the current process to stderr.
@@ -41,12 +41,12 @@ class WorkerTestFailurePrinter : public ::testing::EmptyTestEventListener {
4141
/// @param argv Argument vector.
4242
/// @return Exit code from RUN_ALL_TESTS or MPI error code if initialization/
4343
/// finalization fails.
44-
int Init(int argc, char** argv);
44+
int Init(int argc, char **argv);
4545

4646
/// @brief Initializes the testing environment only for gtest.
4747
/// @param argc Argument count.
4848
/// @param argv Argument vector.
4949
/// @return Exit code from RUN_ALL_TESTS.
50-
int SimpleInit(int argc, char** argv);
50+
int SimpleInit(int argc, char **argv);
5151

5252
} // namespace ppc::runners

modules/runners/src/runners.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace ppc::runners {
1717

18-
void UnreadMessagesDetector::OnTestEnd(const ::testing::TestInfo& /*test_info*/) {
18+
void UnreadMessagesDetector::OnTestEnd(const ::testing::TestInfo & /*test_info*/) {
1919
int rank = -1;
2020
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
2121

@@ -42,15 +42,15 @@ void UnreadMessagesDetector::OnTestEnd(const ::testing::TestInfo& /*test_info*/)
4242
MPI_Barrier(MPI_COMM_WORLD);
4343
}
4444

45-
void WorkerTestFailurePrinter::OnTestEnd(const ::testing::TestInfo& test_info) {
45+
void WorkerTestFailurePrinter::OnTestEnd(const ::testing::TestInfo &test_info) {
4646
if (test_info.result()->Passed()) {
4747
return;
4848
}
4949
PrintProcessRank();
5050
base_->OnTestEnd(test_info);
5151
}
5252

53-
void WorkerTestFailurePrinter::OnTestPartResult(const ::testing::TestPartResult& test_part_result) {
53+
void WorkerTestFailurePrinter::OnTestPartResult(const ::testing::TestPartResult &test_part_result) {
5454
if (test_part_result.passed() || test_part_result.skipped()) {
5555
return;
5656
}
@@ -75,7 +75,7 @@ int RunAllTests() {
7575
}
7676
} // namespace
7777

78-
int Init(int argc, char** argv) {
78+
int Init(int argc, char **argv) {
7979
const int init_res = MPI_Init(&argc, &argv);
8080
if (init_res != MPI_SUCCESS) {
8181
std::cerr << std::format("[ ERROR ] MPI_Init failed with code {}", init_res) << '\n';
@@ -88,11 +88,11 @@ int Init(int argc, char** argv) {
8888

8989
::testing::InitGoogleTest(&argc, argv);
9090

91-
auto& listeners = ::testing::UnitTest::GetInstance()->listeners();
91+
auto &listeners = ::testing::UnitTest::GetInstance()->listeners();
9292
int rank = -1;
9393
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
9494
if (rank != 0 && (argc < 2 || argv[1] != std::string("--print-workers"))) {
95-
auto* listener = listeners.Release(listeners.default_result_printer());
95+
auto *listener = listeners.Release(listeners.default_result_printer());
9696
listeners.Append(new WorkerTestFailurePrinter(std::shared_ptr<::testing::TestEventListener>(listener)));
9797
}
9898
listeners.Append(new UnreadMessagesDetector());
@@ -108,7 +108,7 @@ int Init(int argc, char** argv) {
108108
return status;
109109
}
110110

111-
int SimpleInit(int argc, char** argv) {
111+
int SimpleInit(int argc, char **argv) {
112112
// Limit the number of threads in TBB
113113
tbb::global_control control(tbb::global_control::max_allowed_parallelism, ppc::util::GetNumThreads());
114114

modules/task/tests/task_tests.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ namespace ppc::test {
4141
template <typename InType, typename OutType>
4242
class TestTask : public ppc::task::Task<InType, OutType> {
4343
public:
44-
explicit TestTask(const InType& in) {
44+
explicit TestTask(const InType &in) {
4545
this->GetInput() = in;
4646
}
4747

@@ -69,7 +69,7 @@ class TestTask : public ppc::task::Task<InType, OutType> {
6969
template <typename InType, typename OutType>
7070
class FakeSlowTask : public TestTask<InType, OutType> {
7171
public:
72-
explicit FakeSlowTask(const InType& in) : TestTask<InType, OutType>(in) {}
72+
explicit FakeSlowTask(const InType &in) : TestTask<InType, OutType>(in) {}
7373

7474
bool RunImpl() override {
7575
std::this_thread::sleep_for(std::chrono::seconds(2));
@@ -230,7 +230,7 @@ TEST(TaskTest, TaskDestructorThrowsIfStageIncomplete) {
230230
{
231231
std::vector<int32_t> in(20, 1);
232232
struct LocalTask : Task<std::vector<int32_t>, int32_t> {
233-
explicit LocalTask(const std::vector<int32_t>& in) {
233+
explicit LocalTask(const std::vector<int32_t> &in) {
234234
this->GetInput() = in;
235235
}
236236
bool ValidationImpl() override {
@@ -256,7 +256,7 @@ TEST(TaskTest, TaskDestructorThrowsIfEmpty) {
256256
{
257257
std::vector<int32_t> in(20, 1);
258258
struct LocalTask : Task<std::vector<int32_t>, int32_t> {
259-
explicit LocalTask(const std::vector<int32_t>& in) {
259+
explicit LocalTask(const std::vector<int32_t> &in) {
260260
this->GetInput() = in;
261261
}
262262
bool ValidationImpl() override {
@@ -279,7 +279,7 @@ TEST(TaskTest, TaskDestructorThrowsIfEmpty) {
279279

280280
TEST(TaskTest, InternalTimeTestThrowsIfTimeoutExceeded) {
281281
struct SlowTask : Task<std::vector<int32_t>, int32_t> {
282-
explicit SlowTask(const std::vector<int32_t>& in) {
282+
explicit SlowTask(const std::vector<int32_t> &in) {
283283
this->GetInput() = in;
284284
}
285285
bool ValidationImpl() override {
@@ -346,6 +346,6 @@ TEST(TaskTest, PostProcessingThrowsIfCalledBeforeRun) {
346346
EXPECT_THROW(task->PostProcessing(), std::runtime_error);
347347
}
348348

349-
int main(int argc, char** argv) {
349+
int main(int argc, char **argv) {
350350
return ppc::runners::SimpleInit(argc, argv);
351351
}

modules/util/include/func_test_util.hpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ template <typename InType, typename OutType, typename TestType = void>
3636
/// @tparam TestType Type of the test case or parameter.
3737
class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, OutType, TestType>> {
3838
public:
39-
virtual bool CheckTestOutputData(OutType& output_data) = 0;
39+
virtual bool CheckTestOutputData(OutType &output_data) = 0;
4040
/// @brief Provides input data for the task.
4141
/// @return Initialized input data.
4242
virtual InType GetTestInputData() = 0;
@@ -48,7 +48,7 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
4848
}
4949

5050
template <typename Derived>
51-
static std::string PrintFuncTestName(const GTestFuncParam<InType, OutType, TestType>& info) {
51+
static std::string PrintFuncTestName(const GTestFuncParam<InType, OutType, TestType> &info) {
5252
RequireStaticInterface<Derived>();
5353
TestType test_param = std::get<static_cast<std::size_t>(ppc::util::GTestParamIndex::kTestParams)>(info.param);
5454
return std::get<static_cast<std::size_t>(GTestParamIndex::kNameTest)>(info.param) + "_" +
@@ -57,7 +57,7 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
5757

5858
protected:
5959
void ExecuteTest(FuncTestParam<InType, OutType, TestType> test_param) {
60-
const std::string& test_name = std::get<static_cast<std::size_t>(GTestParamIndex::kNameTest)>(test_param);
60+
const std::string &test_name = std::get<static_cast<std::size_t>(GTestParamIndex::kNameTest)>(test_param);
6161

6262
ValidateTestName(test_name);
6363

@@ -73,24 +73,24 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
7373
InitializeAndRunTask(test_param);
7474
}
7575

76-
void ValidateTestName(const std::string& test_name) {
76+
void ValidateTestName(const std::string &test_name) {
7777
EXPECT_FALSE(test_name.find("unknown") != std::string::npos);
7878
}
7979

80-
bool IsTestDisabled(const std::string& test_name) {
80+
bool IsTestDisabled(const std::string &test_name) {
8181
return test_name.find("disabled") != std::string::npos;
8282
}
8383

84-
bool ShouldSkipNonMpiTask(const std::string& test_name) {
85-
auto contains_substring = [&](const std::string& substring) {
84+
bool ShouldSkipNonMpiTask(const std::string &test_name) {
85+
auto contains_substring = [&](const std::string &substring) {
8686
return test_name.find(substring) != std::string::npos;
8787
};
8888

8989
return !ppc::util::IsUnderMpirun() && (contains_substring("_all") || contains_substring("_mpi"));
9090
}
9191

9292
/// @brief Initializes task instance and runs it through the full pipeline.
93-
void InitializeAndRunTask(const FuncTestParam<InType, OutType, TestType>& test_param) {
93+
void InitializeAndRunTask(const FuncTestParam<InType, OutType, TestType> &test_param) {
9494
task_ = std::get<static_cast<std::size_t>(GTestParamIndex::kTaskGetter)>(test_param)(GetTestInputData());
9595
ExecuteTaskPipeline();
9696
}
@@ -110,18 +110,18 @@ class BaseRunFuncTests : public ::testing::TestWithParam<FuncTestParam<InType, O
110110
};
111111

112112
template <typename Tuple, std::size_t... Is>
113-
auto ExpandToValuesImpl(const Tuple& t, std::index_sequence<Is...> /*unused*/) {
113+
auto ExpandToValuesImpl(const Tuple &t, std::index_sequence<Is...> /*unused*/) {
114114
return ::testing::Values(std::get<Is>(t)...);
115115
}
116116

117117
template <typename Tuple>
118-
auto ExpandToValues(const Tuple& t) {
118+
auto ExpandToValues(const Tuple &t) {
119119
constexpr std::size_t kN = std::tuple_size_v<Tuple>;
120120
return ExpandToValuesImpl(t, std::make_index_sequence<kN>{});
121121
}
122122

123123
template <typename Task, typename InType, typename SizesContainer, std::size_t... Is>
124-
auto GenTaskTuplesImpl(const SizesContainer& sizes, const std::string& settings_path,
124+
auto GenTaskTuplesImpl(const SizesContainer &sizes, const std::string &settings_path,
125125
std::index_sequence<Is...> /*unused*/) {
126126
return std::make_tuple(std::make_tuple(ppc::task::TaskGetter<Task, InType>,
127127
std::string(GetNamespace<Task>()) + "_" +
@@ -130,13 +130,13 @@ auto GenTaskTuplesImpl(const SizesContainer& sizes, const std::string& settings_
130130
}
131131

132132
template <typename Task, typename InType, typename SizesContainer>
133-
auto TaskListGenerator(const SizesContainer& sizes, const std::string& settings_path) {
133+
auto TaskListGenerator(const SizesContainer &sizes, const std::string &settings_path) {
134134
return GenTaskTuplesImpl<Task, InType>(sizes, settings_path,
135135
std::make_index_sequence<std::tuple_size_v<std::decay_t<SizesContainer>>>{});
136136
}
137137

138138
template <typename Task, typename InType, typename SizesContainer>
139-
constexpr auto AddFuncTask(const SizesContainer& sizes, const std::string& settings_path) {
139+
constexpr auto AddFuncTask(const SizesContainer &sizes, const std::string &settings_path) {
140140
return TaskListGenerator<Task, InType>(sizes, settings_path);
141141
}
142142

0 commit comments

Comments
 (0)