GCC Code Coverage Report


Directory: ./
File: tasks/zavyalov_a_reduce/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 15 15 100.0%
Functions: 5 5 100.0%
Branches: 2 2 100.0%

Line Branch Exec Source
1 #include "zavyalov_a_reduce/seq/include/ops_seq.hpp"
2
3 #include <cstdlib>
4
5 #include "zavyalov_a_reduce/common/include/common.hpp"
6
7 namespace zavyalov_a_reduce {
8
9 288 ZavyalovAReduceSEQ::ZavyalovAReduceSEQ(const InType &in) {
10 SetTypeOfTask(GetStaticTypeOfTask());
11 GetInput() = in;
12 std::get<0>(GetOutput()) = nullptr;
13 288 std::get<1>(GetOutput()) = true;
14 288 }
15
16 288 bool ZavyalovAReduceSEQ::ValidationImpl() {
17 288 return true;
18 }
19
20 288 bool ZavyalovAReduceSEQ::PreProcessingImpl() {
21 288 return true;
22 }
23
24 288 bool ZavyalovAReduceSEQ::RunImpl() {
25 288 std::get<1>(GetOutput()) = true;
26 288 volatile int i = 0;
27
2/2
✓ Branch 0 taken 2880000000 times.
✓ Branch 1 taken 288 times.
2880000288 while (i < 10000000) { // для того чтобы время выполнения было больше 0.001 в CI
28 2880000000 i += 1;
29 }
30 288 return true;
31 /*
32 int is_mpi_initialized = 0;
33 MPI_Initialized(&is_mpi_initialized);
34 if (is_mpi_initialized == 0) {
35 return true;
36 }
37 MPI_Op operation = std::get<0>(GetInput());
38 MPI_Datatype cur_type = std::get<1>(GetInput());
39 size_t sz = std::get<2>(GetInput());
40 std::shared_ptr<void> mem_ptr = std::get<3>(GetInput());
41 void *mem = mem_ptr.get();
42 int receiver_rank = std::get<4>(GetInput());
43
44 int rank = 0;
45 int world_size = 0;
46 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
47 MPI_Comm_size(MPI_COMM_WORLD, &world_size);
48
49 int type_size = 0;
50 MPI_Type_size(cur_type, &type_size);
51
52 char *raw_result = new char[sz * type_size];
53 std::shared_ptr<void> result_ptr(raw_result, [](void *p) { delete[] static_cast<char *>(p); });
54
55 if (rank == receiver_rank) {
56 MPI_Reduce(mem, raw_result, static_cast<int>(sz), cur_type, operation, receiver_rank, MPI_COMM_WORLD);
57 MPI_Bcast(raw_result, static_cast<int>(sz), cur_type, receiver_rank, MPI_COMM_WORLD);
58 } else {
59 MPI_Reduce(mem, nullptr, static_cast<int>(sz), cur_type, operation, receiver_rank, MPI_COMM_WORLD);
60 MPI_Bcast(raw_result, static_cast<int>(sz), cur_type, receiver_rank, MPI_COMM_WORLD);
61 }
62
63 std::get<0>(GetOutput()) = result_ptr;
64 std::get<1>(GetOutput()) = false;
65
66 return true;
67 */
68 }
69
70 288 bool ZavyalovAReduceSEQ::PostProcessingImpl() {
71 288 return true;
72 }
73
74 } // namespace zavyalov_a_reduce
75