GCC Code Coverage Report


Directory: ./
File: tasks/krymova_k_scatter/seq/src/ops_seq.cpp
Date: 2026-01-09 01:27:18
Exec Total Coverage
Lines: 23 23 100.0%
Functions: 5 5 100.0%
Branches: 15 24 62.5%

Line Branch Exec Source
1 #include "krymova_k_scatter/seq/include/ops_seq.hpp"
2
3 #include <mpi.h>
4
5 #include <algorithm>
6 #include <cstddef>
7 #include <cstdint>
8 #include <utility>
9 #include <vector>
10
11 #include "krymova_k_scatter/common/include/common.hpp"
12
13 namespace krymova_k_scatter {
14
15 120 KrymovaKScatterSEQ::KrymovaKScatterSEQ(const InType &in) {
16 SetTypeOfTask(GetStaticTypeOfTask());
17 120 GetInput() = in;
18 120 }
19
20 120 bool KrymovaKScatterSEQ::ValidationImpl() {
21 const auto &args = GetInput();
22
23
2/4
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 120 times.
120 if (args.send_count <= 0 || args.send_count != args.recv_count) {
24 return false;
25 }
26
27
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
120 if (args.send_type != args.recv_type) {
28 return false;
29 }
30
31
1/4
✗ Branch 0 not taken.
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
120 if (args.src_buffer == nullptr && args.dst_buffer == nullptr) {
32 return false;
33 }
34
35
5/6
✓ Branch 0 taken 80 times.
✓ Branch 1 taken 40 times.
✓ Branch 2 taken 40 times.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 40 times.
120 auto check_type = [](MPI_Datatype t) { return (t == MPI_INT || t == MPI_FLOAT || t == MPI_DOUBLE); };
36
37 return check_type(args.send_type);
38 }
39
40 120 bool KrymovaKScatterSEQ::PreProcessingImpl() {
41 120 return true;
42 }
43
44 120 bool KrymovaKScatterSEQ::RunImpl() {
45 auto &args = GetInput();
46
47 size_t elem_size = 0;
48
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 80 times.
120 if (args.send_type == MPI_INT) {
49 elem_size = sizeof(int);
50
2/2
✓ Branch 0 taken 40 times.
✓ Branch 1 taken 40 times.
80 } else if (args.send_type == MPI_FLOAT) {
51 elem_size = sizeof(float);
52 } else {
53 elem_size = sizeof(double);
54 }
55
56 120 auto total_bytes = static_cast<size_t>(args.send_count) * elem_size;
57
58 120 const auto *start_ptr = static_cast<const uint8_t *>(args.src_buffer);
59 120 const auto *end_ptr = start_ptr + total_bytes;
60
61 120 std::vector<uint8_t> source_data(start_ptr, end_ptr);
62
63 120 std::vector<uint8_t> output_data;
64
1/2
✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
120 output_data = source_data;
65
66
1/2
✓ Branch 0 taken 120 times.
✗ Branch 1 not taken.
120 if (args.dst_buffer != nullptr) {
67 auto *dst_ptr = static_cast<uint8_t *>(args.dst_buffer);
68 std::ranges::copy(output_data, dst_ptr);
69 }
70
71 GetOutput() = std::move(output_data);
72 120 return true;
73 }
74
75 120 bool KrymovaKScatterSEQ::PostProcessingImpl() {
76 120 return true;
77 }
78
79 } // namespace krymova_k_scatter
80