Bamboost
bamboostmpiutilities

bamboost.mpi.utilities

Attributes

  • _CT=TypeVar('_CT', bound=Callable)

Functions

comm_self(instance) -> Generator[None, None, None]

Context manager to temporarily change the communicator to MPI.COMM_SELF.

This context manager allows collective operations (which normally require execution across all ranks to prevent deadlocks) to be called from a single rank only, as MPI.COMM_SELF represents a single-rank communicator.

Arguments:
  • instance:HasComm

    An instance of a class that has a _comm attribute (MPI communicator).

Classes

HasComm

Attributes:

RootProcessMeta

A metaclass that makes classes MPI-safe by ensuring methods are only executed on the root process. The class implementing this metaclass must have a _comm attribute that is an MPI communicator.

This metaclass modifies class methods to either use broadcast communication (if decorated with @bcast) or to only execute on the root process (rank 0).

Attributes:
  • __exclude__={'__init__', '__new__'}
RootProcessMeta.__new__(mcs, name, bases, attrs)

Create a new class with MPI-safe methods.

Arguments:
  • mcs
  • name:str

    The name of the class being created.

  • bases:tuple

    The base classes of the class being created.

  • attrs:dict

    The attributes of the class being created.

Returns
The new class with MPI-safe methods.

Decorator that ensures a method is only executed on the root process (rank 0).

Arguments:
  • func:callable

    The method to be decorated.

Returns
_CTThe wrapped method that only executes on the root process.
Arguments:
  • func

On this page