Skip to content

Draft: Improve support on BCRS custom allocators

Currently, allocators in the BCRS matrix do not allow certain operations desired when using custom allocators:

  • An allocator that models a standard Allocator requirements will fail to compile in BCRSMatrix and Blocked vectors due to using size_type = A::size_type. This is changed in this MR by invoking the allocator traits using size_type = std::allocator_traits<A>::size_type.
  • The allocator cannot be set a priory. This is unfortunate because stateful allocators would allow contiguous allocation on different BCRS matrices (e.g. sub-blocks of a bigger BCRS matrix) by sharing the allocator between the different matrices. This is changed in this MR by allowing to get and set the allocator and by copying them during matrix copies. Naturally, this does not change the behavior on stateless allocators like std::allocator<B>.

This MR is part of #107 to improve performance on matrices with low number of entries per rows and nested blocking of BCRSMatrix.

Stateful allocators are out of scope of this MR, thus, I cannot provide tests that check correct behavior on other than std::allocator<B>. If you want this functionality, let me know and I can push a MR with an implementation.

Edited by Santiago Ospina De Los Ríos

Merge request reports

Loading