Improve solve status check in PETScLUSolver

Issue #608 new
Jan Blechta created an issue

According to http://lists.mcs.anl.gov/pipermail/petsc-users/2015-November/027637.html we should call KSPConvergedReason. This could also include

  1. provide better feedback to users why LU/Cholesky factorization failed.
  2. tell how did factorization went: fill-in, pivoting for numerical stability v. not pivoting for sparsisty
  3. tell how backward substitution went: estimated accuracy, condition number, iterative refinement steps employed
  4. provide some interface to allow disallow PETSc fiddling with diagonal entries PCFactorSetShiftType, PCFactorSetShiftAmount. At least allow to turn it off. Now impossible because it is called after KSPSetFromOptions. PCSetFromOptions is not called. [Seems that these calls influence only PETSc factorizations, not external ones using packages MUMPS, etc.]
  5. document better how the solver should be tweaked (by PETScOptions or --petsc.mat_<pkg>_<opt> command-line option`) in the case of failure

Note also of new PCFailedReason.

Comments (12)

  1. Jan Blechta reporter

    Seems that @garth-wells already dropped some KSPConvergedReason checks into LU so this is not that critical. Also might be quite related to #815.

  2. Prof Garth Wells

    I think #815 will help - it will separate the generic solver stuff from the LU specifics, and it will ensure that PETScKrylovSolver and PETScLUSolver have the same semantics for controlling options.

  3. Jan Blechta reporter

    Yes. The situation is much better. This test case

    from dolfin import *
    
    mesh = UnitSquareMesh(10, 10)
    V = FunctionSpace(mesh, "P", 1)
    
    u = TrialFunction(V)
    v = TestFunction(V)
    w = Function(V)
    
    A = assemble(w**2*u*v*dx)
    b = assemble(v*dx)
    
    #PETScOptions.set("mat_mumps_cntl_1", 1.0)
    PETScOptions.set("mat_mumps_icntl_4", 2)
    solve(A, w.vector(), b, "mumps")  # Expecting an exception
    
    assert False  # Should not end up here
    

    now works with MUMPS. Jan: Add it as a unit test.

    On the other hand the test fails with UMFPACK, which is known to make things up.

  4. Jan Blechta reporter

    To be honest I don't know. I am aware you did some improvements there. Don't you mind if I keep this open, assigned to myself?

  5. Log in to comment