MFEM
v4.1.0
Finite element discretization library
|
#include <ginkgo.hpp>
Public Member Functions | |
GinkgoIterativeSolverBase (const std::string &exec_type, int print_iter, int max_num_iter, double RTOLERANCE, double ATOLERANCE) | |
virtual | ~GinkgoIterativeSolverBase ()=default |
void | initialize (const SparseMatrix *matrix) |
void | apply (Vector &solution, const Vector &rhs) |
void | solve (const SparseMatrix *matrix, Vector &solution, const Vector &rhs) |
Protected Attributes | |
int | print_lvl |
int | max_iter |
double | rel_tol |
double | abs_tol |
double | final_norm |
int | final_iter |
int | converged |
std::shared_ptr < gko::LinOpFactory > | solver_gen |
std::shared_ptr < gko::stop::ResidualNormReduction <>::Factory > | residual_criterion |
std::shared_ptr < gko::log::Convergence<> > | convergence_logger |
std::shared_ptr< ResidualLogger<> > | residual_logger |
std::shared_ptr < gko::stop::Combined::Factory > | combined_factory |
std::shared_ptr< gko::Executor > | executor |
This class forms the base class for all of Ginkgo's iterative solvers. The various derived classes only take the additional data that is specific to them and solve the given linear system. The entire collection of solvers that Ginkgo implements is available at the Ginkgo documentation and manual pages, https://ginkgo-project.github.io/ginkgo/doc/develop.
Definition at line 192 of file ginkgo.hpp.
mfem::GinkgoWrappers::GinkgoIterativeSolverBase::GinkgoIterativeSolverBase | ( | const std::string & | exec_type, |
int | print_iter, | ||
int | max_num_iter, | ||
double | RTOLERANCE, | ||
double | ATOLERANCE | ||
) |
Constructor.
The exec_type
defines the paradigm where the solution is computed. It is a string and the choices are "omp" , "reference" or "cuda". The respective strings create the respective executors as given below.
Ginkgo currently supports three different executor types:
The following code snippet demonstrates the using of the OpenMP executor to create a solver which would use the OpenMP paradigm to the solve the system on the CPU.
``` auto omp = gko::create<gko::OmpExecutor>(); using cg = gko::solver::Cg<>; auto solver_gen = cg::build() .with_criteria( gko::stop::Iteration::build().with_max_iters(20u).on(omp), gko::stop::ResidualNormReduction<>::build() .with_reduction_factor(1e-6) .on(omp)) .on(omp); auto solver = solver_gen->generate(system_matrix);
solver->apply(lend(rhs), lend(solution)); ```
Definition at line 31 of file ginkgo.cpp.
|
virtualdefault |
Destructor.
void mfem::GinkgoWrappers::GinkgoIterativeSolverBase::apply | ( | Vector & | solution, |
const Vector & | rhs | ||
) |
Solve the linear system Ax=b
. Dependent on the information provided by derived classes one of Ginkgo's linear solvers is chosen.
Definition at line 85 of file ginkgo.cpp.
void mfem::GinkgoWrappers::GinkgoIterativeSolverBase::initialize | ( | const SparseMatrix * | matrix | ) |
Initialize the matrix and copy over its data to Ginkgo's data structures.
Definition at line 225 of file ginkgo.cpp.
void mfem::GinkgoWrappers::GinkgoIterativeSolverBase::solve | ( | const SparseMatrix * | matrix, |
Vector & | solution, | ||
const Vector & | rhs | ||
) |
Solve the linear system Ax=b
. Dependent on the information provided by derived classes one of Ginkgo's linear solvers is chosen.
Definition at line 258 of file ginkgo.cpp.
|
protected |
Definition at line 278 of file ginkgo.hpp.
|
protected |
The Ginkgo combined factory object is used to create a combined stopping criterion to be passed to the solver.
Definition at line 311 of file ginkgo.hpp.
|
mutableprotected |
Definition at line 281 of file ginkgo.hpp.
|
protected |
The Ginkgo convergence logger used to check for convergence and other solver data if needed.
Definition at line 299 of file ginkgo.hpp.
|
protected |
The execution paradigm in Ginkgo. The choices are between gko::OmpExecutor
, gko::CudaExecutor
and gko::ReferenceExecutor
and more details can be found in Ginkgo's documentation.
Definition at line 318 of file ginkgo.hpp.
|
mutableprotected |
Definition at line 280 of file ginkgo.hpp.
|
mutableprotected |
Definition at line 279 of file ginkgo.hpp.
|
protected |
Definition at line 276 of file ginkgo.hpp.
|
protected |
Definition at line 275 of file ginkgo.hpp.
|
protected |
Definition at line 277 of file ginkgo.hpp.
|
protected |
The residual criterion object that controls the reduction of the residual based on the tolerance set in the solver_control member.
Definition at line 293 of file ginkgo.hpp.
|
protected |
The residual logger object used to check for convergence and other solver data if needed.
Definition at line 305 of file ginkgo.hpp.
|
protected |
The Ginkgo generated solver factory object.
Definition at line 286 of file ginkgo.hpp.