19#ifndef OPM_GPUDILU_HPP
20#define OPM_GPUDILU_HPP
23#include <opm/grid/utility/SparseTable.hpp>
48template <
class CPUMatrixT,
class X,
class Y,
int l = 1>
70 explicit GpuDILU(
const GPUMatrix& gpuMatrix,
const CPUMatrixT& cpuMatrix,
bool splitMatrix,
bool tuneKernels,
int mixedPrecisionScheme);
74 void pre(X& x, Y& b)
override;
77 void apply(X& v,
const Y& d)
override;
84 Dune::SolverCategory::Category
category()
const override;
118 void apply(X& v,
const Y& d,
int lowerSolveThreadBlockSize,
int upperSolveThreadBlockSize);
120 void update(
int moveThreadBlockSize,
int factorizationThreadBlockSize);
122 static constexpr const size_t blocksize_ = CPUMatrixT::block_type::cols;
126 std::vector<int> m_reorderedToNatural;
128 std::vector<int> m_naturalToReordered;
132 std::unique_ptr<GPUMatrix> m_gpuMatrixReordered;
134 std::unique_ptr<GPUMatrix> m_gpuMatrixReorderedLower;
135 std::unique_ptr<GPUMatrix> m_gpuMatrixReorderedUpper;
137 std::unique_ptr<GpuVector<field_type>> m_gpuMatrixReorderedDiag;
139 std::unique_ptr<FloatMat> m_gpuMatrixReorderedLowerFloat;
140 std::unique_ptr<FloatMat> m_gpuMatrixReorderedUpperFloat;
141 std::unique_ptr<FloatVec> m_gpuMatrixReorderedDiagFloat;
142 std::unique_ptr<FloatVec> m_gpuDInvFloat;
144 GpuVector<int> m_gpuNaturalToReorder;
146 GpuVector<int> m_gpuReorderToNatural;
148 GpuVector<field_type> m_gpuDInv;
152 bool m_tuneThreadBlockSizes;
157 int m_upperSolveThreadBlockSize = -1;
158 int m_lowerSolveThreadBlockSize = -1;
159 int m_moveThreadBlockSize = -1;
160 int m_DILUFactorizationThreadBlockSize = -1;
163 std::map<std::pair<field_type*, const field_type*>, GPUGraph> m_apply_graphs;
164 std::map<std::pair<field_type*, const field_type*>, GPUGraphExec> m_executableGraphs;
167 GPUStream m_stream{};
Interface class adding the update() method to the preconditioner interface.
Definition: PreconditionerWithUpdate.hpp:32
DILU preconditioner on the GPU.
Definition: GpuDILU.hpp:50
void pre(X &x, Y &b) override
Prepare the preconditioner.
void tuneThreadBlockSizes()
function that will experimentally tune the thread block sizes of the important cuda kernels
void update() final
Updates the matrix data.
void apply(X &v, const Y &d) override
Apply the preconditoner.
GpuDILU(const GPUMatrix &gpuMatrix, const CPUMatrixT &cpuMatrix, bool splitMatrix, bool tuneKernels, int mixedPrecisionScheme)
Constructor.
virtual bool hasPerfectUpdate() const override
Definition: GpuDILU.hpp:111
Y range_type
The range type of the preconditioner.
Definition: GpuDILU.hpp:55
static constexpr bool shouldCallPre()
Definition: GpuDILU.hpp:100
Dune::SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category)
GpuVector< float > FloatVec
Definition: GpuDILU.hpp:61
void computeDiagonal(int factorizationThreadBlockSize)
Compute the diagonal of the DILU, and update the data of the reordered matrix.
static constexpr bool shouldCallPost()
Definition: GpuDILU.hpp:106
X domain_type
The domain type of the preconditioner.
Definition: GpuDILU.hpp:53
void reorderAndSplitMatrix(int moveThreadBlockSize)
perform matrix splitting and reordering
typename X::field_type field_type
The field type of the preconditioner.
Definition: GpuDILU.hpp:57
void post(X &x) override
Post processing.
GpuSparseMatrix< field_type > GPUMatrix
Definition: GpuDILU.hpp:59
Definition: autotuner.hpp:29
MatrixStorageMPScheme
Definition: kernel_enums.hpp:31