45 using V =
typename F::Vector;
49 using field_type =
typename V::field_type;
51 static constexpr int maxblocksize = 6;
56 F::addCreator(
"ilu0", [](
const O& op,
const P& prm,
const std::function<V()>&, std::size_t,
const C& comm) {
57 const double w = prm.
get<
double>(
"relaxation", 1.0);
59 auto gpuPrec = std::make_shared<GpuILU0>(op.getmat(), w);
60 return std::make_shared<gpuistl::GpuBlockPreconditioner<V, V, C>>(gpuPrec, comm);
63 F::addCreator(
"jac", [](
const O& op,
const P& prm,
const std::function<V()>&, std::size_t,
const C& comm) {
64 const double w = prm.
get<
double>(
"relaxation", 1.0);
66 auto gpuPrec = std::make_shared<GpuJac>(op.getmat(), w);
67 return std::make_shared<gpuistl::GpuBlockPreconditioner<V, V, C>>(gpuPrec, comm);
70 F::addCreator(
"dilu", [](
const O& op, [[maybe_unused]]
const P& prm,
const std::function<V()>&, std::size_t,
const C& comm) -> PrecPtr {
71 return op.getmat().dispatchOnBlocksize([&](
auto blockSizeVal) -> PrecPtr {
72 constexpr int blockSize =
decltype(blockSizeVal)::value;
74 const bool split_matrix = prm.
get<
bool>(
"split_matrix",
true);
75 const bool tune_gpu_kernels = prm.
get<
bool>(
"tune_gpu_kernels",
true);
76 const int mixed_precision_scheme = prm.
get<
int>(
"mixed_precision_scheme", 0);
77 const bool reorder = prm.
get<
bool>(
"reorder",
true);
78 using CPUMatrixType = std::remove_const_t<std::remove_reference_t<
decltype(cpuMatrix)>>;
80 auto gpuPrec = std::make_shared<GPUDILU>(op.getmat(), cpuMatrix, split_matrix, tune_gpu_kernels, mixed_precision_scheme, reorder);
81 return std::make_shared<gpuistl::GpuBlockPreconditioner<V, V, C>>(gpuPrec, comm);
85 F::addCreator(
"opmilu0", [](
const O& op, [[maybe_unused]]
const P& prm,
const std::function<V()>&, std::size_t,
const C& comm) -> PrecPtr {
86 return op.getmat().dispatchOnBlocksize([&](
auto blockSizeVal) -> PrecPtr {
87 constexpr int blockSize =
decltype(blockSizeVal)::value;
89 const bool split_matrix = prm.
get<
bool>(
"split_matrix",
true);
90 const bool tune_gpu_kernels = prm.
get<
bool>(
"tune_gpu_kernels",
true);
91 const int mixed_precision_scheme = prm.
get<
int>(
"mixed_precision_scheme", 0);
92 using CPUMatrixType = std::remove_const_t<std::remove_reference_t<
decltype(cpuMatrix)>>;
94 auto gpuPrec = std::make_shared<GPUILU0>(op.getmat(), cpuMatrix, split_matrix, tune_gpu_kernels, mixed_precision_scheme);
95 return std::make_shared<gpuistl::GpuBlockPreconditioner<V, V, C>>(gpuPrec, comm);
T get(const std::string &key) const
Retrieve property value given hierarchical property key.
Definition PropertyTree.cpp:59
Dune::BCRSMatrix< BlockType > makeCPUMatrix(const Operator &op)
Utility functions for GPU preconditioner creation.
Definition gpu_preconditioner_utils.hpp:47