TRIQS/TRIQS 4.0.0
Researching Interacting Quantum Systems
Loading...
Searching...
No Matches

Detailed Description

MPI broadcast and reduction of Green's functions.

MPI-aware operations for the Green's function containers: triqs::gfs::mpi_broadcast and triqs::gfs::mpi_reduce (with the in-place variant triqs::gfs::mpi_reduce_into), for both single and block Green's functions.

Functions

template<BlockGf BG>
void triqs::gfs::mpi_broadcast (BG &&bg, mpi::communicator c, int root)
 Implementation of an MPI broadcast for triqs::gfs::block_gf and triqs::gfs::block_gf_view types.
template<MemoryGf G>
void triqs::gfs::mpi_broadcast (G &&g, mpi::communicator c, int root)
 Implementation of an MPI broadcast for triqs::gfs::gf, triqs::gfs::gf_view or triqs::gfs::gf_const_view types.
template<BlockGf BG>
auto triqs::gfs::mpi_reduce (BG const &bg, mpi::communicator c={}, int root=0, bool all=false, MPI_Op op=MPI_SUM)
 Implementation of an MPI reduce for triqs::gfs::block_gf and triqs::gfs::block_gf_view types.
template<MemoryGf G>
auto triqs::gfs::mpi_reduce (G const &g, mpi::communicator c={}, int root=0, bool all=false, MPI_Op op=MPI_SUM)
 Implementation of an MPI reduce for triqs::gfs::gf, triqs::gfs::gf_view or triqs::gfs::gf_const_view types.
template<BlockGf BG1, BlockGf BG2>
void triqs::gfs::mpi_reduce_into (BG1 const &bg_in, BG2 &&bg_out, mpi::communicator c, int root, bool all, MPI_Op op)
 Implementation of an MPI reduce for triqs::gfs::block_gf and triqs::gfs::block_gf_view types that reduces directly into an existing block GF object.
template<MemoryGf G1, MemoryGf G2>
void triqs::gfs::mpi_reduce_into (G1 const &g_in, G2 &&g_out, mpi::communicator c, int root, bool all, MPI_Op op)
 Implementation of an MPI reduce for triqs::gfs::gf, triqs::gfs::gf_view or triqs::gfs::gf_const_view types that reduces directly into an existing GF object.

Function Documentation

◆ mpi_broadcast() [1/2]

template<BlockGf BG>
void triqs::gfs::mpi_broadcast ( BG && bg,
mpi::communicator c,
int root )

#include <triqs/gfs/block/block_gf.hpp>

Implementation of an MPI broadcast for triqs::gfs::block_gf and triqs::gfs::block_gf_view types.

It simply broadcasts the vector (of vectors) of GF objects. Furthermore,

  • for non-view block GFs, it broadcasts the vector (of vectors) of block names and
  • for views, it expects the block names to be the same on all processes.
Template Parameters
GBlock GF type.
Parameters
bgBlock GF (view) to be broadcasted from/into.
cmpi::communicator object.
rootRank of the root process.

Definition at line 79 of file mpi.hpp.

◆ mpi_broadcast() [2/2]

template<MemoryGf G>
void triqs::gfs::mpi_broadcast ( G && g,
mpi::communicator c,
int root )

#include <triqs/gfs/gf/gf.hpp>

Implementation of an MPI broadcast for triqs::gfs::gf, triqs::gfs::gf_view or triqs::gfs::gf_const_view types.

It simply broadcasts the data of the GF, i.e. the nda array/view object. Furthermore,

  • for non-view GFs, it also broadcasts the mesh and
  • for views, it expects the mesh to be the same on all processes.
Template Parameters
Gtriqs::gfs::MemoryGf type.
Parameters
gGF (view) to be broadcasted from/into.
cmpi::communicator object.
rootRank of the root process.

Definition at line 53 of file mpi.hpp.

◆ mpi_reduce() [1/2]

template<BlockGf BG>
auto triqs::gfs::mpi_reduce ( BG const & bg,
mpi::communicator c = {},
int root = 0,
bool all = false,
MPI_Op op = MPI_SUM )

#include <triqs/gfs/block/mpi.hpp>

Implementation of an MPI reduce for triqs::gfs::block_gf and triqs::gfs::block_gf_view types.

The function reduces input block GFs (views) from all processes in the given communicator and makes the result available on the root process (all == false) or on all processes (all == true).

It calls triqs::gfs::mpi_reduce_into with the input block GF and a default constructed block GF object.

The content of the returned block GF depends on the MPI rank and whether it receives the data or not:

  • On receiving ranks, it contains the reduced GF objects and the same block names as the input block GF.
  • On non-receiving ranks, a default constructed block GF is returned.
