Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@cuihaoran21
Copy link

```

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));

/* 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);
@yhmtsai
Copy link
Member

yhmtsai commented Jan 7, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants