Opm::Accelerator Namespace Reference

Classes

class  amgclSolverBackend
 
class  BdaResult
 
class  BdaSolver
 
class  BlockedMatrix
 
class  CprCreation
 This class implements a Constrained Pressure Residual (CPR) preconditioner. More...
 
class  cusparseSolverBackend
 This class implements a cusparse-based ilu0-bicgstab solver on GPU. More...
 
class  Matrix
 
class  openclBILU0
 
class  openclBISAI
 
class  openclCPR
 This class implements a Constrained Pressure Residual (CPR) preconditioner. More...
 
class  OpenclKernels
 
class  OpenclMatrix
 
class  openclPreconditioner
 
class  openclSolverBackend
 This class implements a opencl-based ilu0-bicgstab solver on GPU. More...
 
class  Preconditioner
 
class  rocalutionSolverBackend
 
class  RocmMatrix
 This struct resembles a csr matrix. More...
 
class  RocmVector
 
class  rocsparseBILU0
 
class  rocsparseCPR
 This class implements a Constrained Pressure Residual (CPR) preconditioner. More...
 
class  rocsparsePreconditioner
 
class  rocsparseSolverBackend
 This class implements a rocsparse-based ilu0-bicgstab solver on GPU. More...
 

Typedefs

using spmv_blocked_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int, const cl::Buffer &, cl::Buffer &, const unsigned int, cl::LocalSpaceArg >
 
using spmv_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int, const cl::Buffer &, cl::Buffer &, cl::LocalSpaceArg >
 
using residual_blocked_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int, cl::Buffer &, const cl::Buffer &, cl::Buffer &, const unsigned int, cl::LocalSpaceArg >
 
using residual_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int, cl::Buffer &, const cl::Buffer &, cl::Buffer &, cl::LocalSpaceArg >
 
using ilu_apply1_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, const cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int, const unsigned int, cl::LocalSpaceArg >
 
using ilu_apply2_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int, const unsigned int, cl::LocalSpaceArg >
 
using stdwell_apply_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int, const unsigned int, cl::Buffer &, cl::LocalSpaceArg, cl::LocalSpaceArg, cl::LocalSpaceArg >
 
using ilu_decomp_kernel_type = cl::KernelFunctor< const unsigned int, const unsigned int, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, const int, cl::LocalSpaceArg >
 
using isaiL_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int >
 
using isaiU_kernel_type = cl::KernelFunctor< cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, cl::Buffer &, const unsigned int >
 

Enumerations

enum class  SolverStatus { BDA_SOLVER_SUCCESS , BDA_SOLVER_ANALYSIS_FAILED , BDA_SOLVER_CREATE_PRECONDITIONER_FAILED , BDA_SOLVER_UNKNOWN_ERROR }
 
enum  PreconditionerType { BILU0 , CPR , BISAI }
 

Functions

void sortRow (int *colIndices, int *data, int left, int right)
 
template<class Scalar >
void blockMultSub (Scalar *a, Scalar *b, Scalar *c, unsigned int block_size)
 
template<class Scalar >
void blockMult (Scalar *mat1, Scalar *mat2, Scalar *resMat, unsigned int block_size)
 
unsigned int ceilDivision (const unsigned int A, const unsigned int B)
 
template<class Scalar >
Scalar get_absmax (const Scalar *data, const int N)
 
template<class Scalar >
void solve_transposed_3x3 (const Scalar *A, const Scalar *b, Scalar *x)
 
std::string getErrorString (cl_int error)
 
std::vector< int > buildCsrToCscOffsetMap (std::vector< int > colPointers, std::vector< int > rowIndices)
 
bool canBeStarted (const int rowIndex, const int *rowPointers, const int *colIndices, const std::vector< bool > &doneRows)
 
void findLevelScheduling (int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices, int *CSCColPointers, int Nb, int *numColors, int *toOrder, int *fromOrder, std::vector< int > &rowsPerColor)
 
void csrPatternToCsc (int *CSRColIndices, int *CSRRowPointers, int *CSCRowIndices, int *CSCColPointers, int Nb)
 

Typedef Documentation

◆ ilu_apply1_kernel_type

using Opm::Accelerator::ilu_apply1_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, const cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int, const unsigned int, cl::LocalSpaceArg>

◆ ilu_apply2_kernel_type

using Opm::Accelerator::ilu_apply2_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int, const unsigned int, cl::LocalSpaceArg>

◆ ilu_decomp_kernel_type

using Opm::Accelerator::ilu_decomp_kernel_type = typedef cl::KernelFunctor<const unsigned int, const unsigned int, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, const int, cl::LocalSpaceArg>

◆ isaiL_kernel_type

using Opm::Accelerator::isaiL_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int>

◆ isaiU_kernel_type

using Opm::Accelerator::isaiU_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int>

◆ residual_blocked_kernel_type

using Opm::Accelerator::residual_blocked_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int, cl::Buffer&, const cl::Buffer&, cl::Buffer&, const unsigned int, cl::LocalSpaceArg>

◆ residual_kernel_type

using Opm::Accelerator::residual_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int, cl::Buffer&, const cl::Buffer&, cl::Buffer&, cl::LocalSpaceArg>

◆ spmv_blocked_kernel_type

using Opm::Accelerator::spmv_blocked_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int, const cl::Buffer&, cl::Buffer&, const unsigned int, cl::LocalSpaceArg>

◆ spmv_kernel_type

using Opm::Accelerator::spmv_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int, const cl::Buffer&, cl::Buffer&, cl::LocalSpaceArg>

◆ stdwell_apply_kernel_type

using Opm::Accelerator::stdwell_apply_kernel_type = typedef cl::KernelFunctor<cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, cl::Buffer&, const unsigned int, const unsigned int, cl::Buffer&, cl::LocalSpaceArg, cl::LocalSpaceArg, cl::LocalSpaceArg>

