Loading...
Searching...
No Matches
Opm::Accelerator::rocsparseCPR< Scalar, block_size > Class Template Reference

This class implements a Constrained Pressure Residual (CPR) preconditioner. More...

`#include <rocsparseCPR.hpp>`

Inheritance diagram for Opm::Accelerator::rocsparseCPR< Scalar, block_size >:

## Public Member Functions

| rocsparseCPR (int verbosity)
bool | initialize (std::shared_ptr< BlockedMatrix< Scalar > > matrix, std::shared_ptr< BlockedMatrix< Scalar > > jacMatrix, rocsparse_int *d_Arows, rocsparse_int *d_Acols) override
| Initialize GPU and allocate memory.
bool | analyze_matrix (BlockedMatrix< Scalar > *mat) override
| Analysis, extract parallelism if specified.
bool | analyze_matrix (BlockedMatrix< Scalar > *mat, BlockedMatrix< Scalar > *jacMat) override
| Analysis, extract parallelism if specified.
bool | create_preconditioner (BlockedMatrix< Scalar > *mat) override
| Create AMG preconditioner and perform ILU decomposition.
bool | create_preconditioner (BlockedMatrix< Scalar > *mat, BlockedMatrix< Scalar > *jacMat) override
| Create AMG preconditioner and perform ILU decomposition.
void | apply (const Scalar &y, Scalar &x, WellContributions< Scalar > &wellContribs) override
| Apply preconditioner, x = prec(y) applies blocked ilu0 also applies amg for pressure component.
void | copy_system_to_gpu (Scalar *b) override
| Copy matrix A values to GPU.
void | update_system_on_gpu (Scalar *vals, Scalar *b) override
| Update linear system to GPU.
Public Member Functions inherited from Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >
void | set_matrix_analysis (rocsparse_mat_descr descr_L, rocsparse_mat_descr descr_U)
void | set_context (rocsparse_handle handle, rocblas_handle blas_handle, rocsparse_direction dir, rocsparse_operation operation, hipStream_t stream)
void | setJacMat (const BlockedMatrix< Scalar > &jacMat)
Public Member Functions inherited from Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >
virtual void | apply (const ApplyScalar &y, ApplyScalar &x, WellContributions< Scalar > &wellContribs)=0

## Additional Inherited Members

Static Public Member Functions inherited from Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >
static std::unique_ptr< rocsparsePreconditioner< Scalar, block_size > > | create (PreconditionerType type, int verbosity)
Static Public Member Functions inherited from Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >
static std::unique_ptr< Preconditioner > | create (PreconditionerType type, bool opencl_ilu_parallel, int verbosity)
Public Attributes inherited from Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >
int | nnzbs_prec = 0
bool | useJacMatrix = false
std::shared_ptr< BlockedMatrix< Scalar > > | jacMat {}
Protected Types inherited from Opm::Accelerator::CprCreation< Scalar, block_size >
using | DuneMat = Dune::BCRSMatrix<Dune::FieldMatrix<Scalar, 1, 1> >
using | DuneVec = Dune::BlockVector<Dune::FieldVector<Scalar, 1> >
using | MatrixOperator = Dune::MatrixAdapter<DuneMat, DuneVec, DuneVec>
using | DuneAmg = Dune::Amg::MatrixHierarchy<MatrixOperator, Dune::Amg::SequentialInformation>
Protected Member Functions inherited from Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >
| rocsparsePreconditioner (int verbosity_)
Protected Member Functions inherited from Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >
| Preconditioner (int verbosity_)
Protected Member Functions inherited from Opm::Accelerator::CprCreation< Scalar, block_size >
void | analyzeHierarchy ()
void | analyzeAggregateMaps ()
bool | create_preconditioner_amg (BlockedMatrix< Scalar > *mat)
Protected Attributes inherited from Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >
rocsparse_handle | handle
rocblas_handle | blas_handle
rocsparse_direction | dir = rocsparse_direction_row
rocsparse_operation | operation = rocsparse_operation_none
rocsparse_mat_descr | descr_L
rocsparse_mat_descr | descr_U
hipStream_t | stream
Protected Attributes inherited from Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >
int | N = 0
int | Nb = 0
int | nnz = 0
int | nnzb = 0
int | verbosity = 0
Protected Attributes inherited from Opm::Accelerator::CprCreation< Scalar, block_size >
int | num_levels
std::vector< Scalar > | weights
std::vector< Scalar > | coarse_vals
std::vector< Scalar > | coarse_x
std::vector< Scalar > | coarse_y
std::vector< Matrix< Scalar > > | Amatrices
std::vector< Matrix< Scalar > > | Rmatrices
std::vector< std::vector< int > > | PcolIndices
std::vector< std::vector< Scalar > > | invDiags
BlockedMatrix< Scalar > * | mat = nullptr
std::unique_ptr< DuneAmg > | dune_amg
std::unique_ptr< DuneMat > | dune_coarse
std::shared_ptr< MatrixOperator > | dune_op
std::vector< int > | level_sizes
std::vector< std::vector< int > > | diagIndices
std::conditional_t< std::is_same_v< Scalar, double >, Dune::UMFPack< DuneMat >, int > | umfpack
bool | always_recalculate_aggregates = false
bool | recalculate_aggregates = true
const int | pressure_idx = 1
unsigned | num_pre_smooth_steps
unsigned | num_post_smooth_steps

