[petsc-users] KSPSetOperators/sub-preconditioner type

Jed Brown jedbrown at mcs.anl.gov
Wed Jul 11 08:47:19 CDT 2012


On Tue, Jul 10, 2012 at 3:29 PM, Paul T. Bauman <ptbauman at gmail.com> wrote:

> On Tue, Jul 10, 2012 at 1:34 PM, Paul T. Bauman <ptbauman at gmail.com>wrote:
>
>> Greetings,
>>
>> This question is somewhat related to this thread:
>> http://lists.mcs.anl.gov/pipermail/petsc-users/2011-August/009583.html but
>> instead of resurrecting that thread, I decided to start a new one.
>>
>> Summary: In the libMesh wrapper of PETSc's KSP, a call is made to
>> KSPSetOperators; I gather this is in order to allow reusing the same
>> preconditioner, if desired. However, I've noticed that when I use the
>> following options, the sub-preconditioner type gets reset:
>>
>> -pc_type bjacobi -sub_pc_type ilu -sub_pc_factor_mat_solver_package
>> superlu
>>
>> In particular, the first linear solve uses what I asked for, but in all
>> following linear solves, the petsc ilu solver is used instead of superlu.
>> If I remove the KSPSetOperators call, everything is peachy.
>>
>> My question: Does a call need to be made to PCSetFromOptions (or
>> something similar...) to keep the superlu ilu solver around or would that
>> wipe out the KSPSetOperators effect? Is this a PETSc bug? Other?
>>
>
Thanks for your test case. Yes, this is a PETSc bug associated with
handling of DIFFERENT_NONZERO_PATTERN. Fixed here and will be in the next
patch release.

http://petsc.cs.iit.edu/petsc/releases/petsc-3.3/rev/09d701958d66

We recommend that you only call KSPSetFromOptions (or PCSetFromOptions)
once.


>
>> This is with petsc-3.3-p1.
>>
>
> Sorry to reply to myself, but I read this and realized I was rather
> imprecise.
>
> The KSPSetOperators call I referred to is in the solve step. In
> particular, KSPSetFromOptions is called during initilization, only once,
> but KSPSetOperators is called each time solve is called. I was able to
> mimic my problem in the attached, slightly modified ksp/ex5.c, running with:
>
> mpiexec -np 6 ./ex5 -ksp_type gmres -pc_type bjacobi -sub_pc_type ilu
> -ksp_view -ksp_monitor -sub_pc_factor_mat_solver_package superlu
> -sub_pc_factor_levels 1
>
> Is the correct solution just to call KSPSetFromOptions every time? Will
> that be noticeable at all? I hope this was less vague than my original
> message. Thanks again.
>
> Best,
>
> Paul
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120711/81bf2eff/attachment.html>


More information about the petsc-users mailing list