GCC Code Coverage Report


Directory: ./
File: tasks/baldin_a_my_scatter/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 21 21 100.0%
Functions: 5 5 100.0%
Branches: 18 26 69.2%

Line Branch Exec Source
1 #include "baldin_a_my_scatter/seq/include/ops_seq.hpp"
2
3 #include <mpi.h>
4
5 #include <cstring>
6
7 #include "baldin_a_my_scatter/common/include/common.hpp"
8
9 namespace baldin_a_my_scatter {
10
11 152 BaldinAMyScatterSEQ::BaldinAMyScatterSEQ(const InType &in) {
12 SetTypeOfTask(GetStaticTypeOfTask());
13 GetInput() = in;
14 GetOutput() = nullptr;
15 152 }
16
17 152 bool BaldinAMyScatterSEQ::ValidationImpl() {
18 const auto &[sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm] = GetInput();
19
20
2/4
✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 152 times.
152 if (sendcount <= 0 || sendcount != recvcount) {
21 return false;
22 }
23
24
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 152 times.
152 if (sendtype != recvtype) {
25 return false;
26 }
27
28
2/4
✗ Branch 0 not taken.
✓ Branch 1 taken 152 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 152 times.
152 if (sendbuf == nullptr || recvbuf == nullptr) {
29 return false;
30 }
31
32 auto is_sup_type = [](MPI_Datatype type) -> bool {
33
5/6
✓ Branch 0 taken 88 times.
✓ Branch 1 taken 64 times.
✓ Branch 2 taken 48 times.
✓ Branch 3 taken 40 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 48 times.
152 return (type == MPI_INT || type == MPI_FLOAT || type == MPI_DOUBLE);
34 };
35
36 return is_sup_type(sendtype);
37 }
38
39 152 bool BaldinAMyScatterSEQ::PreProcessingImpl() {
40 152 return true;
41 }
42
43 152 bool BaldinAMyScatterSEQ::RunImpl() {
44 auto &input = GetInput();
45 const auto &[sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm] = input;
46
47 size_t type_size = 0;
48
2/2
✓ Branch 0 taken 88 times.
✓ Branch 1 taken 64 times.
152 if (sendtype == MPI_INT) {
49 type_size = sizeof(int);
50
2/2
✓ Branch 0 taken 48 times.
✓ Branch 1 taken 40 times.
88 } else if (sendtype == MPI_FLOAT) {
51 type_size = sizeof(float);
52
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 } else if (sendtype == MPI_DOUBLE) {
53 type_size = sizeof(double);
54 }
55
56 152 size_t bytes_to_copy = static_cast<size_t>(sendcount) * type_size;
57
58
1/2
✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
152 if (recvbuf != sendbuf) {
59 const char *src = static_cast<const char *>(sendbuf);
60 char *dst = static_cast<char *>(recvbuf);
61
62
2/2
✓ Branch 0 taken 122080 times.
✓ Branch 1 taken 152 times.
122232 for (size_t i = 0; i < bytes_to_copy; ++i) {
63 122080 dst[i] = src[i];
64 }
65 }
66
67 152 GetOutput() = recvbuf;
68 152 return true;
69 }
70
71 152 bool BaldinAMyScatterSEQ::PostProcessingImpl() {
72 152 return true;
73 }
74
75 } // namespace baldin_a_my_scatter
76