Remove MaxNumThreadsAvailable

It is just a wrapper around ThreadPool::MaxNumThreadsAvailable
and has just one callsite.

Change-Id: Ic4b496c86a9760d1024ff34db305ea8db99705d8
This commit is contained in:
Sameer Agarwal
2023-10-09 05:59:28 -07:00
parent 354002f989
commit b379ab768c
3 changed files with 2 additions and 7 deletions
-2
View File
@@ -44,8 +44,6 @@
namespace ceres::internal {
int MaxNumThreadsAvailable() { return ThreadPool::MaxNumThreadsAvailable(); }
void ParallelSetZero(ContextImpl* context,
int num_threads,
double* values,
-3
View File
@@ -51,9 +51,6 @@ inline decltype(auto) MakeConditionalLock(const int num_threads,
: std::unique_lock<std::mutex>{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.
+2 -2
View File
@@ -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 "