Enumeration Type Documentation

◆ PreconditionerType

Enumerator
BILU0 
CPR 
BISAI 

◆ SolverStatus

enum class Opm::Accelerator::SolverStatus
strong
Enumerator
BDA_SOLVER_SUCCESS 
BDA_SOLVER_ANALYSIS_FAILED 
BDA_SOLVER_CREATE_PRECONDITIONER_FAILED 
BDA_SOLVER_UNKNOWN_ERROR 

Function Documentation

◆ blockMult()

template<class Scalar >
void Opm::Accelerator::blockMult ( Scalar *  mat1,
Scalar *  mat2,
Scalar *  resMat,
unsigned int  block_size 
)

Perform a matrix-matrix multiplication on two blocks resMat = mat1 * mat2

Parameters
[in]mat1input block 1
[in]mat2input block 2
[out]resMatoutput block
[in]block_sizesize of block

◆ blockMultSub()

template<class Scalar >
void Opm::Accelerator::blockMultSub ( Scalar *  a,
Scalar *  b,
Scalar *  c,
unsigned int  block_size 
)

Multiply and subtract blocks a = a - (b * c)

Parameters
[in,out]ablock to be subtracted from
[in]binput block
[in]cinput block
[in]block_sizesize of block

◆ buildCsrToCscOffsetMap()

std::vector< int > Opm::Accelerator::buildCsrToCscOffsetMap ( std::vector< int >  colPointers,
std::vector< int >  rowIndices 
)

Similar function to csrPatternToCsc. It gives an offset map from CSR to CSC instead of the full CSR to CSC conversion. The map works as follows: if an element 'e' of the matrix is in the i-th position in the CSR representation, it will be in the csrToCscOffsetMap[i]-th position in the CSC representation.

◆ canBeStarted()

bool Opm::Accelerator::canBeStarted ( const int  rowIndex,
const int *  rowPointers,
const int *  colIndices,
const std::vector< bool > &  doneRows 
)

Determine whether all rows that a certain row depends on are done already

Parameters
[in]rowIndexindex of the row that needs to be checked for
[in]rowPointersrow pointers of the matrix that the row is in
[in]colIndicescolumn indices of the matrix that the row is in
[in]doneRowsarray that for each row lists whether it is done or not
Returns
true iff all dependencies are done and if the result itself was not done yet

◆ ceilDivision()

unsigned int Opm::Accelerator::ceilDivision ( const unsigned int  A,
const unsigned int  B 
)

◆ csrPatternToCsc()

void Opm::Accelerator::csrPatternToCsc ( int *  CSRColIndices,
int *  CSRRowPointers,
int *  CSCRowIndices,
int *  CSCColPointers,
int  Nb 
)

Convert a sparsity pattern stored in the CSR format to the CSC format CSCRowIndices and CSCColPointers arrays must be allocated already Based on the csr_tocsc() function from the scipy package from python, https://github.com/scipy/scipy/blob/master/scipy/sparse/sparsetools/csr.h

Parameters
[in]CSRColIndicescolumn indices of the CSR representation of the pattern
[in]CSRRowPointersrow pointers of the CSR representation of the pattern
[in,out]CSCRowIndicesrow indices of the result CSC representation of the pattern
[in,out]CSCColPointerscolumn pointers of the result CSC representation of the pattern
[in]Nbnumber of blockrows in the matrix

◆ findLevelScheduling()

void Opm::Accelerator::findLevelScheduling ( int *  CSRColIndices,
int *  CSRRowPointers,
int *  CSCRowIndices,
int *  CSCColPointers,
int  Nb,
int *  numColors,
int *  toOrder,
int *  fromOrder,
std::vector< int > &  rowsPerColor 
)

Find a level scheduling reordering for an input matrix The toOrder and fromOrder arrays must be allocated already

Parameters
[in]CSRColIndicescolumn indices array, obtained from storing the input matrix in the CSR format
[in]CSRRowPointersrow pointers array, obtained from storing the input matrix in the CSR format
[in]CSCRowIndicesrow indices array, obtained from storing the input matrix in the CSC format
[in]CSCColPointerscolumn pointers array, obtained from storing the input matrix in the CSC format
[in]Nbnumber of blockrows in the matrix
[out]numColorsa pointer to the number of colors needed for the level scheduling
[out]toOrderthe reorder pattern that was found, which lists for each index in the original order, to which index in the new order it should be moved
[out]fromOrderthe reorder pattern that was found, which lists for each index in the new order, from which index in the original order it was moved
[out]rowsPerColorfor each color, an array of all rowIndices in that color, this function uses emplace_back() to fill

◆ get_absmax()

template<class Scalar >
Scalar Opm::Accelerator::get_absmax ( const Scalar *  data,
const int  N 
)

◆ getErrorString()

std::string Opm::Accelerator::getErrorString ( cl_int  error)

Translate OpenCL error codes to strings Integer - String combinations are defined in CL/cl.h

Parameters
[in]errorerror code

◆ solve_transposed_3x3()

template<class Scalar >
void Opm::Accelerator::solve_transposed_3x3 ( const Scalar *  A,
const Scalar *  b,
Scalar *  x 
)

◆ sortRow()

void Opm::Accelerator::sortRow ( int *  colIndices,
int *  data,
int  left,
int  right 
)

Sort a row of matrix elements from a CSR-format, where the nonzeroes are ints These ints aren't actually nonzeroes, but represent a mapping used later

Parameters
[in,out]colIndicesrepresent keys in sorting
[in,out]datasorted according to the colIndices
[in]leftlower index of data of row
[in]rightupper index of data of row