Passing a PETScPreconditioner to a PETScKrylovSolver segfaults
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
DOLFIN |
Fix Released
|
Undecided
|
Johan Hake |
Bug Description
Consider the following code:
###############
from dolfin import *
mesh = UnitSquare(32, 32)
V = FunctionSpace(mesh, 'CG', 1)
bc = DirichletBC(V, Constant(0.0), lambda x, on_boundary: on_boundary)
u = TrialFunction(V); v = TestFunction(V);
A, b = assemble_system( inner(grad(u), grad(v))*dx, Constant(1.0)*v*dx, bc)
KrylovSolver = PETScKrylovSolv
KrylovSolver = PETScKrylovSolv
x_petsc = PETScVector(
KrylovSolver.
###############
With the fenics PPA (1.0.0-
[pef@aislinn:
[0]PETSC ERROR: -------
[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range
...
If you comment out the second KrylovSolver constructor, it works.
Taking a look at the code, I suspect the problem is something to do with line 123 of dolfin/
###############
from dolfin import *
mesh = UnitSquare(32, 32)
V = FunctionSpace(mesh, 'CG', 1)
bc = DirichletBC(V, Constant(0.0), lambda x, on_boundary: on_boundary)
u = TrialFunction(V); v = TestFunction(V);
A, b = assemble_system( inner(grad(u), grad(v))*dx, Constant(1.0)*v*dx, bc)
p = PETScPreconditi
KrylovSolver = PETScKrylovSolv
x_petsc = PETScVector(
KrylovSolver.
###############
it works, since p is still around in memory. Unfortunately, I don't know anything about C++/boost/
Changed in dolfin: | |
status: | New → In Progress |
assignee: | nobody → Johan Hake (johan-hake) |
Changed in dolfin: | |
status: | Fix Committed → Fix Released |
Thanks, you were spot on!
These errors tend to be common in the Python interface of DOLFIN previously. However, after we added shared_ptr storage for most data types in Py DOLFIN this has changed. But we still have some untested parts of the interface which still tend to blow up.