[gpu] Support UMFPack with DUNE 2.7

The index type changed from int to long int with 2.7.
This commit is contained in:
Markus Blatt 2020-09-30 20:10:21 +02:00
parent acf5ea2663
commit d30f6d272b
5 changed files with 26 additions and 8 deletions

View File

@ -32,7 +32,7 @@ namespace Opm
MultisegmentWellContribution::MultisegmentWellContribution(unsigned int dim_, unsigned int dim_wells_,
unsigned int Nb_, unsigned int Mb_,
unsigned int BnumBlocks_, std::vector<double> &Bvalues, std::vector<unsigned int> &BcolIndices, std::vector<unsigned int> &BrowPointers,
unsigned int DnumBlocks_, double *Dvalues, int *DcolPointers, int *DrowIndices,
unsigned int DnumBlocks_, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices,
std::vector<double> &Cvalues)
:
dim(dim_), // size of blockvectors in vectors x and y, equal to MultisegmentWell::numEq

View File

@ -26,6 +26,9 @@
#include <cuda_runtime.h>
#endif
#include <dune/istl/umfpack.hh>
#include <dune/common/version.hh>
namespace Opm
{
@ -75,6 +78,13 @@ private:
public:
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
using UMFPackIndex =
typename Dune::UMFPack<Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1>>>::UMFPackMatrix::Index;
#else
using UMFPackIndex = int;
#endif
#if HAVE_CUDA
/// Set a cudaStream to be used
/// \param[in] stream the cudaStream that is used
@ -100,8 +110,8 @@ public:
MultisegmentWellContribution(unsigned int dim, unsigned int dim_wells,
unsigned int Nb, unsigned int Mb,
unsigned int BnumBlocks, std::vector<double> &Bvalues, std::vector<unsigned int> &BcolIndices, std::vector<unsigned int> &BrowPointers,
unsigned int DnumBlocks, double *Dvalues, int *DcolPointers, int *DrowIndices,
std::vector<double> &Cvalues);
unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers,
UMFPackIndex *DrowIndices, std::vector<double> &Cvalues);
/// Destroy a MultisegmentWellContribution, and free memory
~MultisegmentWellContribution();

View File

@ -137,7 +137,7 @@ void WellContributions::alloc()
void WellContributions::addMultisegmentWellContribution(unsigned int dim_, unsigned int dim_wells_,
unsigned int Nb, unsigned int Mb,
unsigned int BnumBlocks, std::vector<double> &Bvalues, std::vector<unsigned int> &BcolIndices, std::vector<unsigned int> &BrowPointers,
unsigned int DnumBlocks, double *Dvalues, int *DcolPointers, int *DrowIndices,
unsigned int DnumBlocks, double *Dvalues, UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices,
std::vector<double> &Cvalues)
{
assert(dim==dim_);

View File

@ -31,7 +31,8 @@
#include <vector>
#include <opm/simulators/linalg/bda/MultisegmentWellContribution.hpp>
#include <dune/istl/umfpack.hh>
#include <dune/common/version.hh>
namespace Opm
{
@ -56,6 +57,12 @@ namespace Opm
class WellContributions
{
public:
#if DUNE_VERSION_NEWER(DUNE_ISTL, 2, 7)
using UMFPackIndex =
typename Dune::UMFPack<Dune::BCRSMatrix<Dune::FieldMatrix<double,1,1>>>::UMFPackMatrix::Index;
#else
using UMFPackIndex = int;
#endif
/// StandardWell has C, D and B matrices that need to be copied
enum class MatrixType {
C,
@ -184,7 +191,8 @@ public:
void addMultisegmentWellContribution(unsigned int dim, unsigned int dim_wells,
unsigned int Nb, unsigned int Mb,
unsigned int BnumBlocks, std::vector<double> &Bvalues, std::vector<unsigned int> &BcolIndices, std::vector<unsigned int> &BrowPointers,
unsigned int DnumBlocks, double *Dvalues, int *DcolPointers, int *DrowIndices,
unsigned int DnumBlocks, double *Dvalues,
UMFPackIndex *DcolPointers, UMFPackIndex *DrowIndices,
std::vector<double> &Cvalues);
/// If the rows of the matrix are reordered, the columnindices of the matrixdata are incorrect

View File

@ -677,8 +677,8 @@ namespace Opm
// duneD
Dune::UMFPack<DiagMatWell> umfpackMatrix(duneD_, 0);
double *Dvals = umfpackMatrix.getInternalMatrix().getValues();
int *Dcols = umfpackMatrix.getInternalMatrix().getColStart();
int *Drows = umfpackMatrix.getInternalMatrix().getRowIndex();
auto *Dcols = umfpackMatrix.getInternalMatrix().getColStart();
auto *Drows = umfpackMatrix.getInternalMatrix().getRowIndex();
// duneB
std::vector<unsigned int> Bcols;