Updated comments

This commit is contained in:
T.D. (Tongdong) Qiu 2020-05-20 15:13:58 +02:00
parent f6036ffa8e
commit f04a629546
3 changed files with 17 additions and 15 deletions

View File

@ -36,14 +36,14 @@ namespace Opm
unsigned int DnumBlocks_, double *Dvalues, int *DcolPointers, int *DrowIndices,
double *Cvalues)
:
dim(dim_),
dim_wells(dim_wells_),
N(Nb_*dim),
Nb(Nb_),
M(Mb_*dim_wells),
Mb(Mb_),
DnumBlocks(DnumBlocks_),
BnumBlocks(BnumBlocks_)
dim(dim_), // size of blockvectors in vectors x and y, equal to MultisegmentWell::numEq
dim_wells(dim_wells_), // size of blocks in C, B and D, equal to MultisegmentWell::numWellEq
N(Nb_*dim), // number of rows in vectors x and y, N == dim*Nb
Nb(Nb_), // number of blockrows in x and y
M(Mb_*dim_wells), // number of rows, M == dim_wells*Mb
Mb(Mb_), // number of blockrows in C, D and B
DnumBlocks(DnumBlocks_), // number of blocks in D
BnumBlocks(BnumBlocks_) // number of blocks in C and B
{
Cvals.insert(Cvals.end(), Cvalues, Cvalues + BnumBlocks*dim*dim_wells);
Dvals.insert(Dvals.end(), Dvalues, Dvalues + DnumBlocks*dim_wells*dim_wells);

View File

@ -40,8 +40,8 @@ namespace Opm
{
private:
unsigned int dim; // number of columns of blocks in B and C, equal to MultisegmentWell::numEq
unsigned int dim_wells; // number of rows of blocks in B and C, equal to MultisegmentWell::numWellEq
unsigned int dim; // size of blockvectors in vectors x and y, equal to MultisegmentWell::numEq
unsigned int dim_wells; // size of blocks in C, B and D, equal to MultisegmentWell::numWellEq
unsigned int N; // number of rows in vectors x and y, N == dim*Nb
unsigned int Nb; // number of blockrows in x and y
unsigned int M; // number of rows, M == dim_wells*Mb
@ -51,8 +51,8 @@ namespace Opm
// C and B are stored in BCRS format, D is stored in CSC format (Dune::UMFPack)
// Sparsity pattern for C is not stored, since it is the same as B
unsigned int DnumBlocks;
unsigned int BnumBlocks;
unsigned int DnumBlocks; // number of blocks in D
unsigned int BnumBlocks; // number of blocks in C and B
std::vector<double> Cvals;
std::vector<double> Dvals;
std::vector<double> Bvals;
@ -73,7 +73,7 @@ namespace Opm
/// Create a new MultisegmentWellContribution
/// Matrices C and B are passed in Blocked CSR, matrix D in CSC
/// \param[in] dim size of blocks in vectors x and y, equal to MultisegmentWell::numEq
/// \param[in] dim size of blocks in blockvectors x and y, equal to MultisegmentWell::numEq
/// \param[in] dim_wells size of blocks of C, B and D, equal to MultisegmentWell::numWellEq
/// \param[in] Nb number of blocks in vectors x and y
/// \param[in] Mb number of blockrows in C, B and D

View File

@ -174,6 +174,10 @@ namespace Opm
void WellContributions::apply(double *d_x, double *d_y)
{
// apply MultisegmentWells
// make sure the stream is empty if timing measurements are done
cudaStreamSynchronize(stream);
if (num_ms_wells > 0) {
// allocate pinned memory on host if not yet done
if (h_x == nullptr) {
@ -181,8 +185,6 @@ namespace Opm
cudaMallocHost(&h_y, sizeof(double) * N);
}
// make sure the stream is empty to start timing
cudaStreamSynchronize(stream);
// copy vectors x and y from GPU to CPU
cudaMemcpyAsync(h_x, d_x, sizeof(double) * N, cudaMemcpyDeviceToHost, stream);