### How to run mpi parallel code with projection operations?

361
views
0
12 months ago by

I have a simple code, which I'm able to run in serial, but mpiexec -n8 python test.py results in error

RuntimeError:

*** -------------------------------------------------------------------------
*** DOLFIN encountered an error. If you are not able to resolve this issue
*** using the information listed below, you can ask for help at
***
***
*** Remember to include the error message listed below and, if possible,
*** include a *minimal* running example to reproduce the error.
***
*** -------------------------------------------------------------------------
*** Error:   Unable to evaluate function at point.
*** Reason:  The point is not inside the domain. Consider calling "Function::set_allow_extrapolation(true)" on this Function to allow extrapolation.
*** Where:   This error was encountered inside Function.cpp.
*** Process: 0
***
*** DOLFIN version: 2016.2.0
*** Git changeset:  unknown
*** -------------------------------------------------------------------------

--------------------------------------------------------------------------
mpiexec noticed that process rank 1 with PID 0 on node deepstation exited on signal 6 (Aborted).
--------------------------------------------------------------------------


The code is straightforward:

n = 32
mesh = UnitSquareMesh(n, n, "crossed")
mesh2 = UnitSquareMesh(2*n, 2*n, "crossed")

A = FunctionSpace(mesh, "CG", 1)
A2 = FunctionSpace(mesh2, "CG", 1)

a = interpolate(Constant(1.0), A)
sh = max(a.vector().array().shape)
a.vector().set_local(np.random.rand(sh))
a2 = project(a, A2)


I would gladly do projection on one cpu, this is by far not the costliest operation, but if I restrict it with

if MPI.rank(mpi_comm_world()) == 0:

then how do I scatter a2 back to whole mpi.world?

Community: FEniCS Project
Did you set the parameter Function::set_allow_extrapolation(true) like the error report suggests?
written 12 months ago by pf4d