GCC Code Coverage Report


Directory: ./
File: tasks/romanov_a_scatter/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: 5 8 62.5%

Line Branch Exec Source
1 #include "romanov_a_scatter/seq/include/ops_seq.hpp"
2
3 // #include <mpi.h>
4
5 #include <cmath>
6 #include <utility>
7 #include <vector>
8
9 #include "romanov_a_scatter/common/include/common.hpp"
10
11 namespace romanov_a_scatter {
12
13
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 RomanovAScatterSEQ::RomanovAScatterSEQ(const InType &in) {
14 SetTypeOfTask(GetStaticTypeOfTask());
15 GetInput() = in;
16 40 GetOutput() = std::vector<int>{};
17 40 }
18
19 40 bool RomanovAScatterSEQ::ValidationImpl() {
20 40 return true;
21 }
22
23 40 bool RomanovAScatterSEQ::PreProcessingImpl() {
24 40 return true;
25 }
26
27 40 bool RomanovAScatterSEQ::RunImpl() {
28 const auto &[sendbuf, sendcount, root] = GetInput();
29
30 40 std::vector<int> recvbuf(sendcount);
31
32
3/4
✓ Branch 0 taken 752 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 752 times.
✗ Branch 3 not taken.
792 for (int i = 0; (i < sendcount) && std::cmp_less(i, static_cast<int>(sendbuf.size())); ++i) {
33 752 recvbuf[i] = sendbuf[i];
34 }
35
36
1/2
✓ Branch 1 taken 40 times.
✗ Branch 2 not taken.
40 GetOutput() = recvbuf;
37
38 // Код для сравнения с MPI-версией
39 // int rank = 0;
40 // MPI_Comm_rank(MPI_COMM_WORLD, &rank);
41
42 // int num_processes = 0;
43 // MPI_Comm_size(MPI_COMM_WORLD, &num_processes);
44
45 // int root = std::get<2>(GetInput());
46 // int sendcount = std::get<1>(GetInput());
47
48 // std::vector<int> sendbuf;
49 // if (rank == root) {
50 // sendbuf = std::get<0>(GetInput());
51 // sendbuf.resize(num_processes * sendcount);
52 // }
53
54 // std::vector<int> recvbuf(sendcount);
55
56 // MPI_Scatter(sendbuf.data(), sendcount, MPI_INT, recvbuf.data(), sendcount, MPI_INT, root, MPI_COMM_WORLD);
57
58 // GetOutput() = recvbuf;
59
60 40 return true;
61 }
62
63 40 bool RomanovAScatterSEQ::PostProcessingImpl() {
64 40 return true;
65 }
66
67 } // namespace romanov_a_scatter
68