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 MPIAttributes
- 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
() -> tuple[object, bool]Get the MPI module and flag based on environment detection.
() -> bool() -> tuple[object, bool]Attempt to import the real MPI module (mpi4py.MPI). Returns the module and a
flag.
() -> NoneClasses
Communicator
Attributes:
(self, instance)Arguments:
- instance
(self, instance, owner) -> CommArguments:
- instance
- owner
(self, instance, value)Arguments:
- instance
- value
Bamboost