## Detailed Description

template<class Scalar, unsigned int block_size>
class Opm::Accelerator::rocsparseCPR< Scalar, block_size >

This class implements a Constrained Pressure Residual (CPR) preconditioner.

## Member Function Documentation

## analyze_matrix() [1/2]

template<class Scalar, unsigned int block_size>

bool Opm::Accelerator::rocsparseCPR< Scalar, block_size >::analyze_matrix | ( | BlockedMatrix< Scalar > * | mat | ) |

override virtual

Analysis, extract parallelism if specified.

Parameters

  [in] | mat | matrix A

Implements Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >.

## analyze_matrix() [2/2]

template<class Scalar, unsigned int block_size>

bool Opm::Accelerator::rocsparseCPR< Scalar, block_size >::analyze_matrix | ( | BlockedMatrix< Scalar > * | mat,
|  | BlockedMatrix< Scalar > * | jacMat )

override virtual

Analysis, extract parallelism if specified.

Parameters

  [in] | mat | matrix A
  [in] | jacMat | matrix for preconditioner, analyze this as well

Implements Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >.

## apply()

template<class Scalar, unsigned int block_size>

void Opm::Accelerator::rocsparseCPR< Scalar, block_size >::apply | ( | const Scalar & | y,
|  | Scalar & | x,
|  | WellContributions< Scalar > & | wellContribs )

override

Apply preconditioner, x = prec(y) applies blocked ilu0 also applies amg for pressure component.

Parameters

  [in] | y | Input y vector
  [out] | x | Output x vector
  | wellContribs | Well contributions

## copy_system_to_gpu()

template<class Scalar, unsigned int block_size>

void Opm::Accelerator::rocsparseCPR< Scalar, block_size >::copy_system_to_gpu | ( | Scalar * | b | ) |

override virtual

Copy matrix A values to GPU.

Parameters

  [in] | b | Input values

Implements Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >.

## create_preconditioner() [1/2]

template<class Scalar, unsigned int block_size>

bool Opm::Accelerator::rocsparseCPR< Scalar, block_size >::create_preconditioner | ( | BlockedMatrix< Scalar > * | mat | ) |

override virtual

Create AMG preconditioner and perform ILU decomposition.

Parameters

  [in] | mat | matrix A

Implements Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >.

## create_preconditioner() [2/2]

template<class Scalar, unsigned int block_size>

bool Opm::Accelerator::rocsparseCPR< Scalar, block_size >::create_preconditioner | ( | BlockedMatrix< Scalar > * | mat,
|  | BlockedMatrix< Scalar > * | jacMat )

override virtual

Create AMG preconditioner and perform ILU decomposition.

Parameters

  [in] | mat | matrix A
  [in] | jacMat | matrix for preconditioner, decompose this one if used

Implements Opm::Accelerator::Preconditioner< Scalar, block_size, ApplyScalar >.

## initialize()

template<class Scalar, unsigned int block_size>

bool Opm::Accelerator::rocsparseCPR< Scalar, block_size >::initialize | ( | std::shared_ptr< BlockedMatrix< Scalar > > | matrix,
|  | std::shared_ptr< BlockedMatrix< Scalar > > | jacMatrix,
|  | rocsparse_int * | d_Arows,
|  | rocsparse_int * | d_Acols )

override virtual

Initialize GPU and allocate memory.

Parameters

  [in] | matrix | matrix A
  [in] | jacMatrix | matrix for preconditioner
  [in] | d_Arows | Array of matrix row indices
  [in] | d_Acols | Array of matrix column indices

Implements Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >.

## update_system_on_gpu()

template<class Scalar, unsigned int block_size>

void Opm::Accelerator::rocsparseCPR< Scalar, block_size >::update_system_on_gpu | ( | Scalar * | vals,
|  | Scalar * | b )

override virtual

Update linear system to GPU.

Parameters

  [in] | vals | Matrix values
  [in] | b | input vector, contains N values

Implements Opm::Accelerator::rocsparsePreconditioner< Scalar, block_size >.

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

- opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.hpp
- opm/simulators/linalg/gpubridge/rocm/rocsparseCPR.cpp