* 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
- Prior to 48cb54d1, Ceres' fmin/fmax() for Jets followed the convention
of std::min/max(), and always returned the first argument on equality,
irrespective of whether this argument was natively a scalar or a Jet.
- After 48cb54d1, Ceres' fmin/fmax() instead returned the second
argument on equality, again irrespective of whether this argument was
natively a scalar or a Jet.
- Now on equality we average the arguments as Jets, which ensures that
a consistent answer is produced irrespective of the ordering or type
(Jet or scalar) of the input arguments. This also ensures that we
preserve a non-zero derivative where it exists, excluding the edge
case of two Jet inputs with equal but oppositely signed infinitesimal
components.
- We retain the behaviour introduced in 48cb54d1 whereby NaNs are
treated as missing values, following the convention of
std::fmin/fmax().
- Raised as issue #816.
Change-Id: I01217c0e32c1be83be440e4515b57c79dd290923
1. The platform specific threads library is only needed if we actually
use threads. In this case, the library is not optional opposed to
previous logic.
2. Do not hide the find module output to allow the user to understand
what happens in case of a CMake failure to locate Threads.
3. Finally, Threads is private dependency that does need to be
propagated to consumers unless Ceres was compiled as a static
library.
Change-Id: I8d9d9cd42930e1ed234f69a2dba70d0ee2755b4e
Depending on the compiler in use, linking against OpenMP may require
passing specific compiler flags instead of linking against a library.
Use the CMake OpenMP find module to abstract OpenMP activation.
Change-Id: Ib43f576ac12e2c5e9598e9586df3dfa018e9c08b
* Previously the Cuda memcheck tests relied on the Cuda binaries being
on the environment PATH. This has been changed instead to use the
path discovered by CMake when searching for Cuda. This has the added
benefit that the memcheck tool will be sure to be from the same Cuda
version install as the version being compiled against.
Change-Id: I650d1bb7e14064ca98a01e3c13eb1bcb772b51cc
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
Previously when using a natural ordering, we had postordering
turned off. This is not a good idea. Enabling postordering will
also has the possibility of improving the size of the supernodes.
Change-Id: I8c270e54751b8bed53b38a0b461f647f5c8f5640
This was an ill-advised and complicated to interpret option
which offers nothing particularly useful.
Change-Id: Ia7741ed62ef977c96fa52299a884e404bee659ac
Thanks to nate-thirdwave@ for pointing this out and offering
a fix.
Also add a TODO about an odd loop in covariance_impl.cc which was
revealed as I was testing the bazel build
https: //github.com/ceres-solver/ceres-solver/issues/800
Change-Id: I87d17155ee43ea2a52b8031177d6b3ac5ae1460a
With this change, the user can now choose between Approximate Minimum
Degree and Nested Dissection as a fill reducing algorithm when using
a sparse direct factorization based linear solver like SPARSE_NORMAL_CHOLESKY
or SPARSE_SCHUR.
Currenly only SUITE_SPARSE is supported. It requires that
SuiteSparse be compiled with Metis support enabled.
On most problems AMD is still the better choice, but in some cases
like the grid3D dataset from https://lucacarlone.mit.edu/datasets/
the solution time with AMD is 57s and with NESDIS 38 on my M1 Mac.
On some other problems at Google we have observed speedups of 10x,
there is also a corresponding decrease in the total amount of memory
used.
This patch is based on the original work done by NeroBurner in
https://ceres-solver-review.googlesource.com/c/ceres-solver/+/20580
1. Add a new enum to the public api LinearSolverOrderingType and
a setting Solver::Options::linear_solver_ordering_type.
2. TrustRegionPreprocessor had some complicated logic which determined
when linear solvers should reorder their matrices on their own and not
this has been refactored into a more readable function that lives
inside reorder_program.h/cc.
3. Plumbing in reorder_program.cc and trust_region_processor.cc to use
nested dissection.
4. Update bundle_adjuster.cc to use nested dissection.
Change-Id: I388b027934f86c58b4da2b65a4fa5204ea73bf40
1. Generalize SuiteSparse::AnalyzeCholesky and
SuiteSparse::BlockAnalyzeCholesky from just doing AMD to taking
OrderingType as an argument and using that to determine whether
AMD & Nested Dissection algorithms are used for computing the
fill-reducing ordering or a natural ordering when computing
the symbolic factorization.
2. Remove AnalyzeCholeskyWithNaturalOrdering.
3. Replace and generalize SuiteSparse::BlockAMDOrdering with
SuiteSparse::BlockOrdering which also takes OrderingType as an
argument. Same for SuiteSparse::ApproximateMinimumDegreeOrdering
and SuiteSparse::NestedDissectionOrdering by
SuiteSparse::Ordering.
4. Remove LinearSolver::Options::use_postordering and replace it
with LinearSolver::Options::ordering_type.
5. Replace Preconditioner::Options::use_postordering and replace it
with Preconditioner::Options::ordering_type.
6. Add NESDIS to OrderingType. With the above changes, the linear
solvers can now use Nested Dissection once this information
is piped through the nonlinear solver.
Change-Id: Ib8e93fbf34ae2981bf2ac54dcda9e25c7c213790
With this change we can drop the complicated/conditional handling
around CAMD and assume that it is always available.
Change-Id: I93e1da676fb75817f79824b8b2b6549d03f278b0
Instead of having four separate scalars, allocate them as
an array as they are all touched as a group of four.
Change-Id: I773cfc08cf53b66032985c11a4b0ebc06db06083
Compiling jet_test using the /std:c++17 switch triggers a C3198 compile
error in <numeric>. Moving #pragma below all the includes, allows to
workaround the issue.
Additionally, locally ensure the floating-point model is always
/fp:precise to be able to access the floating-point environment in
jet_test.
Change-Id: Ia5b3a3dac13baf46546ac1d0d304fc05512f8816
pair_hash.h uses std::size_t and std::hash but does not include the
corresponding headers <cstddef> and <functional>.
Change-Id: I194a5c76e8f50b1574e1359f616351581033c576
* Use generator expression instead of CMAKE_RUNTIME_OUTPUT_DIRECTORY
to get the path of compiled CUDA test targets when running
cuda-memcheck tests.
* Only add cuda-memcheck targets if testing is enabled.
Change-Id: Idea498dd9008b7e5075d4af9775f9f43716e22f1
covariance.h was using SUITE_SPARSE even when SUITESPARSE
was disabled because it did not have config.h included in it
so it did not see that CERES_NO_SUITESPARSE was defined.
Add more config.h includes to files that are using these
configuration macros.
Change-Id: I6b1d2c2bd9e559de40a6332cd6be85ad4da3377b
Overriding export gflags export macros breaks glog in shared Ceres
solver builds. Threfore, always compile gtest as a static library to
avoid the need of overriding the export macros.
Change-Id: Ibc9a04a771085caa8f02c81745ce626643df8450
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
In many cases, manifolds stored in ProductManifold have a default
constructor which can simplify ProductManifold initialization even
further. Allow default construction of ProductManifold in this case.
Change-Id: I29b2612870c02232556688019a77049709684a55
* Fix workspace type in CUDADenseQR and CUDADenseCholesky --
Workspace sizes are in terms of number of elements, not bytes.
* Add cuda-memcheck tests to catch such CUDA memory errors in
the future.
Change-Id: I3dd0f0947daba9e4c6cd0216bef81d694547d505
Since the number of manifolds used to initialize ProductManifold and
their types are known at compile-time, it is possible to avoid storing
pointers to the base class as required by a homogeneous, currently
dynamically sized container. Instead, we can use std::tuple<> as a
heterogenous container with the number of elements fixed at compile-time
that allows us to store the concrete manifold realizations.
The advantage of this approach is that we can bypass the vtable when
iterating over each manifold within ProductManifold. The indirection is
invoked only once while accessing the ProductManifoldImpl members.
Additionally, potential dynamic memory allocations by a std::vector can
be completely avoided. This makes the ProductManifold implementation
more efficient both in memory and runtime.
Change-Id: Ic71b0c175ab726f8992e9703f7666bca477baf19
Previously they were defined in manifold.h but their implementations
were in the internal directory and to prevent circular dependencies
the implementation headers were pushed to the bottom of manifold.h
This started out as one header and has become progressively worse
as more manifolds are templated.
This change moves the two manifolds into their own headers which
also contain their implementations.
Change-Id: I671da0279a47cd2ff1f52c69a1d159426f55bd80
This brings it in line with other manifolds like SphereManifold
and LineManifold, where the user has the choice to specify the size
of the manifold at compile time or runtime.
Most of the time the size is known at compile time so this will
speed up the common case.
Change-Id: I0c7ff8b7a9a64a81203eb11afc074874e208815a