| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "../include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <numeric> | ||
| 4 | |||
| 5 | #include "../../common/include/common.hpp" | ||
| 6 | |||
| 7 | namespace kutergin_a_allreduce { | ||
| 8 | |||
| 9 | ✗ | AllreduceSequential::AllreduceSequential(const InType &in) { | |
| 10 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
| 11 | GetInput() = in; | ||
| 12 | ✗ | GetOutput() = 0; | |
| 13 | ✗ | } | |
| 14 | |||
| 15 | ✗ | bool AllreduceSequential::ValidationImpl() { | |
| 16 | ✗ | return true; | |
| 17 | } | ||
| 18 | |||
| 19 | ✗ | bool AllreduceSequential::PreProcessingImpl() { | |
| 20 | ✗ | GetOutput() = 0; | |
| 21 | ✗ | return true; | |
| 22 | } | ||
| 23 | |||
| 24 | ✗ | bool AllreduceSequential::RunImpl() { | |
| 25 | const InType &input_data = GetInput(); | ||
| 26 | |||
| 27 | ✗ | if (input_data.elements.empty()) { | |
| 28 | ✗ | GetOutput() = 0; | |
| 29 | } else { | ||
| 30 | ✗ | GetOutput() = std::accumulate(input_data.elements.begin(), input_data.elements.end(), 0); | |
| 31 | } | ||
| 32 | ✗ | return true; | |
| 33 | } | ||
| 34 | |||
| 35 | ✗ | bool AllreduceSequential::PostProcessingImpl() { | |
| 36 | ✗ | return true; | |
| 37 | } | ||
| 38 | |||
| 39 | } // namespace kutergin_a_allreduce | ||
| 40 |