Ifpack2::BlockRelaxation: Refactor so each Container does multiple solves
Created by: mhoemmen
@trilinos/ifpack2 @csiefer2 @jhux2
This work will enable thread parallelization across inner ("Container") solves, for outer block Jacobi or a single color of block Gauss-Seidel / SOR.
This refactor will have the beneficial side effect of making the second template parameter (ContainerType
) of BlockRelaxation optional and unnecessary. This is just like what we did with Ifpack2::AdditiveSchwarz a while back.
Here is a gradual porting strategy:
ContainerType
template parameter Container<MatrixType>
1. Make the default value of BlockRelaxation’s This doesn’t actually change the tests. Tests at this point will still specify a nondefault second template parameter explicitly. Ditto for BlockRelaxation's explicit template instantiation (ETI).
Container<MatrixType>
instances
2. Write a factory to create template<class MatrixType>
Teuchos::RCP<Container<MatrixType> >
createContainer (const std::string& containerName, const Teuchos::RCP<const MatrixType>& A, const Teuchos::ArrayView<const typename MatrixType::local_ordinal_type>& localRows);
Put this function in the Ifpack2::Details
namespace. You shouldn’t have to change any Container subclasses to do this. Create a new header file Ifpack2_Details_createContainer.hpp. It will unfortunately (currently) need to include all the header files for all the Container subclasses.
ContainerType
constructor invocations in BlockRelaxation with factory calls
3. Replace See the implementation of Ifpack2::BlockRelaxation::ExtractSubmatrices
. Replace ContainerType
constructor invocations with calls to createContainer
.
4. Change tests, examples, and instantiations of BlockRelaxation to leave off the second template parameter (so it uses the default)
If users actually do specify the second template parameter to be a concrete subclass of Container, you’ll have to map from the class name to the string (to pass into createContainer
).
Every Container subclass needs a static (class) function that returns its name. This can be passed into createContainer
.
5. Change Container and its subclasses to do all the blocks (a whole color’s worth) inside; make BlockRelaxation use this
This is the actual work. I will describe this in more detail below.
It’s important to test against MueLu, because MueLu uses Ifpack2::BlockRelaxation for Vanka smoothing.
Think about how to do Step 5 in a way that allows porting one Container subclass at a time to do all the block solves inside.