My Project
|
The CuSparseMatrix class simple wrapper class for a CuSparse matrix. More...
#include <CuSparseMatrix.hpp>
Public Member Functions | |
CuSparseMatrix (const T *nonZeroElements, const int *rowIndices, const int *columnIndices, size_t numberOfNonzeroBlocks, size_t blockSize, size_t numberOfRows) | |
Create the sparse matrix specified by the raw data. | |
CuSparseMatrix (const CuSparseMatrix &)=delete | |
We don't want to be able to copy this for now (too much hassle in copying the cusparse resources) | |
CuSparseMatrix & | operator= (const CuSparseMatrix &)=delete |
We don't want to be able to copy this for now (too much hassle in copying the cusparse resources) | |
void | setUpperTriangular () |
setUpperTriangular sets the CuSparse flag that this is an upper diagonal (with unit diagonal) matrix. | |
void | setLowerTriangular () |
setLowerTriangular sets the CuSparse flag that this is an lower diagonal (with non-unit diagonal) matrix. | |
void | setUnitDiagonal () |
setUnitDiagonal sets the CuSparse flag that this has unit diagional. | |
void | setNonUnitDiagonal () |
setNonUnitDiagonal sets the CuSparse flag that this has non-unit diagional. | |
size_t | N () const |
N returns the number of rows (which is equal to the number of columns) | |
size_t | nonzeroes () const |
nonzeroes behaves as the Dune::BCRSMatrix::nonzeros() function and returns the number of non zero blocks | |
CuVector< T > & | getNonZeroValues () |
getNonZeroValues returns the GPU vector containing the non-zero values (ordered by block) | |
const CuVector< T > & | getNonZeroValues () const |
getNonZeroValues returns the GPU vector containing the non-zero values (ordered by block) | |
CuVector< int > & | getRowIndices () |
getRowIndices returns the row indices used to represent the BSR structure. | |
const CuVector< int > & | getRowIndices () const |
getRowIndices returns the row indices used to represent the BSR structure. | |
CuVector< int > & | getColumnIndices () |
getColumnIndices returns the column indices used to represent the BSR structure. | |
const CuVector< int > & | getColumnIndices () const |
getColumnIndices returns the column indices used to represent the BSR structure. | |
size_t | dim () const |
dim returns the dimension of the vector space on which this matrix acts | |
size_t | blockSize () const |
blockSize size of the blocks | |
detail::CuSparseMatrixDescription & | getDescription () |
getDescription the cusparse matrix description. | |
virtual void | mv (const CuVector< T > &x, CuVector< T > &y) const |
mv performs matrix vector multiply y = Ax | |
virtual void | umv (const CuVector< T > &x, CuVector< T > &y) const |
umv computes y=Ax+y | |
virtual void | usmv (T alpha, const CuVector< T > &x, CuVector< T > &y) const |
umv computes y=alpha * Ax + y | |
template<class MatrixType > | |
void | updateNonzeroValues (const MatrixType &matrix, bool copyNonZeroElementsDirectly=false) |
updateNonzeroValues updates the non-zero values by using the non-zero values of the supplied matrix | |
Static Public Member Functions | |
template<class MatrixType > | |
static CuSparseMatrix< T > | fromMatrix (const MatrixType &matrix, bool copyNonZeroElementsDirectly=false) |
fromMatrix creates a new matrix with the same block size and values as the given matrix | |
The CuSparseMatrix class simple wrapper class for a CuSparse matrix.
T | the type to store. Can be either float, double or int. |
Opm::cuistl::CuSparseMatrix< T >::CuSparseMatrix | ( | const T * | nonZeroElements, |
const int * | rowIndices, | ||
const int * | columnIndices, | ||
size_t | numberOfNonzeroBlocks, | ||
size_t | blockSize, | ||
size_t | numberOfRows | ||
) |
Create the sparse matrix specified by the raw data.
[in] | nonZeroElements | the non-zero values of the matrix |
[in] | rowIndices | the row indices of the non-zero elements |
[in] | columnIndices | the column indices of the non-zero elements |
[in] | numberOfNonzeroElements | number of nonzero elements |
[in] | blockSize | size of each block matrix (typically 3) |
[in] | numberOfRows | the number of rows |
|
inline |
dim returns the dimension of the vector space on which this matrix acts
This is equivalent to matrix.N() * matrix.blockSize()
|
static |
fromMatrix creates a new matrix with the same block size and values as the given matrix
matrix | the matrix to copy from |
copyNonZeroElementsDirectly | if true will do a memcpy from matrix[0][0][0][0], otherwise will build up the non-zero elements by looping over the matrix. Note that setting this to true will yield a performance increase, but might not always yield correct results depending on how the matrix has been initialized. If unsure, leave it as false. |
MatrixType | is assumed to be a Dune::BCRSMatrix compatible matrix. |
|
inline |
getColumnIndices returns the column indices used to represent the BSR structure.
|
inline |
getColumnIndices returns the column indices used to represent the BSR structure.
|
inline |
getDescription the cusparse matrix description.
This description is needed for most calls to the CuSparse library
|
inline |
getNonZeroValues returns the GPU vector containing the non-zero values (ordered by block)
|
inline |
getNonZeroValues returns the GPU vector containing the non-zero values (ordered by block)
|
inline |
getRowIndices returns the row indices used to represent the BSR structure.
|
inline |
getRowIndices returns the row indices used to represent the BSR structure.
|
virtual |
mv performs matrix vector multiply y = Ax
[in] | x | the vector to multiply the matrix with |
[out] | y | the output vector |
|
inline |
nonzeroes behaves as the Dune::BCRSMatrix::nonzeros() function and returns the number of non zero blocks
|
virtual |
umv computes y=Ax+y
[in] | x | the vector to multiply with A |
[in,out] | y | the vector to add and store the output in |
void Opm::cuistl::CuSparseMatrix< T >::updateNonzeroValues | ( | const MatrixType & | matrix, |
bool | copyNonZeroElementsDirectly = false |
||
) |
updateNonzeroValues updates the non-zero values by using the non-zero values of the supplied matrix
matrix | the matrix to extract the non-zero values from |
copyNonZeroElementsDirectly | if true will do a memcpy from matrix[0][0][0][0], otherwise will build up the non-zero elements by looping over the matrix. Note that setting this to true will yield a performance increase, but might not always yield correct results depending on how the matrix matrix has been initialized. If unsure, leave it as false. |
MatrixType | is assumed to be a Dune::BCRSMatrix compatible matrix. |
|
virtual |
umv computes y=alpha * Ax + y
[in] | x | the vector to multiply with A |
[in,out] | y | the vector to add and store the output in |