Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "example_processes/seq/include/ops_seq.hpp" | ||
2 | |||
3 | #include <numeric> | ||
4 | #include <vector> | ||
5 | |||
6 | #include "core/util/include/util.hpp" | ||
7 | #include "example_processes/common/include/common.hpp" | ||
8 | |||
9 | namespace nesterov_a_test_task_processes { | ||
10 | |||
11 | 48 | NesterovATestTaskSEQ::NesterovATestTaskSEQ(const InType& in) { | |
12 | SetTypeOfTask(GetStaticTypeOfTask()); | ||
13 | 48 | GetInput() = in; | |
14 | 48 | GetOutput() = 0; | |
15 | 48 | } | |
16 | |||
17 |
2/4✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
|
48 | bool NesterovATestTaskSEQ::ValidationImpl() { return (GetInput() > 0) && (GetOutput() == 0); } |
18 | |||
19 | 48 | bool NesterovATestTaskSEQ::PreProcessingImpl() { | |
20 | 48 | GetOutput() = 2 * GetInput(); | |
21 | 48 | return GetOutput() > 0; | |
22 | } | ||
23 | |||
24 | 48 | bool NesterovATestTaskSEQ::RunImpl() { | |
25 |
1/2✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
|
48 | if (GetInput() == 0) { |
26 | return false; | ||
27 | } | ||
28 | |||
29 |
2/2✓ Branch 0 taken 144 times.
✓ Branch 1 taken 48 times.
|
192 | for (InType i = 0; i < GetInput(); i++) { |
30 |
2/2✓ Branch 0 taken 432 times.
✓ Branch 1 taken 144 times.
|
576 | for (InType j = 0; j < GetInput(); j++) { |
31 |
2/2✓ Branch 0 taken 1296 times.
✓ Branch 1 taken 432 times.
|
1728 | for (InType k = 0; k < GetInput(); k++) { |
32 | 1296 | std::vector<InType> tmp(i + j + k, 1); | |
33 | 1296 | GetOutput() += std::accumulate(tmp.begin(), tmp.end(), 0); | |
34 |
2/2✓ Branch 0 taken 1248 times.
✓ Branch 1 taken 48 times.
|
1296 | GetOutput() -= i + j + k; |
35 | } | ||
36 | } | ||
37 | } | ||
38 | |||
39 | 48 | const int num_threads = ppc::util::GetNumThreads(); | |
40 | 48 | GetOutput() *= num_threads; | |
41 | |||
42 | int counter = 0; | ||
43 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 48 times.
|
168 | for (int i = 0; i < num_threads; i++) { |
44 | 120 | counter++; | |
45 | } | ||
46 | |||
47 |
1/2✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
|
48 | if (counter != 0) { |
48 | 48 | GetOutput() /= counter; | |
49 | } | ||
50 | 48 | return GetOutput() > 0; | |
51 | } | ||
52 | |||
53 | 48 | bool NesterovATestTaskSEQ::PostProcessingImpl() { | |
54 | 48 | GetOutput() -= GetInput(); | |
55 | 48 | return GetOutput() > 0; | |
56 | } | ||
57 | |||
58 | } // namespace nesterov_a_test_task_processes | ||
59 |