[petsc-users] The same code randomly produce different residual norms

Barry Smith bsmith at mcs.anl.gov
Sat Mar 22 09:24:21 CDT 2014


   All of these answers are equally correct, they are due to different round-offs due to different order of operations due to different communication patterns between the processes in each run.

   Barry

On Mar 21, 2014, at 9:49 PM, Fande Kong <fd.kong at siat.ac.cn> wrote:

> Hi,
> 
> I run the code src/snes/examples/tutorials/ex5.c with options: 
> 
>  mpirun  -n 8  ./ex5 -pc_type mg \
>  -ksp_monitor\
>  -pc_mg_levels 3 \
>  -pc_mg_galerkin \
>  -da_grid_x 17 \
>  -da_grid_y 17 \
>  -mg_levels_ksp_norm_type unpreconditioned \
>  -snes_monitor \
>  -mg_levels_ksp_chebyshev_estimate_eigenvalues 0.5,1.1 \
>  -mg_levels_pc_type sor \
>  -pc_mg_type \
> 
> 
> I run this script several times, but at each time, the residual norms have some tiny differences ( these should not happen). For example:
> 
> Case 1:
> 
>   0 SNES Function norm 1.188788066192e+00 
>     0 KSP Residual norm 1.573384253521e+00 
>     1 KSP Residual norm 3.616321708396e-02 
>     2 KSP Residual norm 2.780221563755e-04 
>     3 KSP Residual norm 2.194662354037e-06 
>   1 SNES Function norm 5.125240595190e-03 
>     0 KSP Residual norm 1.217284338266e-01 
>     1 KSP Residual norm 1.774247017346e-04 
>     2 KSP Residual norm 2.557118591292e-06 
>     3 KSP Residual norm 1.622173269367e-08 
>   2 SNES Function norm 3.922335995111e-05 
>     0 KSP Residual norm 9.960745924876e-04 
>     1 KSP Residual norm 1.273916336665e-06 
>     2 KSP Residual norm 1.571259383270e-08 
>     3 KSP Residual norm 1.250266145356e-10 
>   3 SNES Function norm 2.662898279023e-09 
> 
> 
> Case 2: 
> 
> 
>   0 SNES Function norm 1.188788066192e+00 
>     0 KSP Residual norm 1.573384253521e+00 
>     1 KSP Residual norm 3.616321708396e-02 
>     2 KSP Residual norm 2.780221563755e-04 
>     3 KSP Residual norm 2.194662354037e-06 
>   1 SNES Function norm 5.125240595190e-03 
>     0 KSP Residual norm 1.217284338266e-01 
>     1 KSP Residual norm 1.774247017347e-04 
>     2 KSP Residual norm 2.557118591292e-06 
>     3 KSP Residual norm 1.622173269367e-08 
>   2 SNES Function norm 3.922335995108e-05 
>     0 KSP Residual norm 9.960745924862e-04 
>     1 KSP Residual norm 1.273916336654e-06 
>     2 KSP Residual norm 1.571259383257e-08 
>     3 KSP Residual norm 1.250266145346e-10 
>   3 SNES Function norm 2.662898285038e-09 
> 
> These differences are marked by red color. So here, I was wondering there are any explanations why these happen?
> 
> Thanks,
> 
> Fande,
> 
> 



More information about the petsc-users mailing list