Use CMake's standard package discovery output and FeatureSummary instead
of custom status messages, so configuration reports package
availability, versions, and failure reasons consistently. Rename Ceres
feature controls to use the WITH_ prefix to group them consistently and
eliminate inconcistent naming. Remove retrospective cache updates so
package discovery preserves caller-provided values and avoids
unnecessary side effects.
Fixes#876
Change-Id: Ib6e40d56a0ea89b292fe34554777593ffda95f42
Ceres requires the CHOLMOD supernodal factorization and SPQR components
of SuiteSparse, which are only available under GPL or commercial terms.
Because SuiteSparse was previously autodetected and linked whenever
present, a default build could silently become GPL licensed without the
user choosing that outcome.
Make SuiteSparse support opt-in by defaulting SUITESPARSE to OFF,
document the licensing implications in the installation guide.
Fixes#1026
Change-Id: I1cfb2148b830a72fa18caadcff76f35a50aeb179
Fix the generated cmake-config file to look for the used Abseil-cpp
config files providing the needed targets.
When using Abseil from system (or locally installed and set via
`absl_DIR`) the used targets like `absl::log` need to be made available
in downstream projects using `ceres-solver`.
For system packages with no `absl_VERSION` info check for the required
target `absl::absl_vlog_is_on`, just like we do in `CMakeLists.txt`.
Error on installation/export of "no-absl-VERSION" as we can't check
version mismatches.
When using `abseil-cpp` as submodule the abseil-configs are added to the
install target as well. Use these config files to make the needed Abseil
targets available.
In the submodule case extract the `absl_VERSION` variable from its
`CMakeLists.txt` file for us to check against in the generated
cmake-config-file.
Fixes: https://github.com/ceres-solver/ceres-solver/issues/1089
Change-Id: I3e3d079ddf931e7fe1b57783471c32c19e4d31b6
Previously the find_package call was followed by a manual version
check because we were using a Major.Minor version. Just checking
for Major version works.
Change-Id: If83f8d1c6001d0ac3d53d9b24946b9168eb4932b
Add special handling when `absl_VERSION` is empty. This is
the case when the `master` branch of `abseil-cpp` was installed using
`CMake`. In that case check for VLOG availability through the CMake
target `absl::absl_vlog_is_on`.
Fixes: https://github.com/ceres-solver/ceres-solver/issues/1098
Change-Id: I3367aeb65caceb11558d8d6265dafe3ecc9a4875
1. The required version of Abseil is now 20240116.0 instead of 20240116.2.
This was an oversight. Thanks to @NeroBurner for pointing this out.
Both CMake and Bazel builds are updated.
2. Unbreak the Bazel build which had become stale.
Change-Id: I274bbad2f94f7710387f9693de9c66b035758970
Starting with SuiteSparse version 7.4.0 CHOLMOD has support for single
precision matrices. This allows us to have single precision and mixed
precision solves when using the SUITE_SPARSE backend.
This CL also fixes sparse_cholesky_test which was completely broken for
single precision testing.
Sample performance on my Mac.
/usr/bin/time -l ./bin/bundle_adjuster --input=../../Downloads/problem-3068-310854-pre.txt
<SNIP>
Cost:
Initial 9.099334e+07
Final 4.161838e+06
Change 8.683150e+07
Minimizer iterations 6
Successful steps 4
Unsuccessful steps 2
Time (in seconds):
Preprocessor 2.528222
Residual only evaluation 0.142804 (5)
Jacobian & residual evaluation 0.424014 (4)
Linear solver 54.083396 (5)
Minimizer 54.895752
Postprocessor 0.024564
Total 57.448539
Termination: NO_CONVERGENCE (Maximum number of iterations reached. Number of iterations: 5.)
59.04 real 341.24 user 5.49 sys
5776375808 maximum resident set size
<SNIP>
616329634071 instructions retired
929475980510 cycles elapsed
5375034560 peak memory footprint
/usr/bin/time -l ./bin/bundle_adjuster --input=../../Downloads/problem-3068-310854-pre.txt -mixed_precision_solves
<SNIP>
Cost:
Initial 9.099334e+07
Final 4.148930e+06
Change 8.684441e+07
Minimizer iterations 6
Successful steps 4
Unsuccessful steps 2
Time (in seconds):
Preprocessor 2.580217
Residual only evaluation 0.144098 (5)
Jacobian & residual evaluation 0.396723 (4)
Linear solver 23.636074 (5)
Minimizer 24.427163
Postprocessor 0.023790
Total 27.031170
Termination: NO_CONVERGENCE (Maximum number of iterations reached. Number of iterations: 5.)
28.58 real 128.53 user 2.37 sys
4818386944 maximum resident set size
<SNIP>
395186936091 instructions retired
368802808856 cycles elapsed
4327029824 peak memory footprint
Change-Id: I1f137b0dd12da8da7f9ced338dd8f20f4bbdf99d
If the user has checked out the submodules in third_party, they will be
used, otherwise we will try and find the system installed versions of
these dependencies and use them if they are modern enough.
Change-Id: I52164bc48a6ea804b85cdda05fee9cb94632f6c0
1. Add abseil-cpp as a submodule. We are tracking the latest LTS
release, which is lts_2024_01_16.
2. Replace glog/gflags with absl::log and absl::flags.
3. Remove miniglog
4. Also take a whack at making the bazel build work with
abseil-cpp and gtest.
There are a number of TODOs in this CL that still need to be resolved.
Change-Id: I39355ed7d61375be4ebcbc8596d9cc70acc1c678
cuDSS could be used as an alternative for SuiteSparse and EigenSparse
in case if CUDA capable GPU is available.
Change-Id: I7a567093ce91363478118153e181134ed5804573
Compilation fails if the CUDA architecture is not supported by the
installed version of the CUDA toolkit. This commit sets the
CMAKE_CUDA_ARCHITECTURES depending on the the installed CUDA toolkit
version.
Change-Id: I4765512279ee56897388e6ea22b961aebeb0fbca
Previously, MSVC warning C4996 was suppressed unconditionally in the
entire code base which made it difficult identifying and fixing specific
problems, particularly those in the public interface.
Prefer now to disable warnings at the specific location they occur. This
approach, however, reveals an inconsistency in how Ceres handles POSIX
functions which are declared deprecated by MSVC. Specifically, Bessel
functions use the underscore form whereas the read function does not. To
simplify the logic, we revert to POSIX compatible functions.
C++23 also deprecates std::numeric_limits<T>::has_denorm which MSVC
warns about. Here, we disable the deprecation warning locally to avoid
the warning leaking into the user code.
Fixes#1013
Change-Id: Ida8457cc8dd8770b4384a7c49d16f213b02cdec4
* Make sphinx_rtd_theme a find module component to avoid hard-wiring it
into the module and allowing to report the theme in case it is missing
using the standard CMake package mechanism.
* Adjust find module cache variables names case to match the find module
name.
* Also report sphinx-build version for completeness.
* Invoke the find module only once. Calling find_package on the same
module is not needed.
Change-Id: I9d1bf0fcc0d44b9b37e624128812f348c5442ada
Given we no longer support Ubuntu 18.04 due to packaged GCC lacking
C++17 support we can bump the minimum required CMake version to the one
provided by Ubuntu 20.04 which is CMake 3.16. Consequently, this allows
to drop some of the legacy CMake logic.
Change-Id: I1f05d4c5681d10aa7faa0800ef4a803be2f5b7dd
This avoids the following CMake error when exporting Ceres build
directory to local CMake package registry:
export called with target "ceres" which requires target
"ceres_cuda_kernels" that is not in any export set.
Fixes#966
Change-Id: I5a75191fc414a3f138b19cb9d5850f7330f2d24a
Without this we start getting errors related to FindSphinx.cmake
I am not sure yet, what version of cmake we can assume in the wild
but the current minimum version supports the old behaviour and this
policy seems relatively recent (CMake version 3.27) so we should
have this workaround till we update our minimum required version.
Fixes https://github.com/ceres-solver/ceres-solver/issues/1002
Change-Id: I1beaac9ee27bc9ff85b64f53f72606a0424f2391
- In the top-level CMakeLists.txt, certain flags are passed to
disable warnings and increase the maximum size of an object file.
nvcc cannot handle these flags so we tell CMake to only use them
for C++ code (and not CUDA code).
- In internal/ceres/CMakeLists.txt, CMake is originally told to link
the import library cudart.lib when linking CUDA code. By default,
it seems that Visual Studio will link the static library
cudart_static.lib when linking CUDA code. So we avoid linking with
cudart.lib to avoid linking the same library twice.
Change-Id: I1fbf0d7e76d57b4338708757b27f5074722608cb
Since c++11, we can depend on C++ threads always being available.
With the recent work on the performance of CXX threading, the
additional complexity of maintaining multiple backends for some
minor performance delta is not worth it
https://github.com/ceres-solver/ceres-solver/issues/886
Change-Id: Idee480b22a498daec9c4366da8589aa58eaf36a1
- Enables relocatable installs if the CUDA libraries are not installed
in a location on the LD_LIBRARY_PATH.
- Also bump the minimum CMake version to 3.11 to reflect the issue
reported in #903.
Change-Id: I333882b7238c76104d739c7054f29cc35cc4e919
* Renamed several interfaces to CudaBuffer for clarity and consistency.
* Added unit tests for custom Cuda kernels.
* Set specific CUDA architectures if the CMake version supports it.
Change-Id: I269fb1089b80b25e17bca772ef8d70e7894214b8
- Also fixes behaviour of EIGENMETIS option to match that of the other
CMake dependency options, and ensure that its value aligns exactly
with whether Eigen support for METIS will be compiled into Ceres.
Change-Id: Ifbf6f5d82b9ba89a156673eb6042519a985e6b04
* Split `CERES_NO_METIS` into two defines: `CERES_NO_PARTITION` and
`CERES_NO_METIS`. The former refers to METIS support in SuiteSparse,
the latter to the Eigen's MetisSupport module. This enables the use of
sparse matrix reordering independent from SuiteSparse.
* Run Linux, macOS, and macOS Github workflows with METIS enabled
SuiteSparse.
Fixes#808
Change-Id: I5076b7e1268d32cc3e7e56650edcbaf7fb3b59ce
Eigen provides all the functionality that we need from CXSparse
with a more liberal license.
I will update the documentation in a follow up CL.
Change-Id: I0b9fd8be3c27754cc2986cc0e06595c8b3fdec0b
With this change we can drop the complicated/conditional handling
around CAMD and assume that it is always available.
Change-Id: I93e1da676fb75817f79824b8b2b6549d03f278b0
These changes allow the use of a SuiteSparse CMake package from
https://github.com/sergiud/SuiteSparse that allows native compilation of
SuiteSparse using CMake on a variety of platforms Packages generated
using official SuiteSparse makefiles can still be used without
modifications. The find module remains agnostic to specific CMake
package implementation.
CMake packages have the advantage that they are self-contained and
relocatable. The latter is particularly useful in cross-compilation
scenarios.
Fixes#728
Change-Id: I089d5c6f87c05b1530a5ab9a36dff2fcbe82d13d
Disable the definition of `min`/`max` macros by defining `NOMINMAX`
and prevent macro substitution in the public interface.
Also, quiet floating-point comparisons are defined as template functions
by the MSVC STL which causes compilation errors due to ambiguities in
resolving the template parameter types.
Fixes#668Fixes#716Fixes#718
Change-Id: I5fe7832a6a3a7ad0421a2557527528c34b88e9c7
Remove logic invoked based on obsolete variable definitions. Use new
(explicit) target_link_libraries syntax to link binaries against
dependencies. Do not rely on prior knowledge about the compiler for
specifying flags and system libraries but instead directly test their
presence to be more robust.
Change-Id: I76e0d10fae6eba4b343048e4404f0a9b08c7cb6c
Current language standard selection mechanism is quite convoluted and
the logic for propagating a specific C++ language standard (which cannot
be fully enforced anyway) is unnecessarily complicated. Instead
communicate the minimum required C++ standard and let CMake handle the
requirement. This allows the compiler and consumers to use newer
language revisions if available. The language standard used to compile
Ceres solver can still be set via `CMAKE_CXX_STANDARD`.
Move to CMake 3.10 which is supported by Ubuntu 18.04 LTS and simplify
the corresponding language features request.
Change-Id: Ib1f95e2bc5f06bf1275a62565d303eb0f114d127
Current language standard selection mechanism is quite convoluted and
the logic for propagating a specific C++ language standard (which cannot
be fully enforced anyway) is unnecessarily complicated. Instead
communicate the minimum required C++ standard and let CMake handle the
requirement. This allows the compiler and consumers to use newer
language revisions if available. The language standard used to compile
Ceres solver can still be set via `CMAKE_CXX_STANDARD`.
Move to CMake 3.10 which is supported by Ubuntu 18.04 LTS and simplify
the corresponding language features request.
Change-Id: Id3526c69990315289e7ea0fbcdeaa6af79d24d03
1. Add CUDADenseQR & tests.
CUDADenseQR uses the cuSolverDN LAPACK implementation
of QR factorization. A key limitation, however, is that
this solver does not perform singularity checking --
this is because cuSolverDN does not have a trtrs
implementation; we instead use cuBLAS' trsv for
backsubstitution.
2. All CPU -> GPU memory transfers are now async, and both
CUDADenseQR and CUDADenseCholesky explicitly manage their
own streams for async operations.
3. Simplified CUDADenseCholesky to only use the legacy 32-bit
cuSolverDN API.
Change-Id: I2a9b7b65469658ddfe33b5b2a3892c8744d6e437
Currently, the logic for exporting symbols is rather complicated: when
tests are enabled internal symbols are exported in addition to the
public symbols. Such logic causes several problems. (1) Test binaries
link against a Ceres build that is different from the final release
since fewer optimizations are applied if more symbols are exported. (2)
Also, some toolchains hide symbols by default breaking the existing
logic eventually causing linker errors.
Since internal symbols are not intended to be used outside of the
project, we can compile them into object files and use exactly the same
binary code both for the final build and the tests without relying on
conditionals.
By default, all symbols are now hidden unless annotated as public.
Internal symbols are explicitly marked as not being exported in case
users chose not to hide symbols by default.
Change-Id: I589dd10be2f6f438508783cf99d141af0120057b
Add [[deprecate]] notices to everything LocalParameterization
related.
Make sure that Ceres can be compiled without triggering
deprecation warnings.
Update the documentation:
a. Add deprecation notices.
b. Document interaction between LocalParameterization and Manifold
coexisting in the Problem.
c. Add documentation for Manifold(s)
Change-Id: Ie4ad48963c83fded86e533c8c60561af402fbaff