My Project
bda::openclSolverBackend< block_size > Class Template Reference

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

#include <openclSolverBackend.hpp>

Inheritance diagram for bda::openclSolverBackend< block_size >:
bda::BdaSolver< block_size >

Public Member Functions

 openclSolverBackend (int linear_solver_verbosity, int maxit, double tolerance, unsigned int platformID, unsigned int deviceID, ILUReorder opencl_ilu_reorder)
 Construct a openclSolver. More...
 
 ~openclSolverBackend ()
 Destroy a openclSolver, and free memory.
 
SolverStatus solve_system (int N, int nnz, int dim, double *vals, int *rows, int *cols, double *b, WellContributions &wellContribs, BdaResult &res) override
 Solve linear system, A*x = b, matrix A must be in blocked-CSR format. More...
 
void get_result (double *x) override
 Get result after linear solve, and peform postprocessing if necessary. More...
 
- Public Member Functions inherited from bda::BdaSolver< block_size >
 BdaSolver (int linear_solver_verbosity, int max_it, double tolerance_, unsigned int deviceID_)
 Construct a BdaSolver, can be cusparseSolver, openclSolver, fpgaSolver. More...
 
 BdaSolver (int linear_solver_verbosity, int max_it, double tolerance_, unsigned int platformID_, unsigned int deviceID_)
 
 BdaSolver (std::string fpga_bitstream, int linear_solver_verbosity, int max_it, double tolerance_)
 
virtual ~BdaSolver ()
 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 bda::BdaSolver< block_size >
int verbosity = 0
 
int maxit = 200
 
double tolerance = 1e-2
 
std::string bitstream = ""
 
int N
 
int Nb
 
int nnz
 
int nnzb
 
unsigned int platformID = 0
 
unsigned int deviceID = 0
 
bool initialized = false
 

Detailed Description

template<unsigned int block_size>
class bda::openclSolverBackend< block_size >

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

Constructor & Destructor Documentation

◆ openclSolverBackend()

template<unsigned int block_size>
bda::openclSolverBackend< block_size >::openclSolverBackend ( int  linear_solver_verbosity,
int  maxit,
double  tolerance,
unsigned int  platformID,
unsigned int  deviceID,
ILUReorder  opencl_ilu_reorder 
)

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_reorderselect either level_scheduling or graph_coloring, see BILU0.hpp for explanation

Member Function Documentation

◆ get_result()

template<unsigned int block_size>
void bda::openclSolverBackend< block_size >::get_result ( double *  x)
overridevirtual

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 bda::BdaSolver< block_size >.

◆ solve_system()

template<unsigned int block_size>
SolverStatus bda::openclSolverBackend< block_size >::solve_system ( int  N,
int  nnz,
int  dim,
double *  vals,
int *  rows,
int *  cols,
double *  b,
WellContributions wellContribs,
BdaResult res 
)
overridevirtual

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

Parameters
[in]Nnumber of rows, divide by dim to get number of blockrows
[in]nnznumber of nonzeroes, divide by dim*dim to get number of blocks
[in]nnz_precnumber of nonzeroes of matrix for ILU0, divide by dim*dim to get number of blocks
[in]dimsize of block
[in]valsarray of nonzeroes, each block is stored row-wise and contiguous, contains nnz values
[in]rowsarray of rowPointers, contains N/dim+1 values
[in]colsarray of columnIndices, contains nnz values
[in]vals_precarray of nonzeroes for preconditioner
[in]rows_precarray of rowPointers for preconditioner
[in]cols_precarray of columnIndices for preconditioner
[in]binput vector, contains N values
[in]wellContribsWellContributions, to apply them separately, instead of adding them to matrix A
[in,out]ressummary of solver result
Returns
status code

Implements bda::BdaSolver< block_size >.


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