[petsc-dev] [petsc-maint #78191] Re: [petsc-users] Reusing ML preconditioner

John Fettig john.fettig at gmail.com
Tue Jul 5 13:31:45 CDT 2011


Hi Barry,

On Fri, Jul 1, 2011 at 11:48 PM, Barry Smith <bsmith at mcs.anl.gov> wrote:
> if (i)
>      {
>          ierr = KSPSetInitialGuessNonzero(ksp,PETSC_TRUE);CHKERRQ(ierr);
>          PC pc;
>          ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
>          PetscInt nlevels;
>          ierr = PCMGGetLevels(pc,&nlevels);CHKERRQ(ierr);
>          KSP sksp;
>          ierr = PCMGGetSmoother(pc,nlevels-1,&sksp);CHKERRQ(ierr);
>          ierr = KSPSetOperators(sksp,A[i],A[i],SAME_NONZERO_PATTERN);CHKERRQ(ierr);
>          ierr = PCMGSetResidual(pc,nlevels-1,PCMGDefaultResidual,A[i]);CHKERRQ(ierr);
>
> Note that this is not technically reusing the exact old preconditioner, it is actually partially modifying the old preconditioner with new matrix information.

Thanks for finding the cause, this does work for me.

>  Remind me why are you passing entirely new matrices to KSPSetOperators instead of the same matrix with new values in it?

Our code already generated a CSR matrix so it makes sense to pass it
in directly.  However, in parallel we are not generating the split
arrays that would bypass the copy, so instead we just re-create the
matrix.  I'm sure this isn't as efficient as passing in the split
arrays, perhaps you have a better idea about what should be done in
this case (Jed thought that the performance gain from using the "split
array" matrix creation would be minimal).

Thanks,
John



More information about the petsc-dev mailing list