PETSc error 76 dolfinx

Hello,
I get the error “RuntimeError: Failed to successfully call PETSc function ‘KSPSolve’. PETSc error code is: 76” on my script.
From google search, it means out of memory error due to some software limitation. The suggested solution is to switch to mumps, however, it might already be the case (see below). To give more context, I’m using mpirun with 12 processors, on the docker image. From htop the machine memory usage is bellow 7Gb (of 250Gb).

problem = fem.petsc.NonlinearProblem(F, u, bcs)
solver = nls.petsc.NewtonSolver(domain.comm, problem)
solver.error_on_nonconvergence = False
ksp = solver.krylov_solver
opts = PETSc.Options()
option_prefix = ksp.getOptionsPrefix()
opts[f"{option_prefix}snes_linesearch_type"]="basic"
opts[f"{option_prefix}ksp_type"] = "cg"
opts[f"{option_prefix}pc_factor_mat_solver_type"] = "mumps"
opts[f"{option_prefix}linear_solver"] = "mumps"
ksp.setFromOptions()

Any suggestion ?

Have a nice day,
Raphaël

Your solver settings make no sense. See the PETSc KSP documentation and KSP API documentation.

Okay, so let me follow the doc and use

opts[f"{option_prefix}ksp_type"] = "preonly"
opts[f"{option_prefix}pc_type"] = "lu"
opts[f"{option_prefix}pc_factor_mat_solver_type"]="mumps"

I still get error 76

For what it’s worth, I had the same issue, I switched to an iterative solver (i.e. opts[f"{option_prefix}pc_type"] = "ksp") and I no longer have the problem.

I think LU is just too greedy memory-wise for large systems.

1 Like

Your solution worked for me too.

Just adding my experience to this thread, since I didn’t find it in any of the threads containing Error 76

I’ve encountered this error when i set the quadrature degree too low and effectively underintegrated my forms. This lead to my matrix not having full rank and the default solver produced infinity results. (and error 76)

My system was definitely not too big (Only one element).

Changing the solver did not change this, however I can imagine, that changing to an iterative solver may solve this problem in some cases, since iterative solvers may still work for some matrices without full rank.

In my case, I just needed to make sure that the quadrature degree was sufficiently large.

1 Like