Run your code sequentially with option '-pc_type lu'. Does it still diverge?
Hong On Tue, Aug 3, 2010 at 7:27 AM, Filippo Spiga <filippo.spiga at disco.unimib.it> wrote: > ?Dear all, > ? ?I'm not an expert so probably the answer of my problem is very easy (I > hope so!). I have a linear system (a distributed linear system) and I want > to solve it using SNES. I know the form of the solution (this is a test > case, then we want to apply the same method on another class of problems). I > already use part this code that works for another problem. ?I only changed > is the Jacobian and the Jacobian evaluation routine. I tested the Jacobian > using the option "-snes_type test" and the differences between mine compared > with the one calculated by PETSc is "0" (*). > > The matrix is very simple but is "singular" (determinant = 1.0519e-55) and > probably is also bad conditioned. At this point I tried the preconditioners. > ILU is not good because it doesn't work in a parallel environment. HYPRE > doesn't work, SNES diverges. I tried some basic tuning of HYPRE without > success. But I'm not an expert. So, what can I do? > > I used this options (**) and SNES doesn't converge (***). Jacobian and the > Residual vector are (**). I also tried (without success) to change > rtol/atol, increasing the accurancy until 1.e-13. Any suggestion to try to > find a good preconditioner (and a good tuning of that preconditioner) is > really appreciate. > > Thank you very much in advance! > > Regards > > > (*) > Testing hand-coded Jacobian, if the ratio is,O(1.e-8), the hand-coded > Jacobian is probably correct. > > (**) > -log_summary > -pc_type hypre > -snes_type ls > -snes_max_it 100000 > -snes_rtol 1.e-8 > -snes_atol 1.e-4 > -snes_monitor > -snes_monitor_solution > -snes_monitor_true_residual true > -snes_monitor_solution_update > -snes_view > > (***) > [0]: ?start=0, end=7 > [1]: ?start=7, end=13 > [2]: ?start=13, end=20 > [3]: ?start=20, end=27 > ?0 SNES Function norm 7.421625102155e-02 > ?1 SNES Function norm 1.979632611100e-02 > ?2 SNES Function norm 1.978787365526e-02 > ?3 SNES Function norm 1.978784197958e-02 > SNES Object: > ?type: ls > ? ?line search variant: SNESLineSearchCubic > ? ?alpha=0.0001, maxstep=1e+08, minlambda=1e-12 > ?maximum iterations=100000, maximum function evaluations=10000 > ?tolerances: relative=1e-08, absolute=0.0001, solution=1e-08 > ?total number of linear solver iterations=9 > ?total number of function evaluations=55 > ?KSP Object: > ? ?type: gmres > ? ? ?GMRES: restart=30, using Classical (unmodified) Gram-Schmidt > Orthogonalization with no iterative refinement > ? ? ?GMRES: happy breakdown tolerance 1e-30 > ? ?maximum iterations=10000, initial guess is zero > ? ?tolerances: ?relative=1e-05, absolute=1e-50, divergence=10000 > ? ?left preconditioning > ? ?using PRECONDITIONED norm type for convergence test > ?PC Object: > ? ?type: hypre > ? ? ?HYPRE BoomerAMG preconditioning > ? ? ?HYPRE BoomerAMG: Cycle type V > ? ? ?HYPRE BoomerAMG: Maximum number of levels 25 > ? ? ?HYPRE BoomerAMG: Maximum number of iterations PER hypre call 1 > ? ? ?HYPRE BoomerAMG: Convergence tolerance PER hypre call 0 > ? ? ?HYPRE BoomerAMG: Threshold for strong coupling 0.25 > ? ? ?HYPRE BoomerAMG: Interpolation truncation factor 0 > ? ? ?HYPRE BoomerAMG: Interpolation: max elements per row 0 > ? ? ?HYPRE BoomerAMG: Number of levels of aggressive coarsening 0 > ? ? ?HYPRE BoomerAMG: Number of paths for aggressive coarsening 1 > ? ? ?HYPRE BoomerAMG: Maximum row sums 0.9 > ? ? ?HYPRE BoomerAMG: Sweeps down ? ? ? ? 1 > ? ? ?HYPRE BoomerAMG: Sweeps up ? ? ? ? ? 1 > ? ? ?HYPRE BoomerAMG: Sweeps on coarse ? ?1 > ? ? ?HYPRE BoomerAMG: Relax down ? ? ? ? ?symmetric-SOR/Jacobi > ? ? ?HYPRE BoomerAMG: Relax up ? ? ? ? ? ?symmetric-SOR/Jacobi > ? ? ?HYPRE BoomerAMG: Relax on coarse ? ? Gaussian-elimination > ? ? ?HYPRE BoomerAMG: Relax weight ?(all) ? ? ?1 > ? ? ?HYPRE BoomerAMG: Outer relax weight (all) 1 > ? ? ?HYPRE BoomerAMG: Using CF-relaxation > ? ? ?HYPRE BoomerAMG: Measure type ? ? ? ?local > ? ? ?HYPRE BoomerAMG: Coarsen type ? ? ? ?Falgout > ? ? ?HYPRE BoomerAMG: Interpolation type ?classical > ? ?linear system matrix = precond matrix: > ? ?Matrix Object: > ? ? ?type=mpiaij, rows=27, cols=27 > ? ? ?total: nonzeros=223, allocated nonzeros=223 > ? ? ? ?not using I-node (on process 0) routines > SNES Diverged. Reason LS_FAILURE > |residual|_2=1.978784e-02 > |residualb|_inf=1.588862e-02 > |Au-b|_2=1.978784e-02 > |Au-b|_inf=1.588862e-02 > > > (****) Jacobian is stored as Sparse matrix > Jacobian = > > ? (1,1) ? ? ? 0.0185 > ? (3,1) ? ? ?-0.0093 > ? (4,1) ? ? ?-0.0093 > ? (5,1) ? ? ?-0.0093 > ?(26,1) ? ? ?-0.0278 > ? (2,2) ? ? ? 0.0031 > ? (5,2) ? ? ?-0.0093 > ? (5,3) ? ? ? 0.0046 > ? (7,3) ? ? ?-0.0046 > ?(10,3) ? ? ?-0.0046 > ?(13,3) ? ? ?-0.0139 > ?(15,3) ? ? ?-0.0093 > ?(26,3) ? ? ?-0.0093 > ? (5,4) ? ? ? 0.0046 > ? (6,4) ? ? ?-0.0139 > ? (7,4) ? ? ?-0.0046 > ?(16,4) ? ? ?-0.0093 > ?(26,4) ? ? ?-0.0093 > ?(27,4) ? ? ?-0.0046 > ? (3,5) ? ? ?-0.0046 > ? (4,5) ? ? ?-0.0046 > ? (7,5) ? ? ?-0.0093 > ?(26,5) ? ? ?-0.0093 > ? (4,6) ? ? ? 0.0139 > ? (6,6) ? ? ? 0.0139 > ? (7,6) ? ? ? 0.0046 > ?(16,6) ? ? ? 0.0093 > ?(26,6) ? ? ? 0.0093 > ?(27,6) ? ? ? 0.0046 > ? (3,7) ? ? ? 0.0046 > ? (4,7) ? ? ? 0.0046 > ? (5,7) ? ? ? 0.0093 > ? (7,7) ? ? ? 0.0093 > ?(26,7) ? ? ? 0.0093 > ? (3,8) ? ? ?-0.0046 > ? (8,8) ? ? ? 0.0031 > ?(10,8) ? ? ?-0.0046 > ? (3,9) ? ? ?-0.0139 > ? (5,9) ? ? ?-0.0046 > ? (9,9) ? ? ? 0.0062 > ? (3,10) ? ? ?0.0046 > ?(11,10) ? ? -0.0046 > ?(13,10) ? ? -0.0046 > ?(15,10) ? ? -0.0046 > ?(10,11) ? ? ?0.0046 > ?(11,11) ? ? ?0.0046 > ?(13,11) ? ? ?0.0046 > ?(15,11) ? ? ?0.0046 > ? (6,12) ? ? ?0.0093 > ? (7,12) ? ? ?0.0093 > ?(12,12) ? ? ?0.0278 > ?(13,12) ? ? ?0.0093 > ?(14,12) ? ? ?0.0093 > ?(15,12) ? ? ?0.0093 > ?(16,12) ? ? ?0.0093 > ?(26,12) ? ? ?0.0278 > ? (3,13) ? ? ?0.0139 > ? (7,13) ? ? ?0.0046 > ?(10,13) ? ? ?0.0046 > ?(13,13) ? ? ?0.0139 > ?(15,13) ? ? ?0.0093 > ?(26,13) ? ? ?0.0093 > ?(12,14) ? ? -0.0093 > ?(15,14) ? ? ?0.0046 > ?(16,14) ? ? ?0.0046 > ?(17,14) ? ? -0.0093 > ?(18,14) ? ? -0.0046 > ?(19,14) ? ? -0.0046 > ?(26,14) ? ? ?0.0093 > ? (3,15) ? ? ?0.0093 > ?(10,15) ? ? ?0.0046 > ?(11,15) ? ? -0.0046 > ?(12,15) ? ? -0.0093 > ?(13,15) ? ? -0.0093 > ?(14,15) ? ? -0.0046 > ?(18,15) ? ? -0.0139 > ?(26,15) ? ? ?0.0093 > ? (4,16) ? ? ?0.0093 > ? (6,16) ? ? -0.0093 > ?(12,16) ? ? -0.0093 > ?(14,16) ? ? -0.0046 > ?(19,16) ? ? -0.0139 > ?(20,16) ? ? -0.0046 > ?(26,16) ? ? ?0.0093 > ?(27,16) ? ? ?0.0046 > ?(12,17) ? ? ?0.0093 > ?(14,17) ? ? ?0.0093 > ?(17,17) ? ? ?0.0093 > ?(18,17) ? ? ?0.0046 > ?(19,17) ? ? ?0.0046 > ?(11,18) ? ? ?0.0046 > ?(12,18) ? ? ?0.0093 > ?(13,18) ? ? ?0.0093 > ?(14,18) ? ? ?0.0046 > ?(15,18) ? ? ?0.0139 > ?(18,18) ? ? ?0.0139 > ? (6,19) ? ? ?0.0093 > ?(12,19) ? ? ?0.0093 > ?(14,19) ? ? ?0.0046 > ?(16,19) ? ? ?0.0139 > ?(19,19) ? ? ?0.0139 > ?(20,19) ? ? ?0.0046 > ? (6,20) ? ? ?0.0046 > ?(16,20) ? ? ?0.0046 > ?(20,20) ? ? ?0.0046 > ?(27,20) ? ? ?0.0046 > ?(14,21) ? ? -0.0093 > ?(15,21) ? ? -0.0046 > ?(16,21) ? ? -0.0046 > ?(21,21) ? ? ?0.0093 > ?(26,21) ? ? -0.0093 > ? (3,22) ? ? -0.0093 > ?(10,22) ? ? -0.0046 > ?(15,22) ? ? -0.0139 > ?(22,22) ? ? ?0.0123 > ?(26,22) ? ? -0.0093 > ? (4,23) ? ? -0.0093 > ?(16,23) ? ? -0.0139 > ?(23,23) ? ? ?0.0123 > ?(26,23) ? ? -0.0093 > ?(27,23) ? ? -0.0046 > ? (4,24) ? ? -0.0046 > ?(24,24) ? ? ?0.0031 > ?(27,24) ? ? -0.0046 > ? (4,25) ? ? -0.0139 > ? (5,25) ? ? -0.0046 > ?(25,25) ? ? ?0.0062 > ? (3,26) ? ? ?0.0093 > ? (4,26) ? ? ?0.0093 > ? (5,26) ? ? ?0.0093 > ? (6,26) ? ? -0.0093 > ? (7,26) ? ? -0.0093 > ?(12,26) ? ? -0.0278 > ?(13,26) ? ? -0.0093 > ?(14,26) ? ? -0.0093 > ?(15,26) ? ? -0.0093 > ?(16,26) ? ? -0.0093 > ?(26,26) ? ? -0.0000 > ? (4,27) ? ? ?0.0046 > ? (6,27) ? ? -0.0046 > ?(16,27) ? ? -0.0046 > ?(20,27) ? ? -0.0046 > > > Residual = > > ? ? ? ? 0 > ? ? ? ? 0 > ? ?0.0001 > ? -0.0101 > ? ?0.0001 > ? -0.0001 > ? -0.0001 > ? ? ? ? 0 > ? ? ? ? 0 > ? ?0.0000 > ? ?0.0000 > ? -0.0004 > ? -0.0001 > ? -0.0001 > ? -0.0040 > ? -0.0040 > ? ?0.0000 > ? ?0.0000 > ? ?0.0000 > ? ?0.0000 > ? ? ? ? 0 > ? ? ? ? 0 > ? ? ? ? 0 > ? ? ? ? 0 > ? ? ? ? 0 > ? -0.0159 > ? -0.0021 > > -- > > =============================================================== > ?Filippo SPIGA ? ? ? ? ? ? ? ?MSc, HPC and GRID Technologist > ?tel.: ? +39 340 8387735 ? ? ?skype: filippo.spiga > =============================================================== > > ?Nobody will drive us out of Cantor's paradise.? > ? ? -- David Hilbert > >
