[petsc-users] Number of Iteration of KSP and relative tolerance

Ivano Barletta ibarletta at inogs.it
Wed Aug 31 10:32:46 CDT 2016


Dear Petsc Users

I'm using Petsc to solve an elliptic equation

The code can be run in parallel but I'm running
some tests in sequential by the moment

When I look at the output, what it looks odd to
me is that the relative tolerance that I set is
not fulfilled.
I've set -ksp_rtol 1e-8 in my runtime options
but the solver stops when the ratio
|| r || / || b || is still 9e-8, then almost
one order of magnitude greater of the rtol
that I set (as you can see in the txt in attachment).

My question is, isn't the solver supposed to
make other few iterations to reach the relative tolerance?

Thanks in advance for replies and suggestions
Kind Regards
Ivano

P.S. my runtime options are these:
-ksp_monitor_true_residual -ksp_type cg -ksp_converged_reason -ksp_view
-ksp_rtol 1e-8
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20160831/4e140368/attachment-0001.html>
-------------- next part --------------
   0: norm of rhs:      439.879419781616
   0:  0 KSP preconditioned resid norm 9,632653071666e-09 true resid norm 4,398794197816e+02 ||r(i)||/||b|| 1,000000000000e+00
   0:  1 KSP preconditioned resid norm 2,171633143101e-09 true resid norm 2,556604849166e+02 ||r(i)||/||b|| 5,812058337339e-01
   0:  2 KSP preconditioned resid norm 1,441343422857e-09 true resid norm 2,500950008116e+02 ||r(i)||/||b|| 5,685535389125e-01
   0:  3 KSP preconditioned resid norm 1,214236434534e-09 true resid norm 2,208035386889e+02 ||r(i)||/||b|| 5,019637854358e-01
   0:  4 KSP preconditioned resid norm 1,086804365216e-09 true resid norm 2,004011071514e+02 ||r(i)||/||b|| 4,555819120861e-01
   0:  5 KSP preconditioned resid norm 7,736107826135e-10 true resid norm 1,700068699361e+02 ||r(i)||/||b|| 3,864851645493e-01
   0:  6 KSP preconditioned resid norm 5,011384091121e-10 true resid norm 1,237597947404e+02 ||r(i)||/||b|| 2,813493634275e-01
   0:  7 KSP preconditioned resid norm 4,318011974073e-10 true resid norm 1,000907681554e+02 ||r(i)||/||b|| 2,275413753276e-01
   0:  8 KSP preconditioned resid norm 4,380667762565e-10 true resid norm 9,394931213238e+01 ||r(i)||/||b|| 2,135796945877e-01
   0:  9 KSP preconditioned resid norm 3,780427851011e-10 true resid norm 8,101250279573e+01 ||r(i)||/||b|| 1,841697955225e-01
   0: 10 KSP preconditioned resid norm 3,058003827193e-10 true resid norm 7,199892948255e+01 ||r(i)||/||b|| 1,636787861507e-01
   0: 11 KSP preconditioned resid norm 2,474492702547e-10 true resid norm 6,123616634315e+01 ||r(i)||/||b|| 1,392112556063e-01
   0: 12 KSP preconditioned resid norm 2,095988234942e-10 true resid norm 5,724994684966e+01 ||r(i)||/||b|| 1,301491824239e-01
   0: 13 KSP preconditioned resid norm 1,884061587633e-10 true resid norm 4,972054611666e+01 ||r(i)||/||b|| 1,130322171957e-01
   0: 14 KSP preconditioned resid norm 1,405045488203e-10 true resid norm 4,140683767500e+01 ||r(i)||/||b|| 9,413224582218e-02
   0: 15 KSP preconditioned resid norm 1,286551939078e-10 true resid norm 3,451264974383e+01 ||r(i)||/||b|| 7,845934179181e-02
   0: 16 KSP preconditioned resid norm 1,178683579708e-10 true resid norm 2,939054790173e+01 ||r(i)||/||b|| 6,681501015964e-02
   0: 17 KSP preconditioned resid norm 8,234959252122e-11 true resid norm 2,285365043457e+01 ||r(i)||/||b|| 5,195435250395e-02
   0: 18 KSP preconditioned resid norm 7,509832956946e-11 true resid norm 1,751214986415e+01 ||r(i)||/||b|| 3,981125071240e-02
   0: 19 KSP preconditioned resid norm 5,409124168355e-11 true resid norm 1,352858531620e+01 ||r(i)||/||b|| 3,075521315117e-02
   0: 20 KSP preconditioned resid norm 3,995162840424e-11 true resid norm 1,056894250592e+01 ||r(i)||/||b|| 2,402690835403e-02
   0: 21 KSP preconditioned resid norm 3,018772359234e-11 true resid norm 8,491273353790e+00 ||r(i)||/||b|| 1,930363861534e-02
   0: 22 KSP preconditioned resid norm 2,319456860895e-11 true resid norm 6,521467351121e+00 ||r(i)||/||b|| 1,482557959715e-02
   0: 23 KSP preconditioned resid norm 1,714661331213e-11 true resid norm 5,068319413857e+00 ||r(i)||/||b|| 1,152206533412e-02
   0: 24 KSP preconditioned resid norm 1,308225317474e-11 true resid norm 3,923590511912e+00 ||r(i)||/||b|| 8,919695569891e-03
   0: 25 KSP preconditioned resid norm 1,065548274277e-11 true resid norm 3,349720325035e+00 ||r(i)||/||b|| 7,615087622646e-03
   0: 26 KSP preconditioned resid norm 9,288082413605e-12 true resid norm 2,839180689893e+00 ||r(i)||/||b|| 6,454452202611e-03
   0: 27 KSP preconditioned resid norm 8,129874937446e-12 true resid norm 2,516801431301e+00 ||r(i)||/||b|| 5,721571226385e-03
   0: 28 KSP preconditioned resid norm 6,251370974549e-12 true resid norm 2,069095898397e+00 ||r(i)||/||b|| 4,703779729964e-03
   0: 29 KSP preconditioned resid norm 5,403561134116e-12 true resid norm 1,703050622152e+00 ||r(i)||/||b|| 3,871630600490e-03
   0: 30 KSP preconditioned resid norm 4,223047249100e-12 true resid norm 1,498492398164e+00 ||r(i)||/||b|| 3,406598105699e-03
   0: 31 KSP preconditioned resid norm 3,334181196298e-12 true resid norm 1,250453513567e+00 ||r(i)||/||b|| 2,842718839149e-03
   0: 32 KSP preconditioned resid norm 2,524440622906e-12 true resid norm 9,582339369648e-01 ||r(i)||/||b|| 2,178401384271e-03
   0: 33 KSP preconditioned resid norm 2,235471174413e-12 true resid norm 7,890045237748e-01 ||r(i)||/||b|| 1,793683651230e-03
   0: 34 KSP preconditioned resid norm 1,856262698124e-12 true resid norm 6,585027575574e-01 ||r(i)||/||b|| 1,497007425090e-03
   0: 35 KSP preconditioned resid norm 1,368876723850e-12 true resid norm 4,986313783422e-01 ||r(i)||/||b|| 1,133563781160e-03
   0: 36 KSP preconditioned resid norm 1,232999096255e-12 true resid norm 4,243119220237e-01 ||r(i)||/||b|| 9,646096246884e-04
   0: 37 KSP preconditioned resid norm 1,059574749098e-12 true resid norm 3,698114973392e-01 ||r(i)||/||b|| 8,407110692352e-04
   0: 38 KSP preconditioned resid norm 7,934364061187e-13 true resid norm 3,099505530599e-01 ||r(i)||/||b|| 7,046261750863e-04
   0: 39 KSP preconditioned resid norm 7,439958768077e-13 true resid norm 2,561115153046e-01 ||r(i)||/||b|| 5,822311837907e-04
   0: 40 KSP preconditioned resid norm 6,138328821745e-13 true resid norm 2,374365553293e-01 ||r(i)||/||b|| 5,397764583921e-04
   0: 41 KSP preconditioned resid norm 4,957137308350e-13 true resid norm 1,864936647074e-01 ||r(i)||/||b|| 4,239654239790e-04
   0: 42 KSP preconditioned resid norm 3,626526442636e-13 true resid norm 1,431380534998e-01 ||r(i)||/||b|| 3,254029333105e-04
   0: 43 KSP preconditioned resid norm 3,020992100659e-13 true resid norm 1,179620641634e-01 ||r(i)||/||b|| 2,681690910248e-04
   0: 44 KSP preconditioned resid norm 2,225548801089e-13 true resid norm 9,360224549511e-02 ||r(i)||/||b|| 2,127906905524e-04
   0: 45 KSP preconditioned resid norm 1,809693413599e-13 true resid norm 7,443272262501e-02 ||r(i)||/||b|| 1,692116504609e-04
   0: 46 KSP preconditioned resid norm 1,372065895247e-13 true resid norm 5,900930182328e-02 ||r(i)||/||b|| 1,341488125373e-04
   0: 47 KSP preconditioned resid norm 1,208983050044e-13 true resid norm 4,617672978018e-02 ||r(i)||/||b|| 1,049758813520e-04
   0: 48 KSP preconditioned resid norm 8,503926168226e-14 true resid norm 3,758170008713e-02 ||r(i)||/||b|| 8,543636823424e-05
   0: 49 KSP preconditioned resid norm 7,569271928792e-14 true resid norm 2,756193861109e-02 ||r(i)||/||b|| 6,265794072561e-05
   0: 50 KSP preconditioned resid norm 4,935003512052e-14 true resid norm 2,057875530499e-02 ||r(i)||/||b|| 4,678271903515e-05
   0: 51 KSP preconditioned resid norm 4,123111257025e-14 true resid norm 1,560285082507e-02 ||r(i)||/||b|| 3,547074521653e-05
   0: 52 KSP preconditioned resid norm 2,918330157388e-14 true resid norm 1,175568462832e-02 ||r(i)||/||b|| 2,672478888454e-05
   0: 53 KSP preconditioned resid norm 2,165351561155e-14 true resid norm 8,746606938065e-03 ||r(i)||/||b|| 1,988410128941e-05
   0: 54 KSP preconditioned resid norm 1,886014127891e-14 true resid norm 7,447830540951e-03 ||r(i)||/||b|| 1,693152760965e-05
   0: 55 KSP preconditioned resid norm 1,485420723874e-14 true resid norm 5,811624702993e-03 ||r(i)||/||b|| 1,321185861771e-05
   0: 56 KSP preconditioned resid norm 1,190524430303e-14 true resid norm 4,818891484988e-03 ||r(i)||/||b|| 1,095502828339e-05
   0: 57 KSP preconditioned resid norm 1,135298601262e-14 true resid norm 4,028016670720e-03 ||r(i)||/||b|| 9,157092806750e-06
   0: 58 KSP preconditioned resid norm 8,835732623967e-15 true resid norm 3,581369088290e-03 ||r(i)||/||b|| 8,141706402332e-06
   0: 59 KSP preconditioned resid norm 6,601144858500e-15 true resid norm 2,916186245046e-03 ||r(i)||/||b|| 6,629512802607e-06
   0: 60 KSP preconditioned resid norm 5,573564152983e-15 true resid norm 2,254185923764e-03 ||r(i)||/||b|| 5,124554190063e-06
   0: 61 KSP preconditioned resid norm 4,348118360429e-15 true resid norm 1,856399919560e-03 ||r(i)||/||b|| 4,220247267948e-06
   0: 62 KSP preconditioned resid norm 3,564748099839e-15 true resid norm 1,483306639981e-03 ||r(i)||/||b|| 3,372075558156e-06
   0: 63 KSP preconditioned resid norm 2,502729819898e-15 true resid norm 1,124605293813e-03 ||r(i)||/||b|| 2,556621754141e-06
   0: 64 KSP preconditioned resid norm 1,953973271399e-15 true resid norm 8,579066324068e-04 ||r(i)||/||b|| 1,950322278848e-06
   0: 65 KSP preconditioned resid norm 1,510562005540e-15 true resid norm 6,504461230781e-04 ||r(i)||/||b|| 1,478691872880e-06
   0: 66 KSP preconditioned resid norm 1,031183935808e-15 true resid norm 4,871796605801e-04 ||r(i)||/||b|| 1,107530015435e-06
   0: 67 KSP preconditioned resid norm 8,524858201959e-16 true resid norm 3,639142205670e-04 ||r(i)||/||b|| 8,273044934625e-07
   0: 68 KSP preconditioned resid norm 5,870210236903e-16 true resid norm 2,580840567039e-04 ||r(i)||/||b|| 5,867154613236e-07
   0: 69 KSP preconditioned resid norm 4,018511060069e-16 true resid norm 1,933551250949e-04 ||r(i)||/||b|| 4,395639268390e-07
   0: 70 KSP preconditioned resid norm 3,327707911589e-16 true resid norm 1,477827907372e-04 ||r(i)||/||b|| 3,359620479870e-07
   0: 71 KSP preconditioned resid norm 2,458283001628e-16 true resid norm 1,169124786837e-04 ||r(i)||/||b|| 2,657830155858e-07
   0: 72 KSP preconditioned resid norm 2,127388665524e-16 true resid norm 9,184205349023e-05 ||r(i)||/||b|| 2,087891575737e-07
   0: 73 KSP preconditioned resid norm 1,495585985687e-16 true resid norm 6,863031725036e-05 ||r(i)||/||b|| 1,560207506058e-07
   0: 74 KSP preconditioned resid norm 1,174238330276e-16 true resid norm 5,246571049336e-05 ||r(i)||/||b|| 1,192729373868e-07
   0: 75 KSP preconditioned resid norm 9,317459720425e-17 true resid norm 4,120877969601e-05 ||r(i)||/||b|| 9,368199066115e-08
   0:Linear solve converged due to CONVERGED_RTOL iterations 75
   0:KSP Object: 1 MPI processes
   0:  type: cg
   0:  maximum iterations=10000, initial guess is zero
   0:  tolerances:  relative=1e-08, absolute=1e-50, divergence=10000.
   0:  left preconditioning
   0:  using PRECONDITIONED norm type for convergence test
   0:PC Object: 1 MPI processes
   0:  type: bjacobi
   0:    block Jacobi: number of blocks = 1
   0:    Local solve is same for all blocks, in the following KSP and PC objects:
   0:    KSP Object:    (sub_)     1 MPI processes
   0:      type: preonly
   0:      maximum iterations=10000, initial guess is zero
   0:      tolerances:  relative=1e-05, absolute=1e-50, divergence=10000.
   0:      left preconditioning
   0:      using NONE norm type for convergence test
   0:    PC Object:    (sub_)     1 MPI processes
   0:      type: ilu
   0:        ILU: out-of-place factorization
   0:        0 levels of fill
   0:        tolerance for zero pivot 2,22045e-14
   0:        matrix ordering: natural
   0:        factor fill ratio given 1., needed 1.
   0:          Factored matrix follows:
   0:            Mat Object:             1 MPI processes
   0:              type: seqaij
   0:              rows=27118, cols=27118
   0:              package used to perform factorization: petsc
   0:              total: nonzeros=134928, allocated nonzeros=134928
   0:              total number of mallocs used during MatSetValues calls =0
   0:                not using I-node routines
   0:      linear system matrix = precond matrix:
   0:      Mat Object:       1 MPI processes
   0:        type: seqaij
   0:        rows=27118, cols=27118
   0:        total: nonzeros=134928, allocated nonzeros=135590
   0:        total number of mallocs used during MatSetValues calls =0
   0:          not using I-node routines
   0:  linear system matrix = precond matrix:
   0:  Mat Object:   1 MPI processes
   0:    type: mpiaij
   0:    rows=27118, cols=27118
   0:    total: nonzeros=134928, allocated nonzeros=189826
   0:    total number of mallocs used during MatSetValues calls =0
   0:      not using I-node (on process 0) routines
   0: iterations           75
   0: norm of residual:   4.120877969601395E-005
   0: solver time:  0.139440812170506
   0: calculating true residual of petsc ksp
   0: true norm of residual:   4.120877960391687E-005


More information about the petsc-users mailing list