sisl.mpi.Distribution
- class sisl.mpi.Distribution
Bases:
ABCMaps
nindices onto the ranks ofcomm.Deliberately agnostic about what is being distributed. Calling a distribution on an object forwards to the object’s
__sisl_distribute__method, which decides what distributing it means:dist(obj, *args, **kwargs) # is obj.__sisl_distribute__(dist, *args, **kwargs)
The communicator is held by the distribution. It defaults to the one
sisl.mpi.get_commhands out, so basic distributions need no communicator, but any communicator may be passed – e.g. a sub-communicator created by splitting the world communicator. The number of ranks, and the default rank queried by the methods, follow from it.Subclasses supply
rangeandowner.rangereturns every contiguous run a rank owns, as(start, stop)pairs – one run for a chunked scheme, several for a cyclic one – andindices,countandcountsall follow from it.- Parameters:
n – number of indices to distribute
comm – communicator the indices are distributed across. Anything with
rankandsizeattributes works;Nonemeanssisl.mpi.get_comm.
Methods
count([rank])Number of indices owned by
rank(default this process).indices([rank])The indices owned by
rank(default this process), ascending.owner(indices)The rank owning each of
indices.range([rank])The contiguous runs owned by
rank, as ascending(start, stop)pairs.Attributes
The communicator the indices are distributed across.
Number of indices owned by each rank.
Total number of indices across all ranks.
The rank of this process in
comm.Number of ranks this is distributed across.
- __call__(obj, *args, **kwargs)[source]
Distribute obj, by calling
obj.__sisl_distribute__(self, *args, **kwargs).
- abstractmethod range(rank=None)[source]
The contiguous runs owned by
rank, as ascending(start, stop)pairs.A rank owning nothing gets an empty tuple. Runs are the primitive rather than a flat index array because they slice: a consumer can copy each run directly instead of gathering scattered elements.
- property comm
The communicator the indices are distributed across.