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

Massimiliano Leoni leoni.massimiliano1 at gmail.com
Sun Jun 24 05:26:40 CDT 2018


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*




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20180624/91aa6091/attachment.html>


More information about the petsc-users mailing list