| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "example/processes/t1/seq/include/ops_seq.hpp" | ||
| 2 | |||
| 3 | #include <numeric> | ||
| 4 | #include <vector> | ||
| 5 | |||
| 6 | #include "example/common/include/common.hpp" | ||
| 7 | #include "util/include/util.hpp" | ||
| 8 | |||
| 9 | namespace example_processes_t1 { | ||
| 10 | |||
| 11 | 24 | NesterovATestTaskSEQ::NesterovATestTaskSEQ(const InType &in) : BaseTask(in) {} | |
| 12 | |||
| 13 | 24 | bool NesterovATestTaskSEQ::ValidationImpl() { | |
| 14 |
2/4✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
|
24 | return (GetInput() > 0) && (GetMutableOutput() == 0); |
| 15 | } | ||
| 16 | |||
| 17 | 24 | bool NesterovATestTaskSEQ::PreProcessingImpl() { | |
| 18 | 24 | GetMutableOutput() = 2 * GetInput(); | |
| 19 | 24 | return GetMutableOutput() > 0; | |
| 20 | } | ||
| 21 | |||
| 22 | 24 | bool NesterovATestTaskSEQ::RunImpl() { | |
| 23 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if (GetInput() == 0) { |
| 24 | return false; | ||
| 25 | } | ||
| 26 | |||
| 27 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 24 times.
|
96 | for (InType i = 0; i < GetInput(); i++) { |
| 28 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 72 times.
|
288 | for (InType j = 0; j < GetInput(); j++) { |
| 29 |
2/2✓ Branch 0 taken 648 times.
✓ Branch 1 taken 216 times.
|
864 | for (InType k = 0; k < GetInput(); k++) { |
| 30 | 648 | std::vector<InType> tmp(i + j + k, 1); | |
| 31 | 648 | GetMutableOutput() += std::accumulate(tmp.begin(), tmp.end(), 0); | |
| 32 |
2/2✓ Branch 0 taken 624 times.
✓ Branch 1 taken 24 times.
|
648 | GetMutableOutput() -= i + j + k; |
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | 24 | const int num_threads = ppc::util::GetNumThreads(); | |
| 38 | 24 | GetMutableOutput() *= num_threads; | |
| 39 | |||
| 40 | int counter = 0; | ||
| 41 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 24 times.
|
84 | for (int i = 0; i < num_threads; i++) { |
| 42 | 60 | counter++; | |
| 43 | } | ||
| 44 | |||
| 45 |
1/2✓ Branch 0 taken 24 times.
✗ Branch 1 not taken.
|
24 | if (counter != 0) { |
| 46 | 24 | GetMutableOutput() /= counter; | |
| 47 | } | ||
| 48 | 24 | return GetMutableOutput() > 0; | |
| 49 | } | ||
| 50 | |||
| 51 | 24 | bool NesterovATestTaskSEQ::PostProcessingImpl() { | |
| 52 | 24 | GetMutableOutput() -= GetInput(); | |
| 53 | 24 | return GetMutableOutput() > 0; | |
| 54 | } | ||
| 55 | |||
| 56 | } // namespace example_processes_t1 | ||
| 57 |