sisl.mpi.BaseCommunicator

class sisl.mpi.BaseCommunicator[source]

Bases: ABC

The communicator contract sisl relies on.

Only what cannot be delegated appears here: which rank this is, how many there are, and who owns MPI. Every actual operation – collectives, point-to-point, communicator management – is reached through __getattr__ on the implementations, so this contract does not have to track mpi4py’s surface.

Two classes implement it: Communicator, wrapping a real mpi4py communicator, and the serial stand-in used when there is no MPI.

Methods

on_rank0()

True on the rank that should perform single-writer work (IO, printing).

Attributes

comm

The underlying communicator object.

is_parallel

owns_mpi

Whether sisl initialized MPI, and must therefore finalize it.

rank

Index of this rank within the communicator.

size

Number of ranks in the communicator.

on_rank0()[source]

True on the rank that should perform single-writer work (IO, printing).

Return type:

bool

abstract property comm

The underlying communicator object.

property is_parallel: bool
abstract property owns_mpi: bool

Whether sisl initialized MPI, and must therefore finalize it.

abstract property rank: int

Index of this rank within the communicator.

abstract property size: int

Number of ranks in the communicator.