Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType > Class Template Reference

Makes a CUDA preconditioner available to a CPU simulator. More...

#include <PreconditionerAdapter.hpp>

Inheritance diagram for Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >:
Inheritance graph

Public Types

using domain_type = X
 The domain type of the preconditioner. More...
 
using range_type = Y
 The range type of the preconditioner. More...
 
using field_type = typename X::field_type
 The field type of the preconditioner. More...
 

Public Member Functions

 PreconditionerAdapter (std::shared_ptr< CudaPreconditionerType > preconditioner)
 Constructor. More...
 
virtual void pre (X &x, Y &b) override
 Prepare the preconditioner. More...
 
virtual void apply (X &v, const Y &d) override
 Apply the preconditoner. More...
 
virtual void post (X &x) override
 Clean up. More...
 
Dune::SolverCategory::Category category () const override
 Category of the preconditioner (see SolverCategory::Category) More...
 
virtual void update () override
 Calls update on the underlying CUDA preconditioner. More...
 
virtual std::shared_ptr< Dune::PreconditionerWithUpdate< CuVector< field_type >, CuVector< field_type > > > getUnderlyingPreconditioner () override
 getUnderlyingPreconditioner gets the underlying preconditioner (preconditioner being held) More...
 

Static Public Member Functions

static constexpr bool shouldCallPre ()
 
static constexpr bool shouldCallPost ()
 

Detailed Description

template<class X, class Y, class CudaPreconditionerType>
class Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >

Makes a CUDA preconditioner available to a CPU simulator.

The use case for this adapter is to use a CUDA preconditioner during a linear solver that works on the CPU. The motivation for this is benchmarking new preconditioners on the GPU.

Template Parameters
Xthe domain type (should be on the CPU). Typicall a Dune::BlockVector
Ythe range type (should be on the CPU). Typicall a Dune::BlockVector
CudaPreconditionerTypethe preconditioner taking CuVector<real_type> as arguments to apply

Member Typedef Documentation

◆ domain_type

template<class X , class Y , class CudaPreconditionerType >
using Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::domain_type = X

The domain type of the preconditioner.

◆ field_type

template<class X , class Y , class CudaPreconditionerType >
using Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::field_type = typename X::field_type

The field type of the preconditioner.

◆ range_type

template<class X , class Y , class CudaPreconditionerType >
using Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::range_type = Y

The range type of the preconditioner.

Constructor & Destructor Documentation

◆ PreconditionerAdapter()

template<class X , class Y , class CudaPreconditionerType >
Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::PreconditionerAdapter ( std::shared_ptr< CudaPreconditionerType >  preconditioner)
inlineexplicit

Constructor.

Constructor gets all parameters to operate the prec.

Parameters
AThe matrix to operate on.
wThe relaxation factor.

Member Function Documentation

◆ apply()

template<class X , class Y , class CudaPreconditionerType >
virtual void Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::apply ( X &  v,
const Y &  d 
)
inlineoverridevirtual

Apply the preconditoner.

◆ category()

template<class X , class Y , class CudaPreconditionerType >
Dune::SolverCategory::Category Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::category ( ) const
inlineoverride

Category of the preconditioner (see SolverCategory::Category)

◆ getUnderlyingPreconditioner()

template<class X , class Y , class CudaPreconditionerType >
virtual std::shared_ptr< Dune::PreconditionerWithUpdate< CuVector< field_type >, CuVector< field_type > > > Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::getUnderlyingPreconditioner ( )
inlineoverridevirtual

getUnderlyingPreconditioner gets the underlying preconditioner (preconditioner being held)

Implements Opm::cuistl::PreconditionerHolder< CuVector< X::field_type >, CuVector< Y::field_type > >.

◆ post()

template<class X , class Y , class CudaPreconditionerType >
virtual void Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::post ( X &  x)
inlineoverridevirtual

Clean up.

Currently not supported.

◆ pre()

template<class X , class Y , class CudaPreconditionerType >
virtual void Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::pre ( X &  x,
Y &  b 
)
inlineoverridevirtual

Prepare the preconditioner.

Currently not supported.

◆ shouldCallPost()

template<class X , class Y , class CudaPreconditionerType >
static constexpr bool Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::shouldCallPost ( )
inlinestaticconstexpr

◆ shouldCallPre()

template<class X , class Y , class CudaPreconditionerType >
static constexpr bool Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::shouldCallPre ( )
inlinestaticconstexpr

◆ update()

template<class X , class Y , class CudaPreconditionerType >
virtual void Opm::cuistl::PreconditionerAdapter< X, Y, CudaPreconditionerType >::update ( )
inlineoverridevirtual

Calls update on the underlying CUDA preconditioner.

Implements Dune::PreconditionerWithUpdate< X, Y >.


The documentation for this class was generated from the following file: