Distributed memory

class meshmode.distributed.MPIMeshDistributor(mpi_comm, manager_rank=0)
send_mesh_parts(mesh, part_per_element, num_parts)
  • mesh – A Mesh to distribute to other ranks.

  • part_per_element – A numpy.ndarray containing one integer per element of mesh indicating which part of the partitioned mesh the element is to become a part of.

  • num_parts – The number of partitions to divide the mesh into.

Sends each partition to a different rank. Returns one partition that was not sent to any other rank.


Returns the mesh sent by the manager rank.

class meshmode.distributed.MPIBoundaryCommSetupHelper(mpi_comm, actx, local_bdry_conns, bdry_grp_factory)

Helper for setting up inter-partition facial data exchange.

__init__(mpi_comm, actx, local_bdry_conns, bdry_grp_factory)
  • mpi_comm – An MPI.Intracomm

  • actx – An array context

  • local_bdry_conns – A dict mapping remote partition to local_bdry_conn, where local_bdry_conn is a DirectDiscretizationConnection that performs data exchange from the volume to the faces adjacent to partition i_remote_part.

  • bdry_grp_factory – Group factory to use when creating the remote-to-local boundary connections

__exit__(type, value, traceback)

Returns a dict mapping a subset of remote partitions to remote-to-local boundary connections, where a remote-to-local boundary connection is a DirectDiscretizationConnection that performs data exchange across faces from partition i_remote_part to the local mesh. When an empty dictionary is returned, setup is complete.

meshmode.distributed.get_partition_by_pymetis(mesh, num_parts, *, connectivity='facial', **kwargs)

Return a mesh partition created by pymetis.

  • mesh – A meshmode.mesh.Mesh instance

  • num_parts – the number of parts in the mesh partition

  • connectivity – the adjacency graph to be used for partitioning. Either "facial" or "nodal" (based on vertices).

  • kwargs – Passed unmodified to pymetis.part_graph().


a numpy.ndarray with one entry per element indicating to which partition each element belongs, with entries between 0 and num_parts-1.

Changed in version 2020.2: connectivity was added.


For a local mesh part in mesh, determine the set of numbers of remote partitions to which this mesh piece is connected.


mesh – A meshmode.mesh.Mesh instance


the set of partition numbers that are connected to mesh