GCC Code Coverage Report


Directory: ./
File: tasks/makoveeva_matmul_double_tbb/tbb/src/ops_tbb.cpp
Date: 2026-05-11 08:26:31
Exec Total Coverage
Lines: 28 28 100.0%
Functions: 6 6 100.0%
Branches: 11 16 68.8%

Line Branch Exec Source
1 #include "makoveeva_matmul_double_tbb/tbb/include/ops_tbb.hpp"
2
3 #include <tbb/blocked_range.h>
4 #include <tbb/parallel_for.h>
5
6 #include <cmath>
7 #include <cstddef>
8 #include <vector>
9
10 #include "makoveeva_matmul_double_tbb/common/include/common.hpp"
11
12 namespace makoveeva_matmul_double_tbb {
13
14
1/2
✓ Branch 1 taken 48 times.
✗ Branch 2 not taken.
48 MatmulDoubleTBBTask::MatmulDoubleTBBTask(const InType &in) {
15 SetTypeOfTask(GetStaticTypeOfTask());
16 GetInput() = in;
17 48 GetOutput() = std::vector<double>();
18 48 }
19
20 48 bool MatmulDoubleTBBTask::ValidationImpl() {
21 const auto &input = GetInput();
22 48 const size_t n = std::get<0>(input);
23 const auto &a = std::get<1>(input);
24 const auto &b = std::get<2>(input);
25
26
3/6
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 48 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 48 times.
48 return n > 0 && a.size() == n * n && b.size() == n * n;
27 }
28
29 48 bool MatmulDoubleTBBTask::PreProcessingImpl() {
30 const auto &input = GetInput();
31 48 n_ = std::get<0>(input);
32 48 A_ = std::get<1>(input);
33 48 B_ = std::get<2>(input);
34 48 C_.assign(n_ * n_, 0.0);
35
36 48 return true;
37 }
38
39 48 bool MatmulDoubleTBBTask::RunImpl() {
40
1/2
✓ Branch 0 taken 48 times.
✗ Branch 1 not taken.
48 if (n_ <= 0) {
41 return false;
42 }
43
44 48 const size_t n = n_;
45 48 const auto &a = A_;
46 48 const auto &b = B_;
47 48 auto &c = C_;
48
49 460 tbb::parallel_for(tbb::blocked_range<size_t>(0, n), [&](const tbb::blocked_range<size_t> &range) {
50
2/2
✓ Branch 0 taken 412 times.
✓ Branch 1 taken 412 times.
824 for (size_t i = range.begin(); i < range.end(); ++i) {
51
2/2
✓ Branch 0 taken 6660 times.
✓ Branch 1 taken 412 times.
7072 for (size_t j = 0; j < n; ++j) {
52 double sum = 0.0;
53
2/2
✓ Branch 0 taken 159556 times.
✓ Branch 1 taken 6660 times.
166216 for (size_t k = 0; k < n; ++k) {
54 159556 sum += a[(i * n) + k] * b[(k * n) + j];
55 }
56 6660 c[(i * n) + j] = sum;
57 }
58 }
59 412 });
60
61 48 this->GetOutput() = C_;
62 return true;
63 }
64
65 48 bool MatmulDoubleTBBTask::PostProcessingImpl() {
66 48 return true;
67 }
68
69 } // namespace makoveeva_matmul_double_tbb
70