Boost C++ 库

……这是世界上备受推崇且设计精湛的 C++ 库项目之一。 Herb SutterAndrei AlexandrescuC++ Coding Standards

gather 函数 - Boost 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 号进行索引。如果它是向量,它将被相应地调整大小。对于非根进程,可以省略此参数。但是,如果仍然提供了此参数,它将不会被更改。

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


PrevUpHomeNext