Hi,
we're fairly new to experimenting with Ceres and so far had some very good results but also some limitations that we've encountered and would like to get your impression and support on fixing those.
The first issue that we encountered is related to an integer overflow in block_sparse_matrix.cc. It seems like Ceres counts the number of non-zero entries and stores the result in an integer.
This integer will overflow if the number of non-zero entries adds up to more than
2147483648 entries. What we're doing internally is estimating two parameters with a dimension of 4 each. On top of that each residual block in our Cost Function has a dimension of 4.
Starting from there the math seems to tell us that we will overflow as soon as we input more than 67108864.0 (67mio) residual blocks into our system. The formula I used to calculate this is: numParameters * parameterDimension * numResidualBlocks * residualDimension = num non-zeros.
From our testing this value seems to correlate with the assert in block_sparse_matrix.cc triggering. Although this is quite a large number of residual blocks we do hit this value. We sometimes estimate up to 40k parameters (with a dimension of 4 each).
We are already removing outliers and reducing the redundancy as much as possible before inputting the data into Ceres, but since we have a lot of dependencies between the different residuals we're having trouble to do this without sacrificing quality.
Another issue we have is that the estimation is taking up quite a lot of memory. Attached is a graph showing memory consumption. I put the part where residuals are added to the problem into a green box and the solving part into an orange box:

As you can see we have quite a significant peak when starting to solve. The scale of the memory usage grows with the number of residual blocks that we add.
We were hoping that using SPARSE_NORMAL_CHOLESKY would be enough for us to be able to deal with this size of systems, but we're running out of memory on a 32GB machine when adding ~40mio residual blocks.
Do you have any suggestions for further configuring Ceres to reduce the amount of memory used and avoiding to run into the integer overflow issue described above?
What we're currently using for building:
CUSTOM_BLAS=OFF
CXSPARSE=OFF
CXX11_THREADS=OFF
CXX11=ON
EIGENSPARSE=ON
GFLAGS=OFF
LAPACK=OFF
MINIGLOG=ON
MINIGLOG_MAX_LOG_LEVEL=-4
OPENMP=OFF
SUITESPARSE=OFF
TBB=ON
What we use for solving:
SPARSE_NORMAL_CHOLESKY and automatic differentiation
On top of that we did turn enable_fast_removal on since we're iteratively removing outliers from the Problem
Thanks a lot in advance,
Tobias