Usage: PETScOptions for mumps?

Hi,
I am trying to modify the preconditioner object associated with the Krylov subspace problem by following,

eps = SLEPc.EPS()
st = eps.getST()
st.setType(st.Type.SINVERT)
ksp = st.getKSP()
ksp.setType(ksp.Type.GCR)
pc = ksp.getPC()
pc.setType(pc.Type.LU)
pc.setFactorSolverPackage('mumps')

I get the following error.

AttributeError: 'petsc4py.PETSc.PC' object has no attribute 'setFactorSolverPackage'

Any suggestions would be appreciated!

Based on the petsc4py API here, do you maybe want setFactorSolverType? (Googling that and setFactorSolverPackage, it looks like there may have been an API change at some point.)

2 Likes

Thank you that was very helpful.

My code is very similar :

# Solver
E = slp.EPS(); E.create()
E.setOperators(-A,B) # Solve dM/dq*x=sigma*N*x (A*x+sigma*B*x=0)
E.setWhichEigenpairs(E.Which.LARGEST_REAL)
E.setDimensions(k) # Find k eigenvalues only
E.setTolerances(ae,ncv) # Set absolute tolerance and number of iterations
E.setProblemType(slp.EPS.ProblemType.PGNHEP) # Specify that A is no hermitian, but M is semi-positive
# Spectral transform
ST = E.getST()
# Krylov subspace
KSP = ST.getKSP()
KSP.setType('preonly')
# Preconditioner
PC =  KSP.getPC()
PC.setType('lu')
PC.setFactorSolverType('mumps')

Notice that I am trying to get the eigenvalues wiith the largest real part, not close to a target.

I understand that the petsc default is Krylov-Schur with GMRES inside every subspace, I tried above to move to Krylov-Schur with MUMPS. In in my case A is non Hermitian, B diagonal semi-positive.

The code above produces :

Traceback (most recent call last):
  File "xxx", line XX, in <module>
    yo.Eigenvalues(a,b)
  File "code.py", line 385, in Eigenvalues
    E.solve()
  File "SLEPc/EPS.pyx", line 1233, in slepc4py.SLEPc.EPS.solve
setFactorSolverPackagepetsc4py.PETSc.Error: error code 76
[0] EPSSolve() at /usr/local/slepc/src/eps/interface/epssolve.c:136
[0] EPSSetUp() at /usr/local/slepc/src/eps/interface/epssetup.c:350
[0] STSetUp() at /usr/local/slepc/src/sys/classes/st/interface/stsolve.c:582
[0] STSetUp_Shift() at /usr/local/slepc/src/sys/classes/st/impls/shift/shift.c:107
[0] KSPSetUp() at /usr/local/petsc/src/ksp/ksp/interface/itfunc.c:408
[0] PCSetUp() at /usr/local/petsc/src/ksp/pc/interface/precon.c:1016
[0] PCSetUp_LU() at /usr/local/petsc/src/ksp/pc/impls/factor/lu/lu.c:133
[0] MatLUFactorNumeric() at /usr/local/petsc/src/mat/interface/matrix.c:3186
[0] MatFactorNumeric_MUMPSpetsc4py.PETSc.Error: error code 76
[0] EPSSolve() at /usr/local/slepc/src/eps/interface/epssolve.c:136
[0] EPSSetUp() at /usr/local/slepc/src/eps/interface/epssetup.c:350
[0] STSetUp() at /usr/local/slepc/src/sys/classes/st/interface/stsolve.c:582
[0] STSetUp_Shift() at /usr/local/slepc/src/sys/classes/st/impls/shift/shift.c:107
[0] KSPSetUp() at /usr/local/petsc/src/ksp/ksp/interface/itfunc.c:408
[0] PCSetUp() at /usr/local/petsc/src/ksp/pc/interface/precon.c:1016
[0] PCSetUp_LU() at /usr/local/petsc/src/ksp/pc/impls/factor/lu/lu.c:133
[0] MatLUFactorNumeric() at /usr/local/petsc/src/mat/interface/matrix.c:3186
[0] MatFactorNumeric_MUMPS() at /usr/local/petsc/src/mat/impls/aij/mpi/mumps/mumps.c:1686
[0] Error in external library
[0] Error reported by MUMPS in numerical factorization phase: INFOG(1)=-9, INFO(2)=4008881() at /usr/local/petsc/src/mat/impls/aij/mpi/mumps/mumps.c:1686
[0] Error in external library
[0] Error reported by MUMPS in numerical factorization phase: INFOG(1)=-9, INFO(2)=4008881

I found here a decoding of this error stating :


I have no idea how to fix this…

I am using dolfinx with a docker installation, activated in complex mode - I believe slepc4py came with it.

Quick update : I’ve taken inspiration from p101 of this book and added at the beginning of my script :

import petsc4py
petsc4py.init(['-mat_mumps_icntl_14 100'])

This has absolutely no effect.

This not really a fix (sorry) but I had a similar problem and using PC.setFactorSolverType('superlu_dist') did not lead to any failure.