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

This class implements a opencl-based ilu0-bicgstab solver on GPU. More...

#include <openclSolverBackend.hpp>

Inheritance diagram for Opm::Accelerator::openclSolverBackend< Scalar, block_size >:
Opm::Accelerator::BdaSolver< Scalar, block_size >

Public Member Functions

 openclSolverBackend (int linear_solver_verbosity, int maxit, Scalar tolerance, unsigned int platformID, unsigned int deviceID, bool opencl_ilu_parallel, std::string linsolver)
 Construct a openclSolver.
 
 openclSolverBackend (int linear_solver_verbosity, int maxit, Scalar tolerance, bool opencl_ilu_parallel)
 For the CPR coarse solver.
 
SolverStatus solve_system (std::shared_ptr< BlockedMatrix< Scalar > > matrix, Scalar *b, std::shared_ptr< BlockedMatrix< Scalar > > jacMatrix, WellContributions< Scalar > &wellContribs, BdaResult &res) override
 Solve linear system, A*x = b, matrix A must be in blocked-CSR format.
 
void get_result (Scalar *x) override
 Solve scalar linear system, for example a coarse system of an AMG preconditioner Data is already on the GPU.
 
void setOpencl (std::shared_ptr< cl::Context > &context, std::shared_ptr< cl::CommandQueue > &queue)
 Set OpenCL objects This class either creates them based on platformID and deviceID or receives them through this function.
 
- Public Member Functions inherited from Opm::Accelerator::BdaSolver< Scalar, block_size >
 BdaSolver (int linear_solver_verbosity, int max_it, Scalar tolerance_)
 Construct a BdaSolver.
 
 BdaSolver (int linear_solver_verbosity, int max_it, Scalar tolerance_, unsigned int deviceID_)
 
 BdaSolver (int linear_solver_verbosity, int max_it, double tolerance_, unsigned int platformID_, unsigned int deviceID_)
 
virtual ~BdaSolver ()=default
 Define virtual destructor, so that the derivedclass destructor will be called.
 

Public Attributes

std::shared_ptr< cl::Context > context {}
 
std::shared_ptr< cl::CommandQueue > queue {}
 

Additional Inherited Members

- Protected Attributes inherited from Opm::Accelerator::BdaSolver< Scalar, block_size >
int verbosity = 0
 
int maxit = 200
 
Scalar tolerance = 1e-2
 
int N
 
int Nb
 
int nnz
 
int nnzb
 
unsigned int platformID = 0
 
unsigned int deviceID = 0
 
bool initialized = false
 

Detailed Description

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

This class implements a opencl-based ilu0-bicgstab solver on GPU.

Constructor & Destructor Documentation

◆ openclSolverBackend()

template<class Scalar , unsigned int block_size>
Opm::Accelerator::openclSolverBackend< Scalar, block_size >::openclSolverBackend ( int linear_solver_verbosity,
int maxit,
Scalar tolerance,
unsigned int platformID,
unsigned int deviceID,
bool opencl_ilu_parallel,
std::string linsolver )

Construct a openclSolver.

Parameters
[in]linear_solver_verbosityverbosity of openclSolver
[in]maxitmaximum number of iterations for openclSolver
[in]tolerancerequired relative tolerance for openclSolver
[in]platformIDthe OpenCL platform to be used
[in]deviceIDthe device to be used
[in]opencl_ilu_parallelwhether to parallelize the ILU decomposition and application in OpenCL with level_scheduling
[in]linsolverindicating the preconditioner, equal to the –linear-solver cmdline argument only ilu0, cpr_quasiimpes and isai are supported

Member Function Documentation

◆ get_result()

template<class Scalar , unsigned int block_size>
void Opm::Accelerator::openclSolverBackend< Scalar, block_size >::get_result ( Scalar * x)
overridevirtual

Solve scalar linear system, for example a coarse system of an AMG preconditioner Data is already on the GPU.

Get result after linear solve, and peform postprocessing if necessary

Parameters
[in,out]xresulting x vector, caller must guarantee that x points to a valid array

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

◆ setOpencl()

template<class Scalar , unsigned int block_size>
void Opm::Accelerator::openclSolverBackend< Scalar, block_size >::setOpencl ( std::shared_ptr< cl::Context > & context,
std::shared_ptr< cl::CommandQueue > & queue )

Set OpenCL objects This class either creates them based on platformID and deviceID or receives them through this function.

Parameters
[in]contextthe opencl context to be used
[in]queuethe opencl queue to be used

◆ solve_system()

template<class Scalar , unsigned int block_size>
SolverStatus Opm::Accelerator::openclSolverBackend< Scalar, block_size >::solve_system ( std::shared_ptr< BlockedMatrix< Scalar > > matrix,
Scalar * b,
std::shared_ptr< BlockedMatrix< Scalar > > jacMatrix,
WellContributions< Scalar > & wellContribs,
BdaResult & res )
overridevirtual

Solve linear system, A*x = b, matrix A must be in blocked-CSR format.

Parameters
[in]matrixmatrix A
[in]binput vector, contains N values
[in]jacMatrixmatrix for preconditioner
[in]wellContribsWellContributions, to apply them separately, instead of adding them to matrix A
[in,out]ressummary of solver result
Returns
status code

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


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