Tpetra BCRS: Replace LittleBlock and LittleVector with unmanaged LayoutRight Kokkos::View
Created by: mhoemmen
@trilinos/tpetra @trilinos/ifpack2 @crtrott @kyungjoo-kim @amklinv
In Tpetra::Experimental::BlockCrsMatrix, replace LittleBlock and LittleVector with unmanaged LayoutRight Kokkos::View
(of rank 2 resp. 1). Please retain the typedefs little_block_type, const_little_block_type, little_vec_type, and const_little_vec_type, but use Kokkos::View
for these instead of LittleBlock resp. LittleVector.
You must use LayoutRight, because users' code explicitly assumes LayoutRight. Later we can relax this assumption, but for now please retain it. Please specify LayoutRight explicitly in the View types, because otherwise it will have the wrong layout with Cuda (whose default layout is LayoutLeft).
Please note that this will affect Ifpack2 as well as Sierra Aero (please contact the relevant developers of the latter to ensure that we don't break their code). Some Ifpack2 solvers (in particular, block ILU(k)) use these classes and depend on the particular form of their constructors. For example, LittleBlock's constructor takes two strides -- a row stride and a column stride. Thus, this is not an entirely trivial change in Ifpack2. However, all use of these classes in Tpetra and Ifpack2 assumes unit-stride LittleVector and row-major LittleBlock, so you may make this assumption when modifying code.
These changes will have the following beneficial effects:
- Less code to compile (four classes per (Scalar, LocalOrdinal) combination, as well as templated BLAS 1, 2, and 3 functions)
- Simplify transition of Tpetra BlockCrsMatrix to a completely Kokkos-based implementation, thus facilitating good manycore performance
They incur the risk of slightly more struct copy overhead (Kokkos::View
has a bit more state than LittleBlock and LittleVector) in computational kernels, but kernels might not want to pass structs around anyway for best performance.