opm-simulators
Loading...
Searching...
No Matches
Opm::gpuistl::PreconditionerConvertFieldTypeAdapter< CudaPreconditionerType, M, X, Y, l > Class Template Reference

Converts the field type (eg. More...

#include <PreconditionerConvertFieldTypeAdapter.hpp>

Inheritance diagram for Opm::gpuistl::PreconditionerConvertFieldTypeAdapter< CudaPreconditionerType, M, X, Y, l >:
Dune::PreconditionerWithUpdate< X, Y >

Public Types

using matrix_type = typename std::remove_const<M>::type
 The matrix type the preconditioner is for.
using domain_type = X
 The domain type of the preconditioner.
using range_type = Y
 The range type of the preconditioner.
using field_type = typename X::field_type
 The field type of the preconditioner.
using domain_type_to = typename CudaPreconditionerType::domain_type
using range_type_to = typename CudaPreconditionerType::range_type
 The range type of the preconditioner.
using field_type_to = typename domain_type_to::field_type
 The field type of the preconditioner.
using block_type = typename domain_type::block_type
using XTo = Dune::BlockVector<Dune::FieldVector<field_type_to, block_type::dimension>>
using YTo = Dune::BlockVector<Dune::FieldVector<field_type_to, block_type::dimension>>
using matrix_type_to

Public Member Functions

 PreconditionerConvertFieldTypeAdapter (const M &matrix)
 Constructor.
virtual void pre (X &x, Y &b) override
 Not used at the moment.
virtual void apply (X &v, const Y &d) override
 Apply the preconditoner.
virtual void post (X &x) override
 Not used at the moment.
virtual Dune::SolverCategory::Category category () const override
 Category of the preconditioner (see SolverCategory::Category).
virtual void update () override
const matrix_type_to & getConvertedMatrix () const
void setUnderlyingPreconditioner (const std::shared_ptr< CudaPreconditionerType > &conditioner)
virtual bool hasPerfectUpdate () const override

Detailed Description

template<class CudaPreconditionerType, class M, class X, class Y, int l = 1>
class Opm::gpuistl::PreconditionerConvertFieldTypeAdapter< CudaPreconditionerType, M, X, Y, l >

Converts the field type (eg.

double to float) to benchmark single precision preconditioners

Note
This is not a fast conversion, it is simply meant to benchmark the potential of some preconditioners on consumer grade GPUs where the double precision performance is often artificially limited.
In theory this can do any field_type conversion that is meaningful, but it is only tested on double to float conversion.
Remember to set the underlying preconditioner with setUnderlyingPreconditioner (should use the matrix from getConvertedMatrix())
One could simply change the constructor design by accepting a creator function for the underlying preconditioner. For the current use cases this is however not needed.

To use this, use something like the following code:

Member Typedef Documentation

◆ matrix_type_to

template<class CudaPreconditionerType, class M, class X, class Y, int l = 1>
using Opm::gpuistl::PreconditionerConvertFieldTypeAdapter< CudaPreconditionerType, M, X, Y, l >::matrix_type_to
Initial value:

Constructor & Destructor Documentation

◆ PreconditionerConvertFieldTypeAdapter()

template<class CudaPreconditionerType, class M, class X, class Y, int l = 1>
Opm::gpuistl::PreconditionerConvertFieldTypeAdapter< CudaPreconditionerType, M, X, Y, l >::PreconditionerConvertFieldTypeAdapter ( const M & matrix)
inlineexplicit

Constructor.

Parameters
matrixThe matrix to operate on.
Note
After the PreconditionerConvertFieldTypeAdapter you can get the converted matrix by calling getConvertedMatrix(), which in turn can be used to create the underlying preconditioner. Once the underlying preconditioner has been called, this must be supplied to setUnderlyingPreconditioner.

Member Function Documentation

◆ hasPerfectUpdate()

template<class CudaPreconditionerType, class M, class X, class Y, int l = 1>
virtual bool Opm::gpuistl::PreconditionerConvertFieldTypeAdapter< CudaPreconditionerType, M, X, Y, l >::hasPerfectUpdate ( ) const
inlineoverridevirtual

◆ update()

template<class CudaPreconditionerType, class M, class X, class Y, int l = 1>
virtual void Opm::gpuistl::PreconditionerConvertFieldTypeAdapter< CudaPreconditionerType, M, X, Y, l >::update ( )
inlineoverridevirtual

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