mpi::mpi_reduce

#include <mpi.hpp>

Synopsis

  1. template<typename T>
    T mpi_reduce (T const & x, communicator c = {}, int root = 0, bool all = false, MPI_Op op = MPI_SUM)
  2. template<typename T>
    std::vector<regular_t<T>> mpi_reduce (std::vector<T> const & v,
    communicator c = {},
    int root = 0,
    bool all = false,
    MPI_Op op = MPI_SUM)

Documentation

Template parameters

  • T Type to be reduced.

Parameters

  • x Object to be reduced.

  • c mpi::communicator.

  • root Rank of the root process.

  • all Should all processes receive the result of the reduction.

  • op MPI_Op used in the reduction.

  • v std::vector to reduce.

Returns

The result of the reduction.