Boost C++ 库

...世界上备受推崇、设计精良的 C++ 库项目之一。 Herb SutterAndrei Alexandrescu, C++ 编码规范

函数 all_gather - Boost C++ 函数库
PrevUpHomeNext

函数 all_gather

boost::mpi::all_gather — 收集每个进程存储的值,并将它们放入一个包含来自每个进程的值的向量中。

提要

// In header: <boost/mpi/collectives.hpp>


template<typename T> 
  void all_gather(const communicator & comm, const T & in_value, 
                  std::vector< T > & out_values);
template<typename T> 
  void all_gather(const communicator & comm, const T & in_value, 
                  T * out_values);
template<typename T> 
  void all_gather(const communicator & comm, const T * in_values, int n, 
                  std::vector< T > & out_values);
template<typename T> 
  void all_gather(const communicator & comm, const T * in_values, int n, 
                  T * out_values);

描述

all_gather 是一种集体算法,它将每个进程存储的值收集到一个向量中,该向量的索引是值来自的进程号。值 T 的类型可以是任何可序列化的类型,或者具有关联的 MPI 数据类型。

当类型 T 具有关联的 MPI 数据类型时,此例程调用 MPI_Allgather 来收集这些值。

参数

comm

将发生全收集的通信器。

in_value

由每个进程传输的值。为了收集一个值数组,in_values 指向要传输的 n 个本地值。

out_values

一个向量或指向存储的指针,它将填充来自每个进程的值,并按进程 ID 号进行索引。如果它是一个向量,则向量将相应地调整大小。


PrevUpHomeNext