PETSc + HYPRE
Matthew Knepley
knepley at gmail.com
Tue Apr 15 09:36:23 CDT 2008
On Tue, Apr 15, 2008 at 9:22 AM, Márcio Ricardo Pivello
<pivello at gmail.com> wrote:
> Hi, I want to use hypre preconditioners coupled with PETSc, but so far I
> have not succeeded. Here's what I've done:
>
> Firstly I create the preconditioner:
>
>
> Mat A_Par(NSubSteps)
> Vec Unk_Par(NSubSteps)
> Vec B_Load_Par(NSubSteps)
> KSP KspSolv
> ---> PC precond
>
> ******************************
>
> Later in the code I set the preconditioner type and create the Krylov
> solver:
>
> ----> call PCSetType(precond,'hypre',iError)
> ----> call PCHYPRESetType(precond,'boomeramg',iError)
> ----> call KSPCreate (PETSC_COMM_WORLD, KspSolv, iError)
> ----> call KSPSetFromOptions (KspSolv, iError)
> call KSPSetOperators (KspSolv, A_Par(nstp), A_Par(nstp),
> SAME_NONZERO_PATTERN, iError)
> call KSPSolve (KspSolv, B_Load_Par(nstp), Unk_Par(nstp), iError)
>
>
> ***************************
>
> Then, when I run the program I put the following options in the command
> line:
>
> mpirun -np 2 /home/mpivello/bin/SolverGP.x -pc_type hypre -pc_hypre_type
> boomeramg -pc_hypre_boomeramg_sweep_all true -pc_hypre_boomeramg_grid_sweeps
> 1 -pc_hypre_boomeramg_strong_threshold 0.9 -pc_hypre_boomeramg_max_iter 5
> -pc_hypre_boomeramg_coarsen_type modifiedRuge-Stueben -f0 dummy.tmp 2>&1
> -ksp_gmres_restart 200 -ksp_max_it 3000 -ksp_rtol 1.0e-10 -ksp_atol 1.0e-15
> -ksp_monitor -log_summary < /dev/null > run.parallel.log &
>
> But this proceeding is not working. What am I doing wrong?
What does "not working" mean?
1) What is actually being run? Use -ksp_view to find out (always).
2) Above you set the PC type before creating the KSP. How does the
KSP know about
the PC? You should retrieve the PC from the KSP using KSPGetPC() and then
customize it. Better yet, do everything from the command line
-pc_type hypre -pc_hypre_type boomeramg ...
3) Did you configure with HYPRE?
Matt
> Thanks in advance
>
> Márcio Ricardo
--
What most experimenters take for granted before they begin their
experiments is infinitely more interesting than any results to which
their experiments lead.
- Norbert Wiener
More information about the petsc-users
mailing list