Specify MPI distribution of mesh

Issue #36 new
Øyvind Evju created an issue

Motivated by http://fenicsproject.org/qa/8450/mpi4py-how-to-disable-automatic-distribution-of-mesh

Currently, mshr.generate_mesh() will create a mesh living on all processes. This might not be desired behaviour. Simplest solution would be to change signature of generate_mesh from

generate_mesh(domain, resolution, backend="cgal")

to

generate_mesh(domain, resolution, backend="cgal", mesh=None)

Comments (7)

  1. Benjamin Dam Kehlet

    Would something like

    generate_mesh(domain, resolution, backend, distribute=True)

    work?

    If distribute is false, then the entire mesh will live on the process where it is created.

  2. Øyvind Evju reporter

    There are probably cases where you'd want to distribute over a subset of processes. Passing an MPI-communicator would be consistent with how it works in dolfin. Is it problematic in swig?

  3. Benjamin Dam Kehlet

    No, I think the swig part is trivial.

    I was just thinking that since meshes are generated in serial anyway, if would be cleaner if the user took care of the distribution if you don't want the default behaviour (ie. generate on process 0 and distribute over all processes).

  4. Øyvind Evju reporter

    Possibly. Although I'm not sure how to distribute an existing mesh. I have no strong opinions, and I also think the existing workaround is perfectly ok (passing the mesh to _generate).

  5. Benjamin Dam Kehlet

    Ok. have you checked that it works?

    dolfin::MeshPartitioning can partition and distribute an existing mesh to all processes, but I don't know if you can specify the processes to distribute to. Maybe dolfin::MeshPartitioning should be extended to support this?

  6. Øyvind Evju reporter

    Yes, it works, also with other group communicators.

    I know nothing about how dolfin::MeshPartitioning works.

    -Øyvind

  7. Log in to comment