From f550a1a7887838bae436ea527a5fa4e6ccfb75c2 Mon Sep 17 00:00:00 2001 From: Ignacio Vizzo Date: Mon, 11 Mar 2024 18:13:56 +0000 Subject: [PATCH] Small improvement. max_num_threads_ always represents what it says Assuming 10 logical cores: Before Registration::max_num_threads_ == 0, and now Registration::max_num_threads_ == 10. This way we hide less what's going under the hood --- cpp/kiss_icp/core/Registration.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cpp/kiss_icp/core/Registration.cpp b/cpp/kiss_icp/core/Registration.cpp index 4029ace3..1f2bc70d 100644 --- a/cpp/kiss_icp/core/Registration.cpp +++ b/cpp/kiss_icp/core/Registration.cpp @@ -147,14 +147,12 @@ namespace kiss_icp { Registration::Registration(int max_num_iteration, double convergence_criterion, int max_num_threads) : max_num_iterations_(max_num_iteration), convergence_criterion_(convergence_criterion), - max_num_threads_(max_num_threads) { - // Only manipulate the number of threads if the user specifies something greater than 0 - int threads_num = max_num_threads > 0 ? max_num_threads : tbb::info::default_concurrency(); - + // Only manipulate the number of threads if the user specifies something greater than 0 + max_num_threads_(max_num_threads > 0 ? max_num_threads : tbb::info::default_concurrency()) { // This global variable requires static duration storage to be able to manipulate the max // concurrency from TBB across the entire class static const auto g = tbb::global_control(tbb::global_control::max_allowed_parallelism, - static_cast(threads_num)); + static_cast(max_num_threads_)); } Sophus::SE3d Registration::AlignPointsToMap(const std::vector &frame,