triqs.utility.mpi_mpi4py

mpi4py-backed implementation of the TRIQS MPI interface.

This module is selected at runtime by triqs.utility.mpi when an MPI launcher is detected. It exposes a thin, TRIQS-specific wrapper around the mpi4py API plus a few utility functions for slicing arrays per rank and printing only on the master.

A parallel serial stub with the same public surface lives in triqs.utility.mpi_nompi.

Attributes

worldmpi4py.MPI.Comm

The default communicator (MPI.COMM_WORLD).

rankint

Rank of the current process inside world.

sizeint

Total number of processes in world.

masterint

Rank of the master process. Always 0.

All_Nodes_reportbool

When True, report() writes one file per non-master rank (report_node<rank>) instead of dropping their output. Default False.

Verbosity_Level_Report_Maxint

Upper bound on the Verbosity_Level keyword accepted by report(); messages above this threshold are suppressed. Default 1.

Functions

all_reduce(x[, comm, op])

Reduce x across all ranks of comm and return the result.

barrier([poll_msec])

Synchronisation barrier that yields the CPU while waiting.

bcast(x[, root])

Broadcast a Python object from one rank to all ranks.

is_master_node()

Return True on the master rank (rank == master).

master_gets_host_names()

Collect the hostnames of every rank on the master.

myprint_err(x)

Write x followed by a newline to sys.stderr.

myprint_out(x)

Write x followed by a newline to sys.stdout.

recv([source])

Receive a Python object from another rank.

report(*x, **opt)

Print to stdout (or stderr) on the master rank only.

send(val, dest)

Send a Python object to another rank.

slice_array(A)

Return the local view of A along its first dimension.

slice_inf(imin, imax)

Lower index of the local slice of the integer range [imin, imax].

slice_sup(imin, imax)

Upper (inclusive) index of the local slice of [imin, imax].