coffee.mpi package

Submodules

coffee.mpi.mpiinterfaces module

Contains classes that abstract the MPI C API.

Classes in this module model the MPI node network and manage the relationship of the complete domain to each

class coffee.mpi.mpiinterfaces.EvenCart(domain, boundary_data, *args, **kwds)[source]

Bases: MPIInterface

collect_data(data)[source]

A method that collects all computed function values over all sub-grids managed by all MPI nodes and returns the amalgamated data if the rank of this process is 0.

This gives a way to get a single copy of all computed data so far. It does, however, assume that all subsequence processing occurs on a single MPI node. This is a bottle neck.

Parameters:

data (numpy.ndarray) – The data to be communicated.

Returns:

The collated data if MPI_Comm_Rank is 0, none otherwise.

Return type:

None or numpy.ndarray

communicate(data, b_data)[source]

Communicates the given data to appropriate neighbouring nodes.

Parameters:
  • data (numpy.ndarray) – An array representing the values of the computed function over the sub-grid managed by the MPI node this code is being computed on.

  • b_data (grid.ABCBoundary) –

Returns:

The returned data is a list of tuples. The first element of the tuple describes which grid points the communicated data relates to. The second element is the data received from whichever MPI node manages the sub-grid which looks after the relevant grid points.

Return type:

list of tuples (list of slices, numpy.ndarray)

property subdomain

Returns the slices which give the subdomain for the MPI node that this method is called on.

Return type:

list of tuples of slices

class coffee.mpi.mpiinterfaces.MPIInterface(mpi_comm, *args, **kwds)[source]

Bases: object

barrier()[source]
abstract communicate(data)[source]

Returns a list of tuples. The first element of each tuple is a slice representing the portion of data which corresponds to the second element of the tuple. The second element of the tuple is an array of data which are the communicated values that correspond to the positions described by the slice.

abstract subdomain()[source]

Returns a tuple of slice objects that represents the subdomain of the full grid that this MPI node should perform computations over.

Return type:

tuple of slices

Module contents