[petsc-users] Reusing ML preconditioner

John Fettig john.fettig at gmail.com
Wed Jun 29 22:12:45 CDT 2011


On Wed, Jun 29, 2011 at 11:01 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
>
>  John,
>
>   The MatCreateSeqAIJWithArrays() uses the memory (arrays) that you provide so you cannot free those arrays or muck with them until you are finished with the solve.

I figured that was the case.  I wasn't sure how far down the hierarchy
the memory I provided was referenced, so I figured if I passed in a
Pmat that used petsc allocated memory I could get around this.

>   What happens if you ALWAYS copy with MatDuplicate() the MatCreate*WithArrays() matrix immediately after you create it and use that matrix as I describe below in the setoperators? Does it start behaving like
> the 1) MatSetValues()  or does it still behave "badly"?

It takes roughly the same number of CG iterations as 1), but the solve
time indicates to me that PCSetUp is being called every solve.  The
solutions are also different, which also indicates that the
preconditioner is being rebuilt every solve.

Thanks,
John


More information about the petsc-users mailing list