opm-simulators
Loading...
Searching...
No Matches
Opm::WellContributionsCuda< Scalar > Class Template Reference
Inheritance diagram for Opm::WellContributionsCuda< Scalar >:
Opm::WellContributions< Scalar >

Public Member Functions

void setCudaStream (cudaStream_t stream)
 Set a cudaStream to be used.
void apply (Scalar *d_x, Scalar *d_y)
 Apply all Wells in this object performs y -= (C^T * (D^-1 * (B*x))) for all Wells.
Public Member Functions inherited from Opm::WellContributions< Scalar >
unsigned int getNumWells ()
void addNumBlocks (unsigned int numBlocks)
 Indicate how large the next StandardWell is, this function cannot be called after alloc() is called.
void alloc ()
 Allocate memory for the StandardWells.
virtual ~WellContributions ()
 Empty destructor.
void setBlockSize (unsigned int dim, unsigned int dim_wells)
 Indicate how large the blocks of the StandardWell (C and B) are.
void setVectorSize (unsigned N)
 Set size of vector that the wells are applied to.
void addMatrix (MatrixType type, int *colIndices, Scalar *values, unsigned int val_size)
 Store a matrix in this object, in blocked csr format, can only be called after alloc() is called.
void addMultisegmentWellContribution (unsigned int dim, unsigned int dim_wells, unsigned int Mb, std::vector< Scalar > &Bvalues, std::vector< unsigned int > &BcolIndices, std::vector< unsigned int > &BrowPointers, unsigned int DnumBlocks, Scalar *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector< Scalar > &Cvalues)
 Add a MultisegmentWellContribution, actually creates an object on heap that is destroyed in the destructor Matrices C and B are passed in Blocked CSR, matrix D in CSC.

Protected Types

using MatrixType = typename WellContributions<Scalar>::MatrixType

Protected Member Functions

void APIalloc () override
 Allocate memory for the StandardWells.
void APIaddMatrix (MatrixType type, int *colIndices, Scalar *values, unsigned int val_size) override
 Store a matrix in this object, in blocked csr format, can only be called after alloc() is called.

Protected Attributes

cudaStream_t stream
Scalar * d_Cnnzs = nullptr
Scalar * d_Dnnzs = nullptr
Scalar * d_Bnnzs = nullptr
int * d_Ccols = nullptr
int * d_Bcols = nullptr
Scalar * d_z1 = nullptr
Scalar * d_z2 = nullptr
unsigned int * d_val_pointers = nullptr
Scalar * h_x = nullptr
Scalar * h_y = nullptr
Protected Attributes inherited from Opm::WellContributions< Scalar >
bool allocated = false
unsigned int N
unsigned int dim
unsigned int dim_wells
unsigned int num_blocks = 0
unsigned int num_std_wells = 0
unsigned int num_ms_wells = 0
unsigned int num_blocks_so_far = 0
unsigned int num_std_wells_so_far = 0
std::vector< unsigned int > val_pointers
std::vector< std::unique_ptr< MultisegmentWellContribution< Scalar > > > multisegments

Additional Inherited Members

Public Types inherited from Opm::WellContributions< Scalar >
enum class  MatrixType { C , D , B }
 StandardWell has C, D and B matrices that need to be copied.
using UMFPackIndex = SuiteSparse_long
Static Public Member Functions inherited from Opm::WellContributions< Scalar >
static std::unique_ptr< WellContributionscreate (const std::string &accelerator_mode, bool useWellConn)

Member Function Documentation

◆ APIaddMatrix()

template<class Scalar>
void Opm::WellContributionsCuda< Scalar >::APIaddMatrix ( MatrixType type,
int * colIndices,
Scalar * values,
unsigned int val_size )
overrideprotectedvirtual

Store a matrix in this object, in blocked csr format, can only be called after alloc() is called.

Parameters
[in]typeindicate if C, D or B is sent
[in]colIndicescolumnindices of blocks in C or B, ignored for D
[in]valuesarray of nonzeroes
[in]val_sizenumber of blocks in C or B, ignored for D

Reimplemented from Opm::WellContributions< Scalar >.

◆ APIalloc()

template<class Scalar>
void Opm::WellContributionsCuda< Scalar >::APIalloc ( )
overrideprotectedvirtual

Allocate memory for the StandardWells.

Reimplemented from Opm::WellContributions< Scalar >.

◆ apply()

template<class Scalar>
void Opm::WellContributionsCuda< Scalar >::apply ( Scalar * d_x,
Scalar * d_y )

Apply all Wells in this object performs y -= (C^T * (D^-1 * (B*x))) for all Wells.

Parameters
[in]d_xvector x, must be on GPU
[in,out]d_yvector y, must be on GPU

◆ setCudaStream()

template<class Scalar>
void Opm::WellContributionsCuda< Scalar >::setCudaStream ( cudaStream_t stream)

Set a cudaStream to be used.

Parameters
[in]streamthe cudaStream that is used to launch the kernel in

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