Bamboost
bamboost/mpi

bamboost.mpi

This module handles the detection and selection of the appropriate MPI implementation for Bamboost, either using mpi4py for real MPI environments or falling back to a mock MPI implementation for non-MPI environments.

The detection logic considers user configuration options, environment variables, and the presence of common MPI-related environment variables.

If mpi4py is unavailable in an MPI environment, a fallback to the mock implementation is also provided.

Usage

Instead of importing mpi4py.MPI directly, import MPI to use the appropriate MPI module based on the current environment.

>>> from bamboost.mpi import MPI

Type Aliases

Comm: Union of real and mock MPI communicators, available under TYPE_CHECKING.

Attributes

  • Comm:typing_extensions.TypeAlias=typing.Union[mpi4py.MPI.Comm, bamboost.mpi.mock.Comm]
  • log:Logger=BAMBOOST_LOGGER.getChild(__name__.split('.')[-1])

    Logger instance for this module.

  • MPI_ON:bool=_detect_if_mpi_needed()

    Flag indicating whether MPI is detected and enabled.

  • MPI:=_get_mpi_module()

    The selected MPI module (mpi4py.MPI or ).

Functions

Classes

Communicator

Attributes:
  • _active_comm=bamboost.mpi.MPI.bamboost.mpi.MPI.COMM_WORLD
Communicator.__delete__(self, instance)
Arguments:
  • instance
Communicator.__get__(self, instance, owner) -> Comm
Arguments:
  • instance
  • owner
Communicator.__set__(self, instance, value)
Arguments:
  • instance
  • value