[petsc-users] Question on DMMGSetSNESLocal from snes/example/tutorials/ex19.c

Jed Brown jed at jedbrown.org
Sat May 31 16:48:28 CDT 2014


"Sun, Hui" <hus003 at ucsd.edu> writes:

> Thank you Jed for explaining this to me. I tried to compile and run with the following options:
> ./ex19 -lidvelocity 100 -grashof 1e4 -da_grid_x 32 -da_grid_y 32 -da_refine 2 -snes_monitor_short -snes_converged_reason
>
> 1). I use 2 cores and get the following output:
> lid velocity = 100, prandtl # = 1, grashof # = 10000
>   0 SNES Function norm 1111.93 
>   1 SNES Function norm 829.129 
>   2 SNES Function norm 532.66 
>   3 SNES Function norm 302.926 
>   4 SNES Function norm 3.64014 
>   5 SNES Function norm 0.0410053 
>   6 SNES Function norm 4.57951e-06 
> Nonlinear solve converged due to CONVERGED_FNORM_RELATIVE iterations 6
> Number of SNES iterations = 6
> Time cost for creating solver context 0.000907183 s, and for solve 25.2764 s.
>
> 2). I use 8 cores and get the following output:
> lid velocity = 100, prandtl # = 1, grashof # = 10000
>   0 SNES Function norm 1111.93 
>   1 SNES Function norm 829.049 
>   2 SNES Function norm 532.616 
>   3 SNES Function norm 303.165 
>   4 SNES Function norm 3.93436 
> Nonlinear solve did not converge due to DIVERGED_LINEAR_SOLVE iterations 4
> Number of SNES iterations = 4
> Time cost for creating solver context 0.0244079 s, and for solve 25.0607 s.
>
> First of all, the two runs yields different results. 

The linear solve did not converge in the second case.

Run a more robust linear solver.  These problems can get difficult, but
I think -pc_type asm -sub_pc_type lu should be sufficient.

> Secondly, the time cost comparison doesn't seem to be scaling correctly. 
> ( I have used petsctime.h to calculate the time cost. )

1. Run in optimized mode.

2. Don't use more processes than you have cores (I don't know if this
affects you).

3. This problem is too small to take advantage of much (if any)
parallelism.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140531/67653fd6/attachment.pgp>


More information about the petsc-users mailing list