Template Parameters
BGBlock GF type.
Parameters
bgBlock GF (view) to be reduced (into).
cmpi::communicator object.
rootRank of the root process.
allShould all processes receive the result of the reduction.
opMPI reduction operation.
Returns
A triqs::gfs::block_gf object with the reduced data.

Definition at line 166 of file mpi.hpp.

◆ mpi_reduce() [2/2]

template<MemoryGf G>
auto triqs::gfs::mpi_reduce ( G const & g,
mpi::communicator c = {},
int root = 0,
bool all = false,
MPI_Op op = MPI_SUM )

#include <triqs/gfs/gf/mpi.hpp>

Implementation of an MPI reduce for triqs::gfs::gf, triqs::gfs::gf_view or triqs::gfs::gf_const_view types.

The function reduces input GF (views) from all processes in the given communicator and makes the result available on the root process (all == false) or on all processes (all == true).

It calls triqs::gfs::mpi_reduce_into with the input GF (view) and a default constructed GF object.

The content of the returned GF depends on the MPI rank and whether it receives the data or not:

  • On receiving ranks, it contains the reduced data and the same mesh as the input GF.
  • On non-receiving ranks, a default constructed GF is returned.
Template Parameters
Gtriqs::gfs::MemoryGf type.
Parameters
gGF (view) to be reduced.
cmpi::communicator object.
rootRank of the root process.
allShould all processes receive the result of the reduction.
opMPI reduction operation.
Returns
A triqs::gfs::gf object with the reduced data.

Definition at line 138 of file mpi.hpp.

◆ mpi_reduce_into() [1/2]

template<BlockGf BG1, BlockGf BG2>
void triqs::gfs::mpi_reduce_into ( BG1 const & bg_in,
BG2 && bg_out,
mpi::communicator c,
int root,
bool all,
MPI_Op op )

#include <triqs/gfs/block/block_gf.hpp>

Implementation of an MPI reduce for triqs::gfs::block_gf and triqs::gfs::block_gf_view types that reduces directly into an existing block GF object.

The function reduces input block GFs (views) from all processes in the given communicator and makes the result available on the root process (all == false) or on all processes (all == true).

It throws an exception if the input block GFs on all processes and the output block GF views on receiving processes do not have the same shape. Furthermore, the block names of the input block GFs on all processes and of output block GF views on receiving processes are expected to be the same.

The content of the output block GF depends on the MPI rank and whether it receives the data or not:

  • On receiving ranks, it contains the reduced GF objects obtained by calling mpi::reduce_into directly on the vector (of vectors) of GFs and the same block names as the input block GF (the block names are assigned for non-views but for views, it is expected that they already have the correct block names).
  • On non-receiving ranks, the output block GF is ignored and left unchanged.
Template Parameters
BG1Block GF type.
BG2Block GF type.
Parameters
bg_inBlock GF (view) to be reduced.
bg_outBlock GF (view) to be reduced into.
cmpi::communicator object.
rootRank of the root process.
allShould all processes receive the result of the reduction.
opMPI reduction operation.

Definition at line 124 of file mpi.hpp.

◆ mpi_reduce_into() [2/2]

template<MemoryGf G1, MemoryGf G2>
void triqs::gfs::mpi_reduce_into ( G1 const & g_in,
G2 && g_out,
mpi::communicator c,
int root,
bool all,
MPI_Op op )

#include <triqs/gfs/gf/gf.hpp>

Implementation of an MPI reduce for triqs::gfs::gf, triqs::gfs::gf_view or triqs::gfs::gf_const_view types that reduces directly into an existing GF object.

The function reduces input GFs (views) from all processes in the given communicator and makes the result available on the root process (all == false) or on all processes (all == true).

Input GFs on all processes and output GF views on receiving processes are expected to have the same mesh.

The content of the output GF depends on the MPI rank and whether it receives the data or not:

  • On receiving ranks, it contains the reduced data obtained from calling mpi::reduce_into and the same mesh as the input GF (the mesh is assigned for non-views but for views, it is expected that it already has the correct mesh).
  • On non-receiving ranks, the output GF is ignored and left unchanged.

The reduction of the data is performed in place if the input and output GFs point to the same memory location.

Template Parameters
G1triqs::gfs::MemoryGf type.
G2triqs::gfs::MemoryGf type.
Parameters
g_inGF (view) to be reduced.
g_outGF (view) to be reduced into.
cmpi::communicator object.
rootRank of the root process.
allShould all processes receive the result of the reduction.
opMPI reduction operation.

Definition at line 98 of file mpi.hpp.