[petsc-dev] GMRES and eigen estimates

Mark F. Adams mark.adams at columbia.edu
Tue Apr 3 17:40:02 CDT 2012


On Apr 3, 2012, at 5:05 PM, Barry Smith wrote:

> 
> 
>  So?
> 
> 1) You get lucky and CG gives you a zero residual right off the bat while GMRES does not.

I don't quite understand the CG results.  I assume that CG applies the preconditioner before the iteration (I recall seeing that in the code at one point) and so it never sees a residual.  GMRES seems to have different behavior ... CG also seems to stop after 7 iterations. Not clear why that happens (max its is set to 10).

> 
> 2)  "I turn off norms for this -- its in the eigen estimate -- because I don't usually want them. "    But doesn't GMRES compute the norms always? So why not have the GMRES version still kick out early if the norm reduces by same 10^10 before it ran out of its? (Since the norm is "free" for GMRES there is no harm done, and good things occasionly like your case below.
> 

I use this code:

          ierr = KSPSetNormType( eksp, KSP_NORM_NONE );                 CHKERRQ(ierr);
          ierr = KSPSetOptionsPrefix(eksp,((PetscObject)pc)->prefix);CHKERRQ(ierr);
          ierr = KSPAppendOptionsPrefix( eksp, "gamg_est_");         CHKERRQ(ierr);
          ierr = KSPSetFromOptions( eksp );    CHKERRQ(ierr);

So I assume that the KSP_NORM_NONE turns off convergence checking.

Mark


>   Barry
> 
> 
> On Apr 3, 2012, at 3:46 PM, Mark F. Adams wrote:
> 
>> Sorry false alarm.
>> 
>> Running in KSP tutorials (this creates a GASM PC that is just one block with the whole domain):
>> 
>> ./ex54 -ne 5 -pc_type gamg -pc_gamg_type agg -pc_gamg_agg_nsmooths 1 -pc_gamg_verbose 2 -pc_gamg_use_agg_gasm -mat_coarsen_type hem -pc_gamg_square_graph false -mg_levels_sub_pc_type lu -gamg_est_ksp_type gmres -options_left -ksp_monitor -gamg_est_ksp_monitor_singular_value -gamg_est_ksp_view
>> 
>> I get:
>> 
>> 0 KSP Residual norm 6.446415297424e+01 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 1 KSP Residual norm 2.366096117202e-14 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 2 KSP Residual norm 1.540964857879e-14 % max 1.693380955892e+00 min 7.781997678493e-01 max/min 2.176023465763e+00
>> 3 KSP Residual norm 1.241326996942e-14 % max 2.530597391197e+00 min 7.364405777662e-01 max/min 3.436254692636e+00
>> 4 KSP Residual norm 1.063574617851e-14 % max 3.476067169257e+00 min 7.236790329140e-01 max/min 4.803327181195e+00
>> 5 KSP Residual norm 9.458672353406e-15 % max 4.436589616128e+00 min 7.159721822673e-01 max/min 6.196594959987e+00
>> 6 KSP Residual norm 8.601272732515e-15 % max 5.409099625105e+00 min 7.111665034107e-01 max/min 7.605953878822e+00
>> 7 KSP Residual norm 7.941524085286e-15 % max 6.390434791698e+00 min 7.078275282801e-01 max/min 9.028237157187e+00
>> 8 KSP Residual norm 7.413487448731e-15 % max 7.377240678599e+00 min 7.053779875665e-01 max/min 1.045856378939e+01
>> 9 KSP Residual norm 6.978470326179e-15 % max 8.367510521210e+00 min 7.035029387897e-01 max/min 1.189406619339e+01
>> 10 KSP Residual norm 6.612020575839e-15 % max 9.360078579306e+00 min 7.020212846961e-01 max/min 1.333304101080e+01
>> 
>> The problem is that I turn off norms for this -- its in the eigen estimate -- because I don't usually want them.  Here they would have stopped the iterations and all would have been good.
>> 
>> BTW, CG does this:
>> 
>> 0 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 1 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 2 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 3 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 4 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 5 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 6 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>> 7 KSP Residual norm 0.000000000000e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>>                       PCSetUp_GAMG PC setup max eigen=1.000000e+00 min=0.000000e+00 on level 1 (N=36)
>> 
>> Is it using a preconditioned norm perhaps....
>> 
>> Mark
>> 
>> On Apr 3, 2012, at 2:06 PM, Barry Smith wrote:
>> 
>>> 
>>> barry-smiths-macbook-pro:tutorials barrysmith$ ./ex10 -f0 ~/Datafiles/Matrices/arco1 -pc_type lu -ksp_type gmres -ksp_monitor_singular_value
>>> 0 KSP Residual norm 2.544968574075e+03 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>>> 1 KSP Residual norm 2.708628636814e-10 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>>> Number of iterations =   1
>>> Residual norm 2.36559e-11
>>> barry-smiths-macbook-pro:tutorials barrysmith$ ./ex10 -f0 ~/Datafiles/Matrices/arco1 -pc_type lu -ksp_type fgmres -ksp_monitor_singular_value
>>> 0 KSP Residual norm 7.410897708964e+00 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>>> 1 KSP Residual norm 2.157675690523e-11 % max 9.999999999999e-01 min 9.999999999999e-01 max/min 1.000000000000e+00
>>> Number of iterations =   1
>>> Residual norm 2.26094e-11
>>> barry-smiths-macbook-pro:tutorials barrysmith$ ./ex10 -f0 ~/Datafiles/Matrices/arco1 -pc_type lu -ksp_type cg -ksp_monitor_singular_value
>>> 0 KSP Residual norm 2.544968574075e+03 % max 1.000000000000e+00 min 1.000000000000e+00 max/min 1.000000000000e+00
>>> 1 KSP Residual norm 3.135993325987e-10 % max 9.999999999999e-01 min 9.999999999999e-01 max/min 1.000000000000e+00
>>> Number of iterations =   1
>>> Residual norm 2.22684e-11
>>> 
>>> Mark,
>>> 
>>> Could you provide the exact specifications on how you obtained this bad highest eigen estimate? What code you ran with what options?
>>> 
>>>  Thanks
>>> 
>>>  barry
>>> 
>>> 
>>> On Mar 30, 2012, at 10:22 AM, Mark F. Adams wrote:
>>> 
>>>> I've had problems with GMRES and eigen estimates in the past but I now have a smoking gun.  It seems that if you give GMRES an operator preconditioned with LU (ie, the preconditioned operator is the identity) GMRES gives me a highest eigen estimate of ~10 (way off).  With CG I get a prefect max=1.0, min=0.0.
>>>> 
>>>> Any thoughts?
>>>> 
>>>> Mark
>>> 
>>> 
>> 
> 
> 




More information about the petsc-dev mailing list