| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "../include/reduce_seq.hpp" | ||
| 2 | |||
| 3 | #include <numeric> // для std::accumulate | ||
| 4 | |||
| 5 | #include "../../common/include/common.hpp" | ||
| 6 | |||
| 7 | namespace kutergin_v_reduce { | ||
| 8 | |||
| 9 |
1/2✓ Branch 1 taken 32 times.
✗ Branch 2 not taken.
|
32 | ReduceSequential::ReduceSequential(const InType &in) { |
| 10 | SetTypeOfTask(GetStaticTypeOfTask()); // установка типа задачи | ||
| 11 | GetInput() = in; // сохранение входных данных | ||
| 12 | 32 | GetOutput() = 0; // инициализация выходных данных | |
| 13 | 32 | } | |
| 14 | |||
| 15 | 32 | bool ReduceSequential::ValidationImpl() { | |
| 16 | 32 | return true; | |
| 17 | } | ||
| 18 | |||
| 19 | 32 | bool ReduceSequential::PreProcessingImpl() { | |
| 20 | 32 | return true; | |
| 21 | } | ||
| 22 | |||
| 23 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | bool ReduceSequential::RunImpl() { |
| 24 | const auto &input_vec = GetInput().data; | ||
| 25 |
1/2✓ Branch 0 taken 32 times.
✗ Branch 1 not taken.
|
32 | if (input_vec.empty()) { |
| 26 | ✗ | GetOutput() = 0; | |
| 27 | } else { | ||
| 28 | 32 | GetOutput() = std::accumulate(input_vec.begin(), input_vec.end(), 0); // эмулирование операции MPI_SUM | |
| 29 | } | ||
| 30 | 32 | return true; | |
| 31 | } | ||
| 32 | |||
| 33 | 32 | bool ReduceSequential::PostProcessingImpl() { | |
| 34 | 32 | return true; | |
| 35 | } | ||
| 36 | |||
| 37 | } // namespace kutergin_v_reduce | ||
| 38 |