Re: [petsc-dev] [petsc-maint #78191] Re: [petsc-users] Reusing ML preconditioner
Hi Barry, On Fri, Jul 1, 2011 at 11:48 PM, Barry Smith <[email protected]> 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
participants (1)
-
John Fettig