4.1.3.1 pde.backends.numba_mpi.backend module

Defines the numba backend class.

class NumbaMPIBackend(config, *, name=None)[source]

Bases: NumbaBackend

Defines MPI-compatible numba backend.

Initialize the backend.

Parameters:
  • config (Config) – Configuration data for the backend

  • name (str) – The name of the backend

make_integrator(grid)[source]

Return function that integrates discretized data over a grid.

If this function is used in a multiprocessing run (using MPI), the integrals are performed on all subgrids and then accumulated. Each process then receives the same value representing the global integral.

Parameters:

grid (GridBase) – Grid for which the integrator is defined

Returns:

A function that takes a numpy array and returns the integral with the correct weights given by the cell volumes.

Return type:

Callable[[NumericArray], NumberOrArray]

make_mpi_synchronizer(operator='MAX')[source]

Return function that synchronizes values between multiple MPI processes.

Parameters:

operator (str or int) – Flag determining how the value from multiple nodes is combined. Possible values include “MAX”, “MIN”, and “SUM”.

Returns:

Function that can be used to synchronize values across nodes

Return type:

Callable[[float], float]