This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Parallel mesh construction

0 votes

I'm having trouble creating a mesh in parallel. I am creating a mesh using

// make the mesh
mesh = make_shared<dfn::UnitSquareMesh>(MPI_COMM_WORLD, 20, 20);

Running the code with 2 processors, I get the error message

*** -------------------------------------------------------------------------
*** Error:   Unable to create mesh entity.
*** Reason:  Mesh entity index 0 out of range [0, 0] for entity of dimension 1.
*** Where:   This error was encountered inside MeshEntity.cpp.
*** Process: 0
*** 
*** DOLFIN version: 2017.1.0.dev0
*** Git changeset:  4b0cda02df108e11a3384f6ae3affa73bd29944d
*** -------------------------------------------------------------------------

It is perhaps worth mentioning that a similar error message does not appear for process 1. If I run the code it serial (or replacing MPI_COMM_WORLD with MPI_COMM_SELF) it works fine.

Does anyone know what I could be doing wrong? or what could be causing this?

asked Apr 4, 2017 by davisad FEniCS Novice (470 points)

Seems to work fine for me. Did you also try without MPI_COMM_WORLD/MPI_COMM_SELF? That is

auto mesh = std::make_shared<dfn::UnitSquareMesh>(20, 20);

Maybe you can post a complete minimal example that reproduce the problem? Can you reproduce it yourself with the latest DOLFIN master in the quay.io/fenicsproject/dev Docker container? The Git changeset id in your error message is from January 31. You can see if upgrading to the latest development version fixes the problem.

Unfortunately no --- in fact, I got the code to work perfectly on a different machine, which makes me thing it is something about how I am compiling/linking everything that is the problem. Do you know what the error means? Perhaps that would be provide some insight as to which library is wrong ...

No, I don't know. It could be a problem with some libraries like MPI, ParMETIS or SCOTCH (depending on what you use). See also related problems here and here.

Yup! turns out fenics and petsc were linking to different ParMETIS libraries ...

...