[petsc-users] PETSc Solver: Large iteration count for first solution

Mark Adams mfadams at lbl.gov
Sun Jun 24 10:45:31 CDT 2018


Note, you converged because of the relative tolerance so initial guess does
not really matter except that the initial residual on the second time step
may have more high frequency content then your first initial residual.

On Sun, Jun 24, 2018 at 6:37 AM Najeeb Ahmad <nahmad16 at ku.edu.tr> wrote:

> Hi Massimiliano,
>
> Thanks for your feedback. Indeed i am using previous solution for the
> subsequent ones and probably that is the reason for the faster convergence
> for the subsequent iterations. As Matt suggested, i need to improve my
> preconditioning to make first iteration converge faster.
>
> Thanks
>
> On Sun, Jun 24, 2018 at 3:26 PM Massimiliano Leoni <
> leoni.massimiliano1 at gmail.com> wrote:
>
>> Hi, are the various solves a time stepping procedure? Could it be that it
>> is re-using the solution at a previous iteration as an initial guess for
>> the subsequent ones, and for this reason it converges sooner?
>>
>>
>>
>> Massimiliano
>>
>>
>>
>> On sabato 23 giugno 2018 13:36:59 CEST Najeeb Ahmad wrote:
>>
>> Hi,
>>
>>
>> I am trying to solve a  64008000 x  64008000 system using PETSc. The
>> problem I am facing is that I am getting a very large iteration count for
>> the first solution (order of thousands). For the subsequent soluitons, the
>> iteration count is less. For instance, here is the iteration count for the
>> first solution when my code is run on 32 processes.
>>
>>
>> ...
>>
>> 2772 KSP Residual norm 1.198554448053e-07
>>
>> 2773 KSP Residual norm 1.190214006391e-07
>>
>> 2774 KSP Residual norm 1.181931531360e-07
>>
>> 2775 KSP Residual norm 1.173706620648e-07
>>
>> 2776 KSP Residual norm 1.165538874733e-07
>>
>> 2777 KSP Residual norm 1.157427896857e-07
>>
>> 2778 KSP Residual norm 1.149373293013e-07
>>
>> 2779 KSP Residual norm 1.141374671925e-07
>>
>> 2780 KSP Residual norm 1.133431645025e-07
>>
>> Linear solve converged due to CONVERGED_RTOL iterations 2780
>>
>>
>> For the subsequent solutions, the iteration count is as follows:
>>
>> ...
>>
>> 116 KSP Residual norm 2.657138978992e-04
>>
>> 117 KSP Residual norm 2.767485246885e-04
>>
>> 118 KSP Residual norm 2.071574619161e-04
>>
>> 119 KSP Residual norm 2.273562103015e-04
>>
>> 120 KSP Residual norm 1.693847273193e-04
>>
>> 121 KSP Residual norm 1.803833437167e-04
>>
>> 122 KSP Residual norm 1.443434809819e-04
>>
>> 123 KSP Residual norm 1.390878278231e-04
>>
>> 124 KSP Residual norm 1.247521972621e-04
>>
>> 125 KSP Residual norm 1.059224678494e-04
>>
>> Linear solve converged due to CONVERGED_RTOL iterations 125
>>
>>
>> The solver setup for my code is as follows:
>>
>>
>>  ierr = KSPCreate(PETSC_COMM_WORLD,&ksp);CHKERRQ(ierr);
>>
>>   ierr = KSPSetOperators(ksp,A,A);CHKERRQ(ierr);
>>
>>   ierr = KSPSetType(ksp, KSPCG);CHKERRQ(ierr);
>>
>>   ierr = KSPGetPC(ksp,&pc);CHKERRQ(ierr);
>>
>>   ierr = PCSetType(pc, PCJACOBI);
>>
>>   ierr = KSPSetFromOptions(ksp);CHKERRQ(ierr);
>>
>>   ierr = KSPSetUp(ksp);CHKERRQ(ierr);
>>
>>
>> and the command line for running the code is:
>>
>> mpiexec -n 32 ./main -mat_type mpiaij -ksp_atol 1E-7 -ksp_rtol 1E-7
>> -ksp_converged_reason -ksp_monitor
>>
>>
>> Any help is highly appreciated.
>>
>>
>>
>> --
>>
>> Najeeb Ahmad
>>
>>
>> Research and Teaching Assistant
>>
>> PARallel and MultiCORE Computing Laboratory (ParCoreLab)
>>
>> Computer Science and Engineering
>>
>>
>> Koç University, Istanbul, Turkey
>>
>>
>>
>>
>>
>
> --
> *Najeeb Ahmad*
>
>
> *Research and Teaching Assistant*
> *PARallel and MultiCORE Computing Laboratory (ParCoreLab) *
>
> *Computer Science and Engineering*
> *Koç University, Istanbul, Turkey*
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180624/e16b9578/attachment.html>


More information about the petsc-users mailing list