19#ifndef OPM_GPUILU0_OPM_Impl_HPP
20#define OPM_GPUILU0_OPM_Impl_HPP
23#include <opm/grid/utility/SparseTable.hpp>
49template <
class CPUMatrixT,
class X,
class Y,
int l = 1>
74 explicit OpmGpuILU0(
const GpuMatrix& gpuMatrix,
const CPUMatrixT& cpuMatrix,
bool splitMatrix,
bool tuneKernels,
int mixedPrecisionScheme);
78 void pre(X& x, Y& b)
override;
81 void apply(X& v,
const Y& d)
override;
88 Dune::SolverCategory::Category
category()
const override;
121 void apply(X& v,
const Y& d,
int lowerSolveThreadBlockSize,
int upperSolveThreadBlockSize);
123 void update(
int moveThreadBlockSize,
int factorizationThreadBlockSize);
126 static constexpr const size_t blocksize_ = CPUMatrixT::block_type::cols;
130 std::vector<int> m_reorderedToNatural;
132 std::vector<int> m_naturalToReordered;
135 std::unique_ptr<GpuMatrix> m_gpuReorderedLU;
137 std::unique_ptr<GpuMatrix> m_gpuMatrixReorderedLower;
138 std::unique_ptr<GpuMatrix> m_gpuMatrixReorderedUpper;
140 std::unique_ptr<FloatMat> m_gpuMatrixReorderedLowerFloat;
141 std::unique_ptr<FloatMat> m_gpuMatrixReorderedUpperFloat;
142 std::optional<GpuVector<float>> m_gpuMatrixReorderedDiagFloat;
144 std::optional<GpuVector<field_type>> m_gpuMatrixReorderedDiag;
146 GpuVector<int> m_gpuNaturalToReorder;
148 GpuVector<int> m_gpuReorderToNatural;
150 GpuVector<field_type> m_gpuDInv;
154 bool m_tuneThreadBlockSizes;
159 int m_upperSolveThreadBlockSize = -1;
160 int m_lowerSolveThreadBlockSize = -1;
161 int m_moveThreadBlockSize = -1;
162 int m_ILU0FactorizationThreadBlockSize = -1;
165 std::map<std::pair<field_type*, const field_type*>, GPUGraph> m_apply_graphs;
166 std::map<std::pair<field_type*, const field_type*>, GPUGraphExec> m_executableGraphs;
169 GPUStream m_stream{};
Interface class adding the update() method to the preconditioner interface.
Definition: PreconditionerWithUpdate.hpp:32
ILU0 preconditioner on the GPU.
Definition: OpmGpuILU0.hpp:51
static constexpr bool shouldCallPre()
Definition: OpmGpuILU0.hpp:103
void apply(X &v, const Y &d) override
Apply the preconditoner.
OpmGpuILU0(const GpuMatrix &gpuMatrix, const CPUMatrixT &cpuMatrix, bool splitMatrix, bool tuneKernels, int mixedPrecisionScheme)
Constructor.
Y range_type
The range type of the preconditioner.
Definition: OpmGpuILU0.hpp:56
void pre(X &x, Y &b) override
Prepare the preconditioner.
void LUFactorizeMatrix(int factorizationThreadBlockSize)
Compute LU factorization, and update the data of the reordered matrix.
void post(X &x) override
Post processing.
typename X::field_type field_type
The field type of the preconditioner.
Definition: OpmGpuILU0.hpp:58
Dune::SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category)
void tuneThreadBlockSizes()
function that will experimentally tune the thread block sizes of the important cuda kernels
void update() final
Updates the matrix data.
virtual bool hasPerfectUpdate() const override
Definition: OpmGpuILU0.hpp:114
void reorderAndSplitMatrix(int moveThreadBlockSize)
perform matrix splitting and reordering
static constexpr bool shouldCallPost()
Definition: OpmGpuILU0.hpp:109
X domain_type
The domain type of the preconditioner.
Definition: OpmGpuILU0.hpp:54
GpuSparseMatrix< field_type > GpuMatrix
The GPU matrix type.
Definition: OpmGpuILU0.hpp:60
Definition: autotuner.hpp:30
MatrixStorageMPScheme
Definition: kernel_enums.hpp:31