Segementation Fault upon calling tape.visualise()

I am trying to run the debug demo (below) but end up getting a segmentation fault. I am using the docker image pyadjoint:2019.1.0 . I suspect the problem might be with tensorflow. Is there a correct way of installing tensorflow in the container? I did sudo pip install tensorflow, which might be a problem - I usually use anaconda and I’m not very familiar with docker. Tensorflow disappears upon exiting the docker session.

from dolfin import *
from dolfin_adjoint import *

n = 30
mesh = UnitSquareMesh(n, n)
V = VectorFunctionSpace(mesh, "CG", 2)

u = project(Expression(("sin(2*pi*x[0])", "cos(2*pi*x[1])"), degree=2),  V)
u_next = Function(V, name="u_next")
v = TestFunction(V)

nu = Constant(0.0001, name="nu")

timestep = Constant(0.01, name="dt")

F = (inner((u_next - u)/timestep, v)
 + inner(grad(u_next)*u_next, v)
 + nu*inner(grad(u_next), grad(v)))*dx

bc = DirichletBC(V, (0.0, 0.0), "on_boundary")

tape = get_working_tape()

t = 0.0
end = 0.05
while (t <= end):
    with tape.name_scope("Timestep"):
        solve(F == 0, u_next, bc)
        u.assign(u_next)
        t += float(timestep)

tape.visualise()

For some reason segfaults happen on some versions of protobuf and tensorflow when importing dolfin.
We know that the version 3.6.1 of protobuf and version 1.13.1 of tensorflow should work in that docker image. So you may try
sudo pip3 install tensorflow==1.13.1 protobuf==3.6.1

With docker you might have to run the tensorboard command outside of the docker container unless you map the relevant ports for the docker container.

1 Like

Thanks, that fixed the issue