1. Rename it to small_blas_gemv_benchmark.cc to better reflect
its coverage.
2. Simplify the data generation.
3. Make the two vectors and the matrix in each element live in
separate arrays to ensure that they are not cache coherent.
4. Use "Apply" instead of ArgPair to simplify and unify the
matrix sizes.
5. Update the benchmark numbers and move them to a json
file in the benchmarks directory.
Change-Id: Iaf3764083f902258def739c4be42e0580be103cb
Change 12060 added parallel_for_tbb.cc and parallel_for_test.cc but did not add
it to the bazel build rule.
Tested by running bazel tests.
Change-Id: I286cf0e191e0353f2c0266911a79e01f09e47343
This is in preparation for adding support for a C++11 based parallel
for implementation. The code is behind CERES_USE_CXX11_THREADS which
is not exposed to the user yet.
Tested by building with and without CERES_USE_CXX11_THREADS defined
and the tests pass.
Change-Id: I60f5730fa055feeb0ee0fa6c980633aebd8d87b4
The key idea being, use some subset of the rows of the Jacobian
as the preconditioner.
This CL only implements the preconditioner assuming that the row
selection has already been done. How the rows are selected will be
left to the user based on their knowledge of the problem.
A follow up CL will hook this preconditioner into the rest of the
solver.
Change-Id: I3e18dc57811116534e9ddf35d7b154bcce496d3b
The bundle adjustment test is extremely slow to
run (especially in debug or fastbuild), and since
it is in one binary, there is no way to get CMake
or Bazel to parallelize the test execution.
This change divides the test into a single binary
for each configuration, making parallelized
execution possible.
In this patch, only the Bazel build is updated to
use the new test. The old test still exists to
retain parity with the CMake build. A followup
change will complete the process of adding
equivalent test execution to the CMake build.
Example build output:
% bazel test -c opt :all
INFO: Analysed 123 targets (15 packages loaded).
INFO: Found 2 targets and 121 test targets...
INFO: From Compiling external/com_github_google_glog/src/logging.cc:
external/com_github_google_glog/src/logging.cc: In static member function 'static void google::LogMessage::Fail()':
external/com_github_google_glog/src/logging.cc:1518:1: warning: 'noreturn' function does return
}
^
INFO: Elapsed time: 98.056s, Critical Path: 23.80s
INFO: Build completed successfully, 976 total actions
//:array_utils_test PASSED in 0.1s
//:autodiff_cost_function_test PASSED in 0.2s
//:autodiff_local_parameterization_test PASSED in 0.2s
//:autodiff_test PASSED in 0.1s
//:ba_denseschur_auto_test PASSED in 5.3s
//:ba_denseschur_auto_threads_test PASSED in 0.1s
//:ba_denseschur_user_test PASSED in 5.3s
//:ba_denseschur_user_threads_test PASSED in 0.1s
//:ba_iterschur_jacobi_auto_test PASSED in 6.2s
//:ba_iterschur_jacobi_auto_threads_test PASSED in 0.1s
//:ba_iterschur_jacobi_user_test PASSED in 6.0s
//:ba_iterschur_jacobi_user_threads_test PASSED in 0.2s
//:ba_iterschur_schurjacobi_auto_test PASSED in 6.1s
//:ba_iterschur_schurjacobi_auto_threads_test PASSED in 0.2s
//:ba_iterschur_schurjacobi_user_test PASSED in 5.7s
//:ba_iterschur_schurjacobi_user_threads_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clustjacobi_auto_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clustjacobi_auto_threads_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clustjacobi_user_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clustjacobi_user_threads_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clusttri_auto_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clusttri_auto_threads_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clusttri_user_test PASSED in 0.1s
//:ba_iterschur_suitesparse_clusttri_user_threads_test PASSED in 0.1s
//:ba_sparsecholesky_cxsparse_auto_test PASSED in 0.2s
//:ba_sparsecholesky_cxsparse_auto_threads_test PASSED in 0.2s
//:ba_sparsecholesky_cxsparse_user_test PASSED in 0.1s
//:ba_sparsecholesky_cxsparse_user_threads_test PASSED in 0.1s
//:ba_sparsecholesky_eigensparse_auto_test PASSED in 0.1s
//:ba_sparsecholesky_eigensparse_auto_threads_test PASSED in 0.1s
//:ba_sparsecholesky_eigensparse_user_test PASSED in 0.2s
//:ba_sparsecholesky_eigensparse_user_threads_test PASSED in 0.1s
//:ba_sparsecholesky_suitesparse_auto_test PASSED in 0.1s
//:ba_sparsecholesky_suitesparse_auto_threads_test PASSED in 0.3s
//:ba_sparsecholesky_suitesparse_user_test PASSED in 0.1s
//:ba_sparsecholesky_suitesparse_user_threads_test PASSED in 0.2s
//:ba_sparseschur_cxsparse_auto_test PASSED in 0.1s
//:ba_sparseschur_cxsparse_auto_threads_test PASSED in 0.2s
//:ba_sparseschur_cxsparse_user_test PASSED in 0.1s
//:ba_sparseschur_cxsparse_user_threads_test PASSED in 0.2s
//:ba_sparseschur_eigensparse_auto_test PASSED in 0.2s
//:ba_sparseschur_eigensparse_auto_threads_test PASSED in 0.2s
//:ba_sparseschur_eigensparse_user_test PASSED in 0.1s
//:ba_sparseschur_eigensparse_user_threads_test PASSED in 0.2s
//:ba_sparseschur_suitesparse_auto_test PASSED in 0.3s
//:ba_sparseschur_suitesparse_auto_threads_test PASSED in 0.2s
//:ba_sparseschur_suitesparse_user_test PASSED in 0.2s
//:ba_sparseschur_suitesparse_user_threads_test PASSED in 0.2s
//:block_jacobi_preconditioner_test PASSED in 0.1s
//:block_random_access_dense_matrix_test PASSED in 0.2s
//:block_random_access_diagonal_matrix_test PASSED in 0.4s
//:block_random_access_sparse_matrix_test PASSED in 0.2s
//:block_sparse_matrix_test PASSED in 0.2s
//:c_api_test PASSED in 0.2s
//:canonical_views_clustering_test PASSED in 0.4s
//:compressed_col_sparse_matrix_utils_test PASSED in 0.3s
//:compressed_row_sparse_matrix_test PASSED in 0.3s
//:conditioned_cost_function_test PASSED in 0.2s
//:conjugate_gradients_solver_test PASSED in 0.2s
//:corrector_test PASSED in 0.2s
//:cost_function_to_functor_test PASSED in 0.1s
//:covariance_test PASSED in 0.1s
//:cubic_interpolation_test PASSED in 0.2s
//:dense_linear_solver_test PASSED in 0.1s
//:dense_sparse_matrix_test PASSED in 0.4s
//:detect_structure_test PASSED in 0.3s
//:dogleg_strategy_test PASSED in 0.4s
//:dynamic_autodiff_cost_function_test PASSED in 0.2s
//:dynamic_compressed_row_sparse_matrix_test PASSED in 0.2s
//:dynamic_numeric_diff_cost_function_test PASSED in 0.1s
//:dynamic_sparse_normal_cholesky_solver_test PASSED in 0.4s
//:dynamic_sparsity_test PASSED in 0.3s
//:evaluator_test PASSED in 0.2s
//:gradient_checker_test PASSED in 0.2s
//:gradient_checking_cost_function_test PASSED in 0.2s
//:gradient_problem_solver_test PASSED in 0.2s
//:gradient_problem_test PASSED in 0.4s
//:graph_algorithms_test PASSED in 0.4s
//:graph_test PASSED in 0.2s
//:householder_vector_test PASSED in 0.2s
//:implicit_schur_complement_test PASSED in 0.2s
//:inner_product_computer_test PASSED in 0.3s
//:invert_psd_matrix_test PASSED in 0.1s
//:is_close_test PASSED in 0.4s
//:iterative_schur_complement_solver_test PASSED in 0.3s
//:jet_test PASSED in 0.3s
//:levenberg_marquardt_strategy_test PASSED in 0.2s
//:line_search_minimizer_test PASSED in 0.2s
//:line_search_preprocessor_test PASSED in 0.1s
//:local_parameterization_test PASSED in 0.1s
//:loss_function_test PASSED in 0.1s
//:minimizer_test PASSED in 0.2s
//:normal_prior_test PASSED in 0.3s
//:numeric_diff_cost_function_test PASSED in 0.2s
//:ordered_groups_test PASSED in 0.2s
//:parameter_block_ordering_test PASSED in 0.2s
//:parameter_block_test PASSED in 0.1s
//:partitioned_matrix_view_test PASSED in 0.1s
//:polynomial_test PASSED in 0.1s
//:problem_test PASSED in 0.1s
//:program_test PASSED in 0.2s
//:reorder_program_test PASSED in 0.2s
//:residual_block_test PASSED in 0.2s
//:residual_block_utils_test PASSED in 0.2s
//:rotation_test PASSED in 7.1s
//:schur_complement_solver_test PASSED in 0.2s
//:schur_eliminator_test PASSED in 0.2s
//:single_linkage_clustering_test PASSED in 0.2s
//:small_blas_test PASSED in 0.2s
//:solver_test PASSED in 0.2s
//:sparse_cholesky_test PASSED in 0.2s
//:sparse_normal_cholesky_solver_test PASSED in 0.2s
//:system_test PASSED in 0.1s
//:tiny_solver_autodiff_function_test PASSED in 0.2s
//:tiny_solver_cost_function_adapter_test PASSED in 0.1s
//:tiny_solver_test PASSED in 0.1s
//:triplet_sparse_matrix_test PASSED in 0.2s
//:trust_region_minimizer_test PASSED in 0.2s
//:trust_region_preprocessor_test PASSED in 0.2s
//:visibility_based_preconditioner_test PASSED in 0.1s
//:visibility_test PASSED in 0.2s
Executed 121 out of 121 tests: 121 tests pass.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.
Change-Id: I32825f1e6278ba69dc296bb2dc05fb8ebda26592
This is in preparation for adding support for a c++11 based parallel
for implementation. The parallel for abstraction does not have the
ability to constrain the total number of threads in nested for loops.
This is solved by distributing the number of threads evenly between
the nested for loops. Adds a TODO to consolidate the next for loops
into a single loop that can be properly split between threads.
Tested by building with TBB and running tests.
Change-Id: I546973b9a4d19b9cdd53caff55d1c80bac8ea953
1. Replace two maps by 1.
2. Update number of calls and the time for the call at the cost
of a single map lookup.
3. Add Solver::Summary::num_linear_solves.
Fixes https://github.com/ceres-solver/ceres-solver/issues/340
Change-Id: I71eb9be7fb363a8cb066591c4c1761f256c81677
1. Fix a typo in auto_diff_cost_function.h
2. Fix and update Solver::Summary::FullReport() text labels.
3. Add logging of the number of residual and jacobian evaluations
to the full report. The GradientProblemSolver already does this.
Change-Id: I41059af5f0ebe0417accbbc30b0808a4b04b9edb
General clean up to the Ceres codebase to remove the functions
Evaluator::Evaluate and ProblemImpl::InternalEvaluate as they are unimplemented.
Change-Id: I77fcb2c5f43aeca69555e953d6472b6c4cd1b778
Most matrices in Ceres are row-major. Eigen does now
allow statically sized row-major matrices with a single
column.
This CL changes the EigenTypes struct to change the definition
of typedefs to change to ColMajor if this is the case.
This will allow Schur specializations (2,1,6) for example.
Change-Id: I24e7b62d4e1cb5660541062336225bbc9c41c6bf
The non-linear least squares solver had the ability to update the
user's parameters every iteration. Now GradientProblemSolver can
do the same.
Also a few minor Sphinx markup related cleanup to the documentation
which were found in the process of updating Sphinx on my machine
and adding the docs for this feature.
This fixes https://github.com/ceres-solver/ceres-solver/issues/246
Change-Id: Ib6b90ac22be8bfb60b14f25ad52082ba371af164
This doesn't add any configurability to ceres_library() yet, but it
does correctly determine the include path for use with -I, allowing
this to be used as a dependency from other workspaces.
Change-Id: I223b6e63c2ea82ab7f552337f78fffd54f20b0e0
This allows building and running the Ceres tests, without
needing any external dependencies; they are downloaded and
compiled automatically thanks to the magic of Bazel.
It also opens the door for other projects that use Ceres
easily thanks to Bazel's external dependency support.
Remaining work:
- Skylark macros to allow different Ceres configurations
- Checking to make sure external projects can use this
- Parallelizing bundle_adjustment_test execution
Sample output:
INFO: Analysed target //:ceres (6 packages loaded).
INFO: Found 1 target...
Target //:ceres up-to-date:
bazel-bin/libceres.a
bazel-bin/libceres.so
INFO: Elapsed time: 103.756s, Critical Path: 13.97s
INFO: Build completed successfully, 131 total actions
Change-Id: I400d3ce43f35b7e7a770da346337e3ffdb500dc2
Would result in compilation error
include/ceres/jet.h:296:59: error: requested alignment is not a positive power of 2
alignas(kAlignment) Eigen::Matrix<T, N, 1, kAlignOrNot> v;
because CERES_JET_ALIGN_BYTES = EIGEN_MAX_ALIGN_BYTES = 0 in that case.
Change-Id: I247653d3b7555e80891d3fb78676acfa302a9e1d
- Update FindSuiteSparse to use FindTBB.cmake to find TBB.
- Fix logic handling of TBB=ON if TBB is not found to continue with
build after disabling TBB rather than throwing a fatal error.
- Use TBB_LIBRARIES instead of TBB_tbb_LIBRARY as a Ceres dependency,
the former also includes the TBB malloc library.
- Add warning message about GPL licensing if TBB version < 2017.
- Add ‘TBB’ & ‘Mulithreading’ component options to find_package(Ceres),
where ‘Mulithreading’ is equivalent to ‘TBB’ || ‘OpenMP’.
Change-Id: Ifc7f1d01b050ba6e2097ad1913b178805df4769a
- Also enable EIGENSPARSE option by default as LGPL licensing
implications are less severe that SuiteSparse’s GPL implications which
is enabled by default.
Change-Id: Ic7e4fef5cef614d5ce719eeefcc35bf4b63b8dac
Fixes the current implementation where the desired number of threads may
not be honored if another tbb::task_scheduler_init is instantiated. We
are using tbb::task_arena to solve this which is only available in newer
versions of TBB.
Also increases the performance by not creating/destroying the TBB setup
via tbb::task_scheduler_init on every iteration evaluation. This
increases the performance in single threaded mode using TBB by 10x.
By not specifically calling tbb::task_scheduler_init, this will either
respect any active tbb::task_scheduler_init instantiations or use the
default TBB settings which is hardware dependent. Ceres will honor the
user's requested number of threads through the task_arenas.
Tested via compiling with TBB enabled and ran the unit tests.
Change-Id: I5538407563449cdb5a0eaf8b8ccab62263912110
- When compiling Ceres without C++11 but with glog, then the unnamed
enum results in a compiler warning when
google::GetReferenceableValue(.) is invoked with the unnamed enum as a
template parameter (unnamed-type-template-args) which was not legal
prior to C++11.
Change-Id: Iddbed05e2199865ab915f2c5817ce917bb0609b5
1. Default linear solver is Eigen::LDLT
2. Options::max_iterations -> Options::max_num_iterations
3. Options::error_threshold -> Options::cost_threshold
4. Options::relative_step_threshold -> Options::parameter_threshold
5. Options::initial_scale_factor -> Options::initial_trust_region_radius
6. The default values of the above parameters have been changed
to match those in ceres::Solver::Options
7. Status::RUNNING has been removed
8. Update now returns a bool instead of a Status enum and
the status handling has been included in the main loop.
9. Summary::gradient_norm has been changed to Summary::gradient_max_norm
to match the convergence test
10. A member variable cost_ has been added which is computed by Update
11. The test for parameter_tolerance based convergence is made
more robust near zero.
12. Use of double has been replaced by Scalar.
13. Minor clang-formatting
Change-Id: I3cb0e2fd0a0204476bb8718761dc740cdf5e42ce
The solver code must rely on the vectors for
sizing, since not all cost functions will have
NumParameters() or NumResiduals().
Change-Id: Id254ce37507443910edb0064de7907d64558851e
1. Default constructor and initialization for Summary.
2. Add Jacobi scaling.
3. Add bounds on the lm diagonal
4. Use the diagonal of J'J as the regularizer instead of identity.
5. Update the computation of rho to match the change in regularization.
As a result of these changes, the performance of TinySolver is
now the same as ceres::Solver, solving 53 out of 54 problems.
Change-Id: Ie08c3389ac2e3964ffa04411734c06b65835358a
1. Instead of Core/LU just include Eigen/Dense
2. Rename SolverParameters to Options and params to options.
3. Rename Results to Summary.
4. Summary::error_magnitude -> Summary::final_cost.
5. Add Summary::initial_cost.
6. Change definitions of Summary::initial_cost and Summary::final_cost
to match those used by Ceres::Solver.
Change-Id: Id64b78398f47810ca25938a15423c514fc8c164d
1. Change the ordering from NUM_PARAMETERS, NUM_RESIDUALS to
NUM_RESIDUALS, NUM_PARAMETERS in docs and in code.
2. TinySolver::solve -> TinySolver::Solve
Change-Id: I4dca87b971fd9168f1200b53c362669cffc82c1b
Tiny solver is targeted towards small dense least square
solves, where the overhead of calling normal Ceres is too
high. For example, when solving for inverse camera
distortion for every pixel location in a many-megapixel
image. Anecdotally, at one point in the past, tiny solver
was ~20x faster than Ceres for the problems it's intended
for. This is due to two key aspects:
1. Memory is allocated up front: repeated solves incur no
allocation overhead beyond a few scalars on the stack.
2. The cost function is fully inlined into the solver
loop, removing even the cost function call overhead.
Tiny solver originated many years ago as part of
libmv/Blender, where it is still used for distortion solving
today, but the time has come for it to migrate into Ceres.
This commit is just the initial import into Ceres. Follow
up patches will add further cleanups, and add CostFunction
and Jet adapters to make it easier to call tiny solver
(though by using adapters, some performance advantages will
be lost).
Change-Id: I8079535cd41382b1e0ac0ca2fca141711c72b7f8