mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Remove MaxNumThreadsAvailable
It is just a wrapper around ThreadPool::MaxNumThreadsAvailable and has just one callsite. Change-Id: Ic4b496c86a9760d1024ff34db305ea8db99705d8
This commit is contained in:
@@ -44,8 +44,6 @@
|
||||
|
||||
namespace ceres::internal {
|
||||
|
||||
int MaxNumThreadsAvailable() { return ThreadPool::MaxNumThreadsAvailable(); }
|
||||
|
||||
void ParallelSetZero(ContextImpl* context,
|
||||
int num_threads,
|
||||
double* values,
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user