bamboost.mpi.utilities
Attributes
- _P=
ParamSpec('_P') - _T=
TypeVar('_T')
Functions
on_rank
(func, comm, rank) -> Callable[_P, _T]Classes
HasComm
Attributes:
- _comm:
Communicator
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:
strThe name of the class being created.
- bases:
tupleThe base classes of the class being created.
- attrs:
dictThe 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
RootProcessMeta.bcast_result
(func) -> Callable[_P, _T]Arguments:
- func:
typing.Callable[_P, bamboost.mpi.utilities._T]
RootProcessMeta.exclude
(func)Arguments:
- func
Decorator that ensures a method is only executed on the root process (rank 0).
Arguments:
- func:
callableThe method to be decorated.
Returns
The wrapped method that only executes on the root process.
Bamboost