tbplas.MPIEnv

class tbplas.MPIEnv(echo_details: bool = False)

Wrapper over MPI4PY APIs.

_backend

C++ backend for MPI environment

Type:

‘CppBaseMPIEnv’ instance

_rank

id of this process in mpi communicator

Type:

integer

_size

number of processes in mpi communicator

Type:

integer

_is_master

whether this is the master process

Type:

bool

_is_mpi_enabled

whether mpi has been enabled during compilation

Type:

bool

__init__(echo_details: bool = False) None
Parameters:

echo_details – whether to report parallelization details

Returns:

None

Methods

__init__([echo_details])

barrier()

Put a barrier for all mpi processes.

bcast(data_local)

Broadcast data_local from master to other processes.

log([event, fmt])

Log the date and time of event.

print([text])

Print text on master process.

Attributes

is_master

Interface for the '_is_master' attribute.

mpi_enabled

Interface for the '_is_mpi_enabled' attribute.

rank

Interface for the '_rank' attribute.

size

Interface for the '_size' attribute.

__init__(echo_details: bool = False) None
Parameters:

echo_details – whether to report parallelization details

Returns:

None

barrier() None

Put a barrier for all mpi processes.

bcast(data_local: ndarray) None

Broadcast data_local from master to other processes.

NOTE: data_local should be pre-allocated before calling this function, otherwise segfault may be raised.

Parameters:

data_local – local results on each process

Returns:

None

log(event: str = '', fmt: str = '%x %X') None

Log the date and time of event. :param event: notice of the event :param fmt: date and time format :return: None.

print(text: str = '') None

Print text on master process.

NOTE: flush=True is essential for some MPI implementations, e.g. MPICH3.

Parameters:

text – text to print

Returns:

None

__weakref__

list of weak references to the object

property is_master: bool

Interface for the ‘_is_master’ attribute.

property mpi_enabled: bool

Interface for the ‘_is_mpi_enabled’ attribute.

property rank: int

Interface for the ‘_rank’ attribute.

property size: int

Interface for the ‘_size’ attribute.