Force use of single-thread in Problem::Evaluate() without OpenMP.

- Ensure that, as in the preprocessor, we force num_threads to be 1
  if Ceres was compiled without OpenMP to prevent a CHECK() failure
  in internal code.

Change-Id: I49d7bdeff81e5bb24aaaa3945018d9d012cd9df9
This commit is contained in:
Alex Stewart
2015-03-15 18:11:17 +00:00
committed by Sameer Agarwal
parent 8db90ca2f6
commit ffa324765e
+8
View File
@@ -731,7 +731,15 @@ bool ProblemImpl::Evaluate(const Problem::EvaluateOptions& evaluate_options,
// the Evaluator decides the storage for the Jacobian based on the
// type of linear solver being used.
evaluator_options.linear_solver_type = SPARSE_NORMAL_CHOLESKY;
#ifndef CERES_USE_OPENMP
LOG_IF(WARNING, evaluate_options.num_threads > 1)
<< "OpenMP support is not compiled into this binary; "
<< "only evaluate_options.num_threads = 1 is supported. Switching "
<< "to single threaded mode.";
evaluator_options.num_threads = 1;
#else
evaluator_options.num_threads = evaluate_options.num_threads;
#endif // CERES_USE_OPENMP
string error;
scoped_ptr<Evaluator> evaluator(