bamboost.mpi.utilities
Functions
on_rank
(func, comm, rank) -> Callable[_P, _T]
Classes
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.
RootProcessMeta.comm_self
(instance) -> Generator[None, None, None]
Context manager to temporarily change the communicator to MPI.COMM_SELF.
Arguments:
- instance:
HasComm
Arguments:
- func
RootProcessMeta.exclude
(func)
Arguments:
- func
Decorator that ensures a method is only executed on the root process (rank 0).
Arguments:
- func:
callable
The method to be decorated.
Returns
The wrapped method that only executes on the root process.