Skip to content

Commit

Permalink
Small improvement. max_num_threads_ always represents what it says
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nachovizzo committed Mar 11, 2024
1 parent af2c31a commit f550a1a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cpp/kiss_icp/core/Registration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<size_t>(threads_num));
static_cast<size_t>(max_num_threads_));
}

Sophus::SE3d Registration::AlignPointsToMap(const std::vector<Eigen::Vector3d> &frame,
Expand Down

0 comments on commit f550a1a

Please sign in to comment.