Boost C++ 库

...世界上最受尊敬和设计最精良的C++库项目之一。 Herb SutterAndrei Alexandrescu, C++ 编码标准

PrevUpHomeNext

函数 gather

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

概要

// 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 进程的一个值向量中。 此向量通过值来自的进程号来索引。 值的类型 T 可以是任何可序列化类型或具有关联的 MPI 数据类型的类型。

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

参数

comm

gather 操作将在其上发生的通信器。

in_value

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

out_values

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

root

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


PrevUpHomeNext