19#ifndef OPM_GPUILU0_OPM_Impl_HPP
20#define OPM_GPUILU0_OPM_Impl_HPP
23#include <opm/grid/utility/SparseTable.hpp>
44template <
class M,
class X,
class Y,
int l = 1>
65 explicit OpmGpuILU0(
const M& A,
bool splitMatrix,
bool tuneKernels);
69 void pre(X& x, Y& b)
override;
72 void apply(X& v,
const Y& d)
override;
79 Dune::SolverCategory::Category
category()
const override;
109 void apply(X& v,
const Y& d,
int lowerSolveThreadBlockSize,
int upperSolveThreadBlockSize);
111 void update(
int moveThreadBlockSize,
int factorizationThreadBlockSize);
113 const M& m_cpuMatrix;
115 static constexpr const size_t blocksize_ = matrix_type::block_type::cols;
117 Opm::SparseTable<size_t> m_levelSets;
119 std::vector<int> m_reorderedToNatural;
121 std::vector<int> m_naturalToReordered;
124 std::unique_ptr<CuMat> m_gpuReorderedLU;
126 std::unique_ptr<CuMat> m_gpuMatrixReorderedLower;
127 std::unique_ptr<CuMat> m_gpuMatrixReorderedUpper;
129 std::optional<GpuVector<field_type>> m_gpuMatrixReorderedDiag;
131 GpuVector<int> m_gpuNaturalToReorder;
133 GpuVector<int> m_gpuReorderToNatural;
135 GpuVector<field_type> m_gpuDInv;
139 bool m_tuneThreadBlockSizes;
142 int m_upperSolveThreadBlockSize = -1;
143 int m_lowerSolveThreadBlockSize = -1;
144 int m_moveThreadBlockSize = -1;
145 int m_ILU0FactorizationThreadBlockSize = -1;
Interface class adding the update() method to the preconditioner interface.
Definition: PreconditionerWithUpdate.hpp:32
ILU0 preconditioner on the GPU.
Definition: OpmGpuILU0.hpp:46
static constexpr bool shouldCallPost()
Definition: OpmGpuILU0.hpp:97
Y range_type
The range type of the preconditioner.
Definition: OpmGpuILU0.hpp:53
void pre(X &x, Y &b) override
Prepare the preconditioner.
void update() final
Updates the matrix data.
void apply(X &v, const Y &d) override
Apply the preconditoner.
GpuSparseMatrix< field_type > CuMat
The GPU matrix type.
Definition: OpmGpuILU0.hpp:57
OpmGpuILU0(const M &A, bool splitMatrix, bool tuneKernels)
Constructor.
static constexpr bool shouldCallPre()
Definition: OpmGpuILU0.hpp:91
typename X::field_type field_type
The field type of the preconditioner.
Definition: OpmGpuILU0.hpp:55
void LUFactorizeAndMoveData(int moveThreadBlockSize, int factorizationThreadBlockSize)
Compute LU factorization, and update the data of the reordered matrix.
Dune::SolverCategory::Category category() const override
Category of the preconditioner (see SolverCategory::Category)
void post(X &x) override
Post processing.
void tuneThreadBlockSizes()
function that will experimentally tune the thread block sizes of the important cuda kernels
typename std::remove_const< M >::type matrix_type
The matrix type the preconditioner is for.
Definition: OpmGpuILU0.hpp:49
virtual bool hasPerfectUpdate() const override
Definition: OpmGpuILU0.hpp:102
X domain_type
The domain type of the preconditioner.
Definition: OpmGpuILU0.hpp:51
Definition: autotuner.hpp:29