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

Convert a CPU matrix to a GPU matrix and use a CUDA preconditioner on the GPU. More...

#include <PreconditionerCPUMatrixToGPUMatrix.hpp>

Inheritance diagram for Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix< X, Y, CudaPreconditionerType, CPUMatrixType >:
Dune::PreconditionerWithUpdate< X, Y >

Public Types

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.

Public Member Functions

template<typename... Args>
 PreconditionerCPUMatrixToGPUMatrix (const CPUMatrixType &A, Args &&... args)
void pre (X &x, Y &b) override
 Prepare the preconditioner.
void apply (X &v, const Y &d) override
 Apply the preconditoner.
void post (X &x) override
 Clean up.
Dune::SolverCategory::Category category () const override
 Category of the preconditioner (see SolverCategory::Category).
void update () override
 Copies the CPU matrix to the GPU matrix then calls the GPU preconditioner update function.
virtual bool hasPerfectUpdate () const override

Static Public Member Functions

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

Detailed Description

template<class X, class Y, class CudaPreconditionerType, class CPUMatrixType>
class Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix< X, Y, CudaPreconditionerType, CPUMatrixType >

Convert a CPU matrix to a GPU matrix and use a CUDA preconditioner on the GPU.

The use case is having a CPU matrix created by a CPU simulator being solved by a GPU BICGSTAB solver.

Template Parameters
Xthe domain type (should be on the GPU). Typicall a GpuVector
Ythe range type (should be on the GPU). Typicall a GpuVector
CudaPreconditionerTypethe preconditioner taking GpuVector<real_type> as arguments to apply and expecting a GPU matrix as the first argument to its constructor.
CPUMatrixTypethe type of the CPU matrix. This is the type that will be copied to the GPU.

Member Function Documentation

◆ apply()

template<class X, class Y, class CudaPreconditionerType, class CPUMatrixType>
void Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix< X, Y, CudaPreconditionerType, CPUMatrixType >::apply ( X & v,
const Y & d )
inlineoverride

Apply the preconditoner.

◆ hasPerfectUpdate()

template<class X, class Y, class CudaPreconditionerType, class CPUMatrixType>
virtual bool Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix< X, Y, CudaPreconditionerType, CPUMatrixType >::hasPerfectUpdate ( ) const
inlineoverridevirtual

◆ post()

template<class X, class Y, class CudaPreconditionerType, class CPUMatrixType>
void Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix< X, Y, CudaPreconditionerType, CPUMatrixType >::post ( X & x)
inlineoverride

Clean up.

Currently not supported.

◆ pre()

template<class X, class Y, class CudaPreconditionerType, class CPUMatrixType>
void Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix< X, Y, CudaPreconditionerType, CPUMatrixType >::pre ( X & x,
Y & b )
inlineoverride

Prepare the preconditioner.

Currently not supported.

◆ update()

template<class X, class Y, class CudaPreconditionerType, class CPUMatrixType>
void Opm::gpuistl::PreconditionerCPUMatrixToGPUMatrix< X, Y, CudaPreconditionerType, CPUMatrixType >::update ( )
inlineoverridevirtual

Copies the CPU matrix to the GPU matrix then calls the GPU preconditioner update function.

Implements Dune::PreconditionerWithUpdate< X, Y >.


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