GCC Code Coverage Report


Directory: ./
File: tasks/ashihmin_d_scatter_trans_from_one_to_all/seq/src/ops_seq.cpp
Date: 2026-01-10 02:40:41
Exec Total Coverage
Lines: 17 17 100.0%
Functions: 4 12 33.3%
Branches: 9 16 56.2%

Line Branch Exec Source
1 #include "ashihmin_d_scatter_trans_from_one_to_all/seq/include/ops_seq.hpp"
2
3 #include <algorithm>
4 #include <cstddef>
5 #include <vector>
6
7 namespace ashihmin_d_scatter_trans_from_one_to_all {
8
9 template <typename T>
10
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
36 AshihminDScatterTransFromOneToAllSEQ<T>::AshihminDScatterTransFromOneToAllSEQ(const InType &in) {
11 this->SetTypeOfTask(GetStaticTypeOfTask());
12 this->GetInput() = in;
13
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
36 this->GetOutput().resize(0);
14 36 }
15
16 template <typename T>
17 36 bool AshihminDScatterTransFromOneToAllSEQ<T>::ValidationImpl() {
18 const auto &params = this->GetInput();
19
3/6
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 18 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18 times.
36 return (params.elements_per_process > 0) && (params.root >= 0) && (this->GetOutput().empty());
20 }
21
22 template <typename T>
23 36 bool AshihminDScatterTransFromOneToAllSEQ<T>::PreProcessingImpl() {
24 36 return true;
25 }
26
27 template <typename T>
28 36 bool AshihminDScatterTransFromOneToAllSEQ<T>::RunImpl() {
29 const auto &params = this->GetInput();
30
31 36 int elements_per_proc = params.elements_per_process;
32 36 int root = params.root;
33
34 36 std::vector<T> local_data(elements_per_proc);
35
36
3/4
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
36 if (root == 0 && params.data.size() >= static_cast<size_t>(elements_per_proc)) {
37 12 std::copy(params.data.begin(), params.data.begin() + elements_per_proc, local_data.begin());
38 } else {
39 std::fill(local_data.begin(), local_data.end(), T{});
40 }
41
42
1/2
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
36 this->GetOutput() = local_data;
43 36 return true;
44 }
45
46 template <typename T>
47 18 bool AshihminDScatterTransFromOneToAllSEQ<T>::PostProcessingImpl() {
48 18 return !this->GetOutput().empty();
49 }
50
51 template class AshihminDScatterTransFromOneToAllSEQ<int>;
52 template class AshihminDScatterTransFromOneToAllSEQ<float>;
53 template class AshihminDScatterTransFromOneToAllSEQ<double>;
54
55 } // namespace ashihmin_d_scatter_trans_from_one_to_all
56