perun.comm

Comm module.

Attributes

log

Classes

Comm

Wrapper around MPI COMM_WORLD. Does nothing if MPI is not initialized.

Module Contents

perun.comm.log[source]
class perun.comm.Comm[source]

Wrapper around MPI COMM_WORLD. Does nothing if MPI is not initialized.

get_mpi_version() str[source]

Get MPI version.

Returns:

Tuple with MPI version and subversion, or None if not available.

Return type:

Optional[Tuple[int, int]]

Get_rank() int[source]

Get local MPI rank.

Returns:

MPI Rank

Return type:

int

Get_size() int[source]

MPI World size.

Returns:

World Size

Return type:

int

gather(obj: Any, root: int = 0) list[Any] | None[source]

MPI gather operation.

Parameters:
  • obj (Any) – Object to be gathered.

  • root (int, optional) – Reciever rank, by default 0

Returns:

List with the gathered objects.

Return type:

list[Any] | None

allgather(obj: Any) list[Any][source]

MPI allgather operation.

Parameters:

obj (Any) – Object to be gathered.

Returns:

List with the gathered objects.

Return type:

list[Any]

bcast(obj: Any, root: int = 0) Any[source]

MPI broadcast operation.

Parameters:
  • obj (Any) – Object to be broadcasted.

  • root (int, optional) – Sender rank, by default 0

Returns:

Broadcasted object.

Return type:

Any

barrier() None[source]

MPI barrier operation.

Abort(errorcode: int) None[source]

MPI Abort operation.

gather_from_ranks(obj: Any, ranks: list[int], root: int = 0) list[Any] | None[source]

Collect python objects from specific ranks at the determined root.

Parameters:
  • obj (Any) – Object to be collected.

  • ranks (list[int]) – List of ranks that need to send the object.

  • root (int, optional) – Reciever rank, by default 0

Returns:

List with the gathered objects.

Return type:

list[Any] | None

check_available_ranks() list[int][source]

Return an array with all the ranks that are capable of responding to a single send/recv.

Returns:

List with responsive MPI ranks.

Return type:

List[int]