You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I want to solve a large-scale sparse problem with the multigrid Solver, how do I set up its components and parameters? The current setup needs to be iterated too many times
#1763
Open
cuihaoran21 opened this issue
Jan 6, 2025
· 1 comment
using ir = gko::solver::Ir;
using bj = gko::preconditioner::Jacobi<double, int>;
using pgm = gko::multigrid::Pgm<double, int>;
using mg = gko::solver::Multigrid;
/* Create RestrictProlong factory*/
mg_level_gen = gko::share(pgm::build().with_deterministic(true).on(exec));
/* Create CoarsestSolver factory */
coarsest_solver_gen = gko::share(
ir::build()
.with_solver(bj::build().with_max_block_size(4u))
.with_relaxation_factor(static_cast<double>(0.8))
.with_criteria(gko::stop::Iteration::build().with_max_iters(1u))
.on(exec));
/* Create MultigridSolver factory*/
multigrid_gen = mg::build()
.with_max_levels(10u) //Limit the maximum number of layers for a multigrid
.with_min_coarse_rows(4u) //Specifies the minimum number of rows for the coarsest layer
.with_pre_smoother(smoother_gen)//Set the pre smoother
.with_post_uses_pre(true)//Specify that the post smoother is the same as the pre smoother
.with_mg_level(mg_level_gen)//Specifies RestrictProlong
.with_coarsest_solver(coarsest_solver_gen)//Sets the coarsest layer solver
.with_criteria(iter_stop, tol_stop)//Set stopping criteria including the number of iterations and tolerance
.on(exec);
The text was updated successfully, but these errors were encountered:
Hi @cuihaoran21 , good to hear you would like to try multigrid solver.
It might be worth setting the multigrid is a preconditioner of CG solver if the system is symmetric.
using ir = gko::solver::Ir;
using bj = gko::preconditioner::Jacobi<double, int>;
using pgm = gko::multigrid::Pgm<double, int>;
using mg = gko::solver::Multigrid;
/* Create smoother factory*/
smoother_gen = gko::share(
ir::build()
.with_solver(bj::build().with_max_block_size(4u))
.with_relaxation_factor(static_cast(0.8))
.with_criteria(gko::stop::Iteration::build().with_max_iters(10u))
.on(exec));
The text was updated successfully, but these errors were encountered: