diff --git a/internal/ceres/parallel_for.cc b/internal/ceres/parallel_for.cc index 5dbb39a91..133d7ce86 100644 --- a/internal/ceres/parallel_for.cc +++ b/internal/ceres/parallel_for.cc @@ -44,8 +44,6 @@ namespace ceres::internal { -int MaxNumThreadsAvailable() { return ThreadPool::MaxNumThreadsAvailable(); } - void ParallelSetZero(ContextImpl* context, int num_threads, double* values, diff --git a/internal/ceres/parallel_for.h b/internal/ceres/parallel_for.h index 6636da2f1..549dbe592 100644 --- a/internal/ceres/parallel_for.h +++ b/internal/ceres/parallel_for.h @@ -51,9 +51,6 @@ inline decltype(auto) MakeConditionalLock(const int num_threads, : std::unique_lock{m}; } -// Returns the maximum supported number of threads -CERES_NO_EXPORT int MaxNumThreadsAvailable(); - // Execute the function for every element in the range [start, end) with at most // num_threads. It will execute all the work on the calling thread if // num_threads or (end - start) is equal to 1. diff --git a/internal/ceres/preprocessor.cc b/internal/ceres/preprocessor.cc index c80a37d26..83c05d40f 100644 --- a/internal/ceres/preprocessor.cc +++ b/internal/ceres/preprocessor.cc @@ -35,9 +35,9 @@ #include "ceres/callbacks.h" #include "ceres/gradient_checking_cost_function.h" #include "ceres/line_search_preprocessor.h" -#include "ceres/parallel_for.h" #include "ceres/problem_impl.h" #include "ceres/solver.h" +#include "ceres/thread_pool.h" #include "ceres/trust_region_preprocessor.h" namespace ceres::internal { @@ -62,7 +62,7 @@ void ChangeNumThreadsIfNeeded(Solver::Options* options) { if (options->num_threads == 1) { return; } - const int num_threads_available = MaxNumThreadsAvailable(); + const int num_threads_available = ThreadPool::MaxNumThreadsAvailable(); if (options->num_threads > num_threads_available) { LOG(WARNING) << "Specified options.num_threads: " << options->num_threads << " exceeds maximum available from the threading model Ceres "