How to run demo_poisson.py in parallel inside container without Exit Code: 9?

I’m using this container quay.io/fenicsproject/stable:current to run the script below, which is just the script that was at ~/demo/python/documented/poisson in the docker image but with increased mesh resolution to be able to measure the speedup of the parallel run (hence the UnitSquareMesh(800, 800)).

I’m running the script with:

docker-compose run fenics bash
cd notebooks/examples
mpirun -np 6 python3 script.py

But I’m getting the error below. Just running python3 script.py works well though.

Any clue on how I could fix this?

The error trace

fenics@504b57b5deac:~/shared/notebooks/examples$ mpirun -np 6 python3 parallel_test.py 
Process 0: Solving linear variational problem.
Process 1: Solving linear variational problem.
Process 4: Solving linear variational problem.
Process 5: Solving linear variational problem.
Process 3: Solving linear variational problem.
Process 2: Solving linear variational problem.

===================================================================================
=   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES
=   PID 114 RUNNING AT 504b57b5deac
=   EXIT CODE: 9
=   CLEANING UP REMAINING PROCESSES
=   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES
===================================================================================
YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Killed (signal 9)
This typically refers to a problem with your application.
Please see the FAQ page for debugging suggestions

The script

from dolfin import *
mesh = UnitSquareMesh(800, 800)
V = FunctionSpace(mesh, "Lagrange", 1)
def boundary(x):
    return x[0] < DOLFIN_EPS or x[0] > 1.0 - DOLFIN_EPS
u0 = Constant(0.0)
bc = DirichletBC(V, u0, boundary)
u = TrialFunction(V)
v = TestFunction(V)
f = Expression("10*exp(-(pow(x[0] - 0.5, 2) + pow(x[1] - 0.5, 2)) / 0.02)", degree=2)
g = Expression("sin(5*x[0])", degree=2)
a = inner(grad(u), grad(v))*dx
L = f*v*dx + g*v*ds
u = Function(V)
solve(a == L, u, bc)

The docker-compose.yml

version: "3.9"  
services:
  fenics:
    image: quay.io/fenicsproject/stable:current
    volumes:
      - ./:/home/fenics/shared
    working_dir: /home/fenics/shared

Unfortunately I cannot reproduce this on my system using Docker version 20.10.6, build 370c289 on Ubuntu 20.04 (not docker-compose):

docker run -it -v $(pwd):/home/fenics/shared -w /home/fenics/shared --rm  quay.io/fenicsproject/stable:current
mpirun -n 6 python3 demo_poisson.py 
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Calling FFC just-in-time (JIT) compiler, this may take some time.
Process 0: Solving linear variational problem.
Process 2: Solving linear variational problem.
Process 3: Solving linear variational problem.
Process 4: Solving linear variational problem.
Process 5: Solving linear variational problem.
Process 1: Solving linear variational problem.

What kind of system are you using to run docker compose with?

1 Like

Are you sure you’re not running out of memory?

1 Like

I think this was indeed running out of memory.

I’m running this on macOS Catalina and Docker version 20.10.5, build 55c4c88. I was sure that I had changed the memory limit in the Docker Desktop app > resources section, before my last test, but I probably did it after that. So I think this was just my bad after all.

Now I ran it again after some time and it works as expected.

Thanks for your help!

2 Likes