Skip to content

Reduce Memory Consumption in Smoother #315

Description

@julianlitz
template <typename T>
class BatchedTridiagonalSolver
{
public:
    BatchedTridiagonalSolver(int matrix_dimension, int batch_count, bool is_cyclic = true)
        : matrix_dimension_(matrix_dimension)
        , batch_count_(batch_count)
        , main_diagonal_("BatchedTridiagonalSolver::main_diagonal", matrix_dimension * batch_count)
        , sub_diagonal_("BatchedTridiagonalSolver::sub_diagonal", matrix_dimension * batch_count)
        , buffer_("BatchedTridiagonalSolver::buffer", is_cyclic ? matrix_dimension * batch_count : 0)
        , gamma_("BatchedTridiagonalSolver::gamma", is_cyclic ? batch_count : 0)
        , is_cyclic_(is_cyclic)
        , is_factorized_(false)
    {
        assign(main_diagonal_, T(0));
        assign(sub_diagonal_, T(0));
    }

We dont need to allocate buffer here. It can be supplied externally in the solve() method.

This reduces the memory usage in the smoother by 50% and ~10% overall.

Note that often the radial section does contain more nodes then the circular section, so this is probably less dramatic and not really noticeable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions