#include <cuWellContributions.hpp>

Inheritance diagram for Opm::WellContributionsCuda< Scalar >:
Inheritance graph

Public Types

using UMFPackIndex = SuiteSparse_long
 

Public Member Functions

 ~WellContributionsCuda () override
 
void setCudaStream (cudaStream_t stream)
 
void apply (Scalar *d_x, Scalar *d_y)
 
unsigned int getNumWells ()
 
void addNumBlocks (unsigned int numBlocks)
 
void alloc ()
 Allocate memory for the StandardWells. More...
 
void setBlockSize (unsigned int dim, unsigned int dim_wells)
 
void setVectorSize (unsigned N)
 
void addMatrix (MatrixType type, int *colIndices, Scalar *values, unsigned int val_size)
 
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)
 

Static Public Member Functions

static std::unique_ptr< WellContributionscreate (const std::string &accelerator_mode, bool useWellConn)
 

Protected Types

using MatrixType = typename WellContributions< Scalar >::MatrixType
 

Protected Member Functions

void APIalloc () override
 Allocate memory for the StandardWells. More...
 
void APIaddMatrix (MatrixType type, int *colIndices, Scalar *values, unsigned int val_size) override
 

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
 
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
 

Member Typedef Documentation

◆ MatrixType

template<class Scalar >
using Opm::WellContributionsCuda< Scalar >::MatrixType = typename WellContributions<Scalar>::MatrixType
protected

◆ UMFPackIndex

template<class Scalar >
using Opm::WellContributions< Scalar >::UMFPackIndex = SuiteSparse_long
inherited

Constructor & Destructor Documentation

◆ ~WellContributionsCuda()

template<class Scalar >
Opm::WellContributionsCuda< Scalar >::~WellContributionsCuda ( )
override

Member Function Documentation

◆ addMatrix()

template<class Scalar >
void Opm::WellContributions< Scalar >::addMatrix ( MatrixType  type,
int *  colIndices,
Scalar *  values,
unsigned int  val_size 
)
inherited

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

◆ addMultisegmentWellContribution()

template<class Scalar >
void Opm::WellContributions< Scalar >::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 
)
inherited

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

Parameters
[in]dimsize of blocks in vectors x and y, equal to MultisegmentWell::numEq
[in]dim_wellssize of blocks of C, B and D, equal to MultisegmentWell::numWellEq
[in]Mbnumber of blockrows in C, B and D
[in]Bvaluesnonzero values of matrix B
[in]BcolIndicescolumnindices of blocks of matrix B
[in]BrowPointersrowpointers of matrix B
[in]DnumBlocksnumber of blocks in D
[in]Dvaluesnonzero values of matrix D
[in]DcolPointerscolumnpointers of matrix D
[in]DrowIndicesrowindices of matrix D
[in]Cvaluesnonzero values of matrix C

◆ addNumBlocks()

template<class Scalar >
void Opm::WellContributions< Scalar >::addNumBlocks ( unsigned int  numBlocks)
inherited

Indicate how large the next StandardWell is, this function cannot be called after alloc() is called

Parameters
[in]numBlocksnumber of blocks in C and B of next StandardWell

◆ alloc()

template<class Scalar >
void Opm::WellContributions< Scalar >::alloc ( )
inherited

Allocate memory for the StandardWells.

◆ 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

◆ create()

template<class Scalar >
static std::unique_ptr< WellContributions > Opm::WellContributions< Scalar >::create ( const std::string &  accelerator_mode,
bool  useWellConn 
)
staticinherited

◆ getNumWells()

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::getNumWells ( )
inlineinherited

◆ setBlockSize()

template<class Scalar >
void Opm::WellContributions< Scalar >::setBlockSize ( unsigned int  dim,
unsigned int  dim_wells 
)
inherited

Indicate how large the blocks of the StandardWell (C and B) are

Parameters
[in]dimnumber of columns
[in]dim_wellsnumber of rows

◆ 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

◆ setVectorSize()

template<class Scalar >
void Opm::WellContributions< Scalar >::setVectorSize ( unsigned  N)
inherited

Set size of vector that the wells are applied to

Parameters
[in]Nsize of vector

Member Data Documentation

◆ allocated

template<class Scalar >
bool Opm::WellContributions< Scalar >::allocated = false
protectedinherited

◆ d_Bcols

template<class Scalar >
int* Opm::WellContributionsCuda< Scalar >::d_Bcols = nullptr
protected

◆ d_Bnnzs

template<class Scalar >
Scalar* Opm::WellContributionsCuda< Scalar >::d_Bnnzs = nullptr
protected

◆ d_Ccols

template<class Scalar >
int* Opm::WellContributionsCuda< Scalar >::d_Ccols = nullptr
protected

◆ d_Cnnzs

template<class Scalar >
Scalar* Opm::WellContributionsCuda< Scalar >::d_Cnnzs = nullptr
protected

◆ d_Dnnzs

template<class Scalar >
Scalar* Opm::WellContributionsCuda< Scalar >::d_Dnnzs = nullptr
protected

◆ d_val_pointers

template<class Scalar >
unsigned int* Opm::WellContributionsCuda< Scalar >::d_val_pointers = nullptr
protected

◆ d_z1

template<class Scalar >
Scalar* Opm::WellContributionsCuda< Scalar >::d_z1 = nullptr
protected

◆ d_z2

template<class Scalar >
Scalar* Opm::WellContributionsCuda< Scalar >::d_z2 = nullptr
protected

◆ dim

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::dim
protectedinherited

◆ dim_wells

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::dim_wells
protectedinherited

◆ h_x

template<class Scalar >
Scalar* Opm::WellContributionsCuda< Scalar >::h_x = nullptr
protected

◆ h_y

template<class Scalar >
Scalar* Opm::WellContributionsCuda< Scalar >::h_y = nullptr
protected

◆ multisegments

template<class Scalar >
std::vector<std::unique_ptr<MultisegmentWellContribution<Scalar> > > Opm::WellContributions< Scalar >::multisegments
protectedinherited

◆ N

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::N
protectedinherited

◆ num_blocks

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::num_blocks = 0
protectedinherited

◆ num_blocks_so_far

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::num_blocks_so_far = 0
protectedinherited

◆ num_ms_wells

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::num_ms_wells = 0
protectedinherited

◆ num_std_wells

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::num_std_wells = 0
protectedinherited

◆ num_std_wells_so_far

template<class Scalar >
unsigned int Opm::WellContributions< Scalar >::num_std_wells_so_far = 0
protectedinherited

◆ stream

template<class Scalar >
cudaStream_t Opm::WellContributionsCuda< Scalar >::stream
protected

◆ val_pointers

template<class Scalar >
std::vector<unsigned int> Opm::WellContributions< Scalar >::val_pointers
protectedinherited

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