Bamboost
bamboostmpi

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

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.

Functions

get_mpi_from_env() -> tuple[object, bool]

Get the MPI module and flag based on environment detection.

_get_mpi_module() -> tuple[object, bool]

Attempt to import the real MPI module (mpi4py.MPI). Returns the module and a flag.

Classes

Communicator

Attributes:
  • _active_comm:Comm=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

On this page