From f7071280a06360e205863a1bfecd2496f3ea6885 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 01:43:45 +0300 Subject: [PATCH 01/10] make task --- .../tbb/include/ops_tbb.hpp | 32 +++++ .../tbb/src/ops_tbb.cpp | 121 ++++++++++++++++++ .../tests/functional/main.cpp | 3 + .../tests/performance/main.cpp | 4 +- 4 files changed, 159 insertions(+), 1 deletion(-) create mode 100644 tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp create mode 100644 tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp new file mode 100644 index 000000000..3b0e24799 --- /dev/null +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include + +#include "shkrebko_m_calc_of_integral_rect/common/include/common.hpp" +#include "task/include/task.hpp" + +namespace shkrebko_m_calc_of_integral_rect { + +class ShkrebkoMCalcOfIntegralRectTBB : public BaseTask { + public: + static constexpr ppc::task::TypeOfTask GetStaticTypeOfTask() { + return ppc::task::TypeOfTask::kTBB; + } + + explicit ShkrebkoMCalcOfIntegralRectTBB(const InType &in); + + protected: + bool ValidationImpl() override; + bool PreProcessingImpl() override; + bool RunImpl() override; + bool PostProcessingImpl() override; + + private: + double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector& h); + + InType local_input_; + double res_ = 0.0; +}; + +} // namespace shkrebko_m_calc_of_integral_rect \ No newline at end of file diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp new file mode 100644 index 000000000..c231ad68a --- /dev/null +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -0,0 +1,121 @@ +#include "shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp" + +#include + +#include +#include +#include +#include +#include + +#include "shkrebko_m_calc_of_integral_rect/common/include/common.hpp" +#include "util/include/util.hpp" + +namespace shkrebko_m_calc_of_integral_rect { + +ShkrebkoMCalcOfIntegralRectTBB::ShkrebkoMCalcOfIntegralRectTBB(const InType &in) { + SetTypeOfTask(GetStaticTypeOfTask()); + GetInput() = in; + GetOutput() = 0.0; +} + +bool ShkrebkoMCalcOfIntegralRectTBB::ValidationImpl() { + const auto &input = GetInput(); + + if (!input.func) { + return false; + } + if (input.limits.size() != input.n_steps.size() || input.limits.empty()) { + return false; + } + if (!std::ranges::all_of(input.n_steps, [](int n) { return n > 0; })) { + return false; + } + if (!std::ranges::all_of(input.limits, [](const auto &lim) { return lim.first < lim.second; })) { + return false; + } + + return true; +} + +bool ShkrebkoMCalcOfIntegralRectTBB::PreProcessingImpl() { + local_input_ = GetInput(); + res_ = 0.0; + return true; +} + +bool ShkrebkoMCalcOfIntegralRectTBB::RunImpl() { + const std::size_t dim = local_input_.limits.size(); + + std::vector h(dim); + double cell_volume = 1.0; + std::size_t total_points = 1; + for (std::size_t i = 0; i < dim; ++i) { + const double left = local_input_.limits[i].first; + const double right = local_input_.limits[i].second; + const int steps = local_input_.n_steps[i]; + h[i] = (right - left) / static_cast(steps); + cell_volume *= h[i]; + total_points *= static_cast(steps); + } + + int num_threads = ppc::util::GetNumThreads(); + tbb::global_control global_limit(tbb::global_control::max_allowed_parallelism, num_threads); + + double total_sum = tbb::parallel_reduce( + tbb::blocked_range(0, total_points), 0.0, + [&](const tbb::blocked_range &range, double partial_sum) { + return partial_sum + ComputeBlockSum(range.begin(), range.end(), h); + }, + std::plus<>()); + + res_ = total_sum * cell_volume; + return true; +} + +bool ShkrebkoMCalcOfIntegralRectTBB::PostProcessingImpl() { + GetOutput() = res_; + return true; +} + +double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, + const std::vector &h) { + if (start_idx >= end_idx) { + return 0.0; + } + + const std::size_t dim = local_input_.limits.size(); + const auto &limits = local_input_.limits; + const auto &n_steps = local_input_.n_steps; + + std::vector indices(dim); + std::size_t temp = start_idx; + for (int d = static_cast(dim) - 1; d >= 0; --d) { + indices[d] = static_cast(temp % static_cast(n_steps[d])); + temp /= static_cast(n_steps[d]); + } + + double block_sum = 0.0; + std::vector point(dim); + + for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { + for (std::size_t d = 0; d < dim; ++d) { + point[d] = limits[d].first + (static_cast(indices[d]) + 0.5) * h[d]; + } + block_sum += local_input_.func(point); + + int level = static_cast(dim) - 1; + while (level >= 0) { + indices[level]++; + if (indices[level] < n_steps[level]) { + break; + } + indices[level] = 0; + level--; + } + } + + return block_sum; +} + +} // namespace shkrebko_m_calc_of_integral_rect \ No newline at end of file diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tests/functional/main.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tests/functional/main.cpp index d0a743376..131ad370c 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tests/functional/main.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tests/functional/main.cpp @@ -13,6 +13,7 @@ #include "shkrebko_m_calc_of_integral_rect/common/include/common.hpp" #include "shkrebko_m_calc_of_integral_rect/omp/include/ops_omp.hpp" #include "shkrebko_m_calc_of_integral_rect/seq/include/ops_seq.hpp" +#include "shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp" #include "util/include/func_test_util.hpp" #include "util/include/util.hpp" @@ -79,6 +80,8 @@ const std::array kTestCases = { const auto kTestTasksList = std::tuple_cat(ppc::util::AddFuncTask( kTestCases, PPC_SETTINGS_shkrebko_m_calc_of_integral_rect), ppc::util::AddFuncTask( + kTestCases, PPC_SETTINGS_shkrebko_m_calc_of_integral_rect), + ppc::util::AddFuncTask( kTestCases, PPC_SETTINGS_shkrebko_m_calc_of_integral_rect)); const auto kGtestValues = ppc::util::ExpandToValues(kTestTasksList); diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tests/performance/main.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tests/performance/main.cpp index ba60b07f8..3557ac16f 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tests/performance/main.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tests/performance/main.cpp @@ -7,6 +7,7 @@ #include "shkrebko_m_calc_of_integral_rect/common/include/common.hpp" #include "shkrebko_m_calc_of_integral_rect/omp/include/ops_omp.hpp" #include "shkrebko_m_calc_of_integral_rect/seq/include/ops_seq.hpp" +#include "shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp" #include "util/include/perf_test_util.hpp" namespace shkrebko_m_calc_of_integral_rect { @@ -46,7 +47,8 @@ TEST_P(ShkrebkoMRunPerfTest, RunPerfModes) { namespace { const auto kAllPerfTasks = std::tuple_cat( ppc::util::MakeAllPerfTasks(PPC_SETTINGS_shkrebko_m_calc_of_integral_rect), - ppc::util::MakeAllPerfTasks(PPC_SETTINGS_shkrebko_m_calc_of_integral_rect)); + ppc::util::MakeAllPerfTasks(PPC_SETTINGS_shkrebko_m_calc_of_integral_rect), + ppc::util::MakeAllPerfTasks(PPC_SETTINGS_shkrebko_m_calc_of_integral_rect)); const auto kGtestValues = ppc::util::TupleToGTestValues(kAllPerfTasks); From e6a6ed88bebd84d4b2c920c85de5de00c70d289b Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 01:47:47 +0300 Subject: [PATCH 02/10] clang --- .../tbb/include/ops_tbb.hpp | 4 ++-- .../tbb/src/ops_tbb.cpp | 12 +++++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp index 3b0e24799..186f734d2 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp @@ -23,10 +23,10 @@ class ShkrebkoMCalcOfIntegralRectTBB : public BaseTask { bool PostProcessingImpl() override; private: - double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector& h); + double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h); InType local_input_; double res_ = 0.0; }; -} // namespace shkrebko_m_calc_of_integral_rect \ No newline at end of file +} // namespace shkrebko_m_calc_of_integral_rect diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index c231ad68a..4c7ffa143 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -62,12 +62,10 @@ bool ShkrebkoMCalcOfIntegralRectTBB::RunImpl() { int num_threads = ppc::util::GetNumThreads(); tbb::global_control global_limit(tbb::global_control::max_allowed_parallelism, num_threads); - double total_sum = tbb::parallel_reduce( - tbb::blocked_range(0, total_points), 0.0, - [&](const tbb::blocked_range &range, double partial_sum) { - return partial_sum + ComputeBlockSum(range.begin(), range.end(), h); - }, - std::plus<>()); + double total_sum = tbb::parallel_reduce(tbb::blocked_range(0, total_points), 0.0, + [&](const tbb::blocked_range &range, double partial_sum) { + return partial_sum + ComputeBlockSum(range.begin(), range.end(), h); + }, std::plus<>()); res_ = total_sum * cell_volume; return true; @@ -118,4 +116,4 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st return block_sum; } -} // namespace shkrebko_m_calc_of_integral_rect \ No newline at end of file +} // namespace shkrebko_m_calc_of_integral_rect From 1e4546cda28caf806163b73ba0318c4df82c920d Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 02:36:02 +0300 Subject: [PATCH 03/10] fix --- .../tbb/include/ops_tbb.hpp | 2 +- tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp index 186f734d2..5eb370735 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp @@ -23,7 +23,7 @@ class ShkrebkoMCalcOfIntegralRectTBB : public BaseTask { bool PostProcessingImpl() override; private: - double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h); + double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h) const; InType local_input_; double res_ = 0.0; diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index 4c7ffa143..e1ca5a69b 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -77,7 +77,7 @@ bool ShkrebkoMCalcOfIntegralRectTBB::PostProcessingImpl() { } double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, - const std::vector &h) { + const std::vector &h) const { if (start_idx >= end_idx) { return 0.0; } @@ -97,8 +97,8 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st std::vector point(dim); for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { - for (std::size_t d = 0; d < dim; ++d) { - point[d] = limits[d].first + (static_cast(indices[d]) + 0.5) * h[d]; + for (std::size_t dim_idx = 0; dim_idx < dim; ++dim_idx) { + point[dim_idx] = limits[dim_idx].first + ((static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]); } block_sum += local_input_.func(point); From a514c661d15777d8836a8b315302a9dd1bd496c4 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 03:23:03 +0300 Subject: [PATCH 04/10] fix --- .../tbb/include/ops_tbb.hpp | 2 +- .../shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp index 5eb370735..186f734d2 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp @@ -23,7 +23,7 @@ class ShkrebkoMCalcOfIntegralRectTBB : public BaseTask { bool PostProcessingImpl() override; private: - double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h) const; + double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h); InType local_input_; double res_ = 0.0; diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index e1ca5a69b..2b569f119 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -77,7 +77,7 @@ bool ShkrebkoMCalcOfIntegralRectTBB::PostProcessingImpl() { } double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, - const std::vector &h) const { + const std::vector &h) { if (start_idx >= end_idx) { return 0.0; } @@ -88,9 +88,9 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st std::vector indices(dim); std::size_t temp = start_idx; - for (int d = static_cast(dim) - 1; d >= 0; --d) { - indices[d] = static_cast(temp % static_cast(n_steps[d])); - temp /= static_cast(n_steps[d]); + for (int idx = static_cast(dim) - 1; idx >= 0; --idx) { { + indices[idx] = static_cast(temp % static_cast(n_steps[idx])); + temp /= static_cast(n_steps[idx]); } double block_sum = 0.0; From 6c1a858a87c358b98cbe80cc99b5c46ba8d7ad28 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 03:26:43 +0300 Subject: [PATCH 05/10] fix --- .../tbb/src/ops_tbb.cpp | 45 ++++++++++--------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index 2b569f119..e4f2879db 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -88,32 +88,33 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st std::vector indices(dim); std::size_t temp = start_idx; - for (int idx = static_cast(dim) - 1; idx >= 0; --idx) { { - indices[idx] = static_cast(temp % static_cast(n_steps[idx])); - temp /= static_cast(n_steps[idx]); - } - - double block_sum = 0.0; - std::vector point(dim); - - for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { - for (std::size_t dim_idx = 0; dim_idx < dim; ++dim_idx) { - point[dim_idx] = limits[dim_idx].first + ((static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]); + for (int idx = static_cast(dim) - 1; idx >= 0; --idx) { + { + indices[idx] = static_cast(temp % static_cast(n_steps[idx])); + temp /= static_cast(n_steps[idx]); } - block_sum += local_input_.func(point); - int level = static_cast(dim) - 1; - while (level >= 0) { - indices[level]++; - if (indices[level] < n_steps[level]) { - break; + double block_sum = 0.0; + std::vector point(dim); + + for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { + for (std::size_t dim_idx = 0; dim_idx < dim; ++dim_idx) { + point[dim_idx] = limits[dim_idx].first + ((static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]); + } + block_sum += local_input_.func(point); + + int level = static_cast(dim) - 1; + while (level >= 0) { + indices[level]++; + if (indices[level] < n_steps[level]) { + break; + } + indices[level] = 0; + level--; } - indices[level] = 0; - level--; } - } - return block_sum; -} + return block_sum; + } } // namespace shkrebko_m_calc_of_integral_rect From 6f431ab2ff2862c20224407a76cee3d96221ba08 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 03:48:28 +0300 Subject: [PATCH 06/10] fix --- tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index e4f2879db..43bbea110 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -93,7 +93,7 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st indices[idx] = static_cast(temp % static_cast(n_steps[idx])); temp /= static_cast(n_steps[idx]); } - + } double block_sum = 0.0; std::vector point(dim); From e692d61c0ff59dea1ef0a6e19954581806ef1b57 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 03:49:30 +0300 Subject: [PATCH 07/10] fix --- .../tbb/src/ops_tbb.cpp | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index 43bbea110..0fb59b8f9 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -94,27 +94,27 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st temp /= static_cast(n_steps[idx]); } } - double block_sum = 0.0; - std::vector point(dim); + double block_sum = 0.0; + std::vector point(dim); - for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { - for (std::size_t dim_idx = 0; dim_idx < dim; ++dim_idx) { - point[dim_idx] = limits[dim_idx].first + ((static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]); - } - block_sum += local_input_.func(point); - - int level = static_cast(dim) - 1; - while (level >= 0) { - indices[level]++; - if (indices[level] < n_steps[level]) { - break; - } - indices[level] = 0; - level--; - } + for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { + for (std::size_t dim_idx = 0; dim_idx < dim; ++dim_idx) { + point[dim_idx] = limits[dim_idx].first + ((static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]); } + block_sum += local_input_.func(point); - return block_sum; + int level = static_cast(dim) - 1; + while (level >= 0) { + indices[level]++; + if (indices[level] < n_steps[level]) { + break; + } + indices[level] = 0; + level--; + } } + return block_sum; +} + } // namespace shkrebko_m_calc_of_integral_rect From c5adcfd992600ef2d25f919a0ecbb229336fc0a9 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 21:55:48 +0300 Subject: [PATCH 08/10] fix --- .../shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp | 2 +- tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp index 186f734d2..5eb370735 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp @@ -23,7 +23,7 @@ class ShkrebkoMCalcOfIntegralRectTBB : public BaseTask { bool PostProcessingImpl() override; private: - double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h); + double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h) const; InType local_input_; double res_ = 0.0; diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index 0fb59b8f9..a70596a63 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -77,7 +77,7 @@ bool ShkrebkoMCalcOfIntegralRectTBB::PostProcessingImpl() { } double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, - const std::vector &h) { + const std::vector &h) const { if (start_idx >= end_idx) { return 0.0; } @@ -99,7 +99,7 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { for (std::size_t dim_idx = 0; dim_idx < dim; ++dim_idx) { - point[dim_idx] = limits[dim_idx].first + ((static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]); + point[dim_idx] = limits[dim_idx].first + (static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]; } block_sum += local_input_.func(point); From e032bff9daa36089baddbc98448b273589ac9aa2 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Thu, 9 Apr 2026 23:57:41 +0300 Subject: [PATCH 09/10] fix --- tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp index 5eb370735..8fe00d042 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/include/ops_tbb.hpp @@ -23,7 +23,7 @@ class ShkrebkoMCalcOfIntegralRectTBB : public BaseTask { bool PostProcessingImpl() override; private: - double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h) const; + [[nodiscard]] double ComputeBlockSum(std::size_t start_idx, std::size_t end_idx, const std::vector &h) const; InType local_input_; double res_ = 0.0; From 4b0a97f7874c28d9fcb80d1ad080c14a32bd1999 Mon Sep 17 00:00:00 2001 From: Shkrebko-Misha Date: Fri, 10 Apr 2026 00:34:37 +0300 Subject: [PATCH 10/10] fix --- tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp index a70596a63..71e0cda50 100644 --- a/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp +++ b/tasks/shkrebko_m_calc_of_integral_rect/tbb/src/ops_tbb.cpp @@ -99,7 +99,7 @@ double ShkrebkoMCalcOfIntegralRectTBB::ComputeBlockSum(std::size_t start_idx, st for (std::size_t iter = 0; iter < (end_idx - start_idx); ++iter) { for (std::size_t dim_idx = 0; dim_idx < dim; ++dim_idx) { - point[dim_idx] = limits[dim_idx].first + (static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]; + point[dim_idx] = limits[dim_idx].first + ((static_cast(indices[dim_idx]) + 0.5) * h[dim_idx]); } block_sum += local_input_.func(point);