Boost C++ 库

...世界上最受尊敬、设计最精良的 C++ 库项目之一。 Herb SutterAndrei AlexandrescuC++ Coding Standards

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

函数 gather

boost::mpi::gather — 将每个进程存储的值收集到根进程的 vector 中。

提要

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


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

描述

gather 是一种集体算法,它将每个进程中存储的值收集到 root 进程的一个值 vector 中。这个 vector 按值来自的进程编号进行索引。值的类型 T 可以是任何可序列化类型,或者具有相关的 MPI 数据类型。

当类型 T 具有相关的 MPI 数据类型时,此例程将调用 MPI_Gather 来收集值。

参数

comm

将发生收集操作的通信器。

in_value

由每个进程传输的值。对于收集值数组,in_values 指向大小为 n*comm.size() 的存储空间。

out_values

一个 vector 或指向存储空间的指针,该空间将用每个进程的值填充,并按进程 ID 编号索引。如果它是一个 vector,它将相应地调整大小。对于非根进程,可以省略此参数。但是,如果仍然提供,它将保持不变。

将收集值的进程 ID 编号。此值在所有进程上必须相同。


PrevUpHomeNext