#include <cuWellContributions.hpp>

Inheritance diagram for Opm::WellContributionsCuda:
Inheritance graph

Public Types

enum class  MatrixType { C , D , B }
 StandardWell has C, D and B matrices that need to be copied. More...
 
using UMFPackIndex = SuiteSparse_long
 

Public Member Functions

 ~WellContributionsCuda () override
 
void setCudaStream (cudaStream_t stream)
 
void apply (double *d_x, double *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, double *values, unsigned int val_size)
 
void addMultisegmentWellContribution (unsigned int dim, unsigned int dim_wells, unsigned int Mb, std::vector< double > &Bvalues, std::vector< unsigned int > &BcolIndices, std::vector< unsigned int > &BrowPointers, unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices, std::vector< double > &Cvalues)
 

Static Public Member Functions

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

Protected Member Functions

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

Protected Attributes

cudaStream_t stream
 
double * d_Cnnzs = nullptr
 
double * d_Dnnzs = nullptr
 
double * d_Bnnzs = nullptr
 
int * d_Ccols = nullptr
 
int * d_Bcols = nullptr
 
double * d_z1 = nullptr
 
double * d_z2 = nullptr
 
unsigned int * d_val_pointers = nullptr
 
double * h_x = nullptr
 
double * 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 > > multisegments
 

Member Typedef Documentation

◆ UMFPackIndex

using Opm::WellContributions::UMFPackIndex = SuiteSparse_long
inherited

Member Enumeration Documentation

◆ MatrixType

enum class Opm::WellContributions::MatrixType
stronginherited

StandardWell has C, D and B matrices that need to be copied.

Enumerator

Constructor & Destructor Documentation

◆ ~WellContributionsCuda()

Opm::WellContributionsCuda::~WellContributionsCuda ( )
override

Member Function Documentation

◆ addMatrix()

void Opm::WellContributions::addMatrix ( MatrixType  type,
int *  colIndices,
double *  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()

void Opm::WellContributions::addMultisegmentWellContribution ( unsigned int  dim,
unsigned int  dim_wells,
unsigned int  Mb,
std::vector< double > &  Bvalues,
std::vector< unsigned int > &  BcolIndices,
std::vector< unsigned int > &  BrowPointers,
unsigned int  DnumBlocks,
double *  Dvalues,
UMFPackIndex DcolPointers,
UMFPackIndex DrowIndices,
std::vector< double > &  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()

void Opm::WellContributions::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

Referenced by Opm::BlackoilWellModel< TypeTag >::getWellContributions().

◆ alloc()

void Opm::WellContributions::alloc ( )
inherited

Allocate memory for the StandardWells.

Referenced by Opm::BlackoilWellModel< TypeTag >::getWellContributions().

◆ APIaddMatrix()

void Opm::WellContributionsCuda::APIaddMatrix ( MatrixType  type,
int *  colIndices,
double *  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.

◆ APIalloc()

void Opm::WellContributionsCuda::APIalloc ( )
overrideprotectedvirtual

Allocate memory for the StandardWells.

Reimplemented from Opm::WellContributions.

◆ apply()

void Opm::WellContributionsCuda::apply ( double *  d_x,
double *  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()

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

◆ getNumWells()

unsigned int Opm::WellContributions::getNumWells ( )
inlineinherited

◆ setBlockSize()

void Opm::WellContributions::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

Referenced by Opm::BlackoilWellModel< TypeTag >::getWellContributions().

◆ setCudaStream()

void Opm::WellContributionsCuda::setCudaStream ( cudaStream_t  stream)

Set a cudaStream to be used

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

◆ setVectorSize()

void Opm::WellContributions::setVectorSize ( unsigned  N)
inherited

Set size of vector that the wells are applied to

Parameters
[in]Nsize of vector

Member Data Documentation

◆ allocated

bool Opm::WellContributions::allocated = false
protectedinherited

◆ d_Bcols

int* Opm::WellContributionsCuda::d_Bcols = nullptr
protected

◆ d_Bnnzs

double* Opm::WellContributionsCuda::d_Bnnzs = nullptr
protected

◆ d_Ccols

int* Opm::WellContributionsCuda::d_Ccols = nullptr
protected

◆ d_Cnnzs

double* Opm::WellContributionsCuda::d_Cnnzs = nullptr
protected

◆ d_Dnnzs

double* Opm::WellContributionsCuda::d_Dnnzs = nullptr
protected

◆ d_val_pointers

unsigned int* Opm::WellContributionsCuda::d_val_pointers = nullptr
protected

◆ d_z1

double* Opm::WellContributionsCuda::d_z1 = nullptr
protected

◆ d_z2

double* Opm::WellContributionsCuda::d_z2 = nullptr
protected

◆ dim

unsigned int Opm::WellContributions::dim
protectedinherited

◆ dim_wells

unsigned int Opm::WellContributions::dim_wells
protectedinherited

◆ h_x

double* Opm::WellContributionsCuda::h_x = nullptr
protected

◆ h_y

double* Opm::WellContributionsCuda::h_y = nullptr
protected

◆ multisegments

std::vector<std::unique_ptr<MultisegmentWellContribution> > Opm::WellContributions::multisegments
protectedinherited

◆ N

unsigned int Opm::WellContributions::N
protectedinherited

◆ num_blocks

unsigned int Opm::WellContributions::num_blocks = 0
protectedinherited

◆ num_blocks_so_far

unsigned int Opm::WellContributions::num_blocks_so_far = 0
protectedinherited

◆ num_ms_wells

unsigned int Opm::WellContributions::num_ms_wells = 0
protectedinherited

◆ num_std_wells

unsigned int Opm::WellContributions::num_std_wells = 0
protectedinherited

◆ num_std_wells_so_far

unsigned int Opm::WellContributions::num_std_wells_so_far = 0
protectedinherited

◆ stream

cudaStream_t Opm::WellContributionsCuda::stream
protected

◆ val_pointers

std::vector<unsigned int> Opm::WellContributions::val_pointers
protectedinherited

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