Boost C++ 库

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

PrevUpHomeNext

参考

头文件 <boost/mpi.hpp>
头文件 <boost/mpi/allocator.hpp>
头文件 <boost/mpi/cartesian_communicator.hpp>
头文件 <boost/mpi/collectives.hpp>
头文件 <boost/mpi/collectives_fwd.hpp>
头文件 <boost/mpi/communicator.hpp>
头文件 <boost/mpi/config.hpp>
头文件 <boost/mpi/datatype.hpp>
头文件 <boost/mpi/datatype_fwd.hpp>
头文件 <boost/mpi/environment.hpp>
头文件 <boost/mpi/exception.hpp>
头文件 <boost/mpi/graph_communicator.hpp>
头文件 <boost/mpi/group.hpp>
头文件 <boost/mpi/inplace.hpp>
头文件 <boost/mpi/intercommunicator.hpp>
头文件 <boost/mpi/nonblocking.hpp>
头文件 <boost/mpi/operations.hpp>
头文件 <boost/mpi/packed_iarchive.hpp>
头文件 <boost/mpi/packed_oarchive.hpp>
头文件 <boost/mpi/python.hpp>
头文件 <boost/mpi/request.hpp>
头文件 <boost/mpi/skeleton_and_content.hpp>
头文件 <boost/mpi/skeleton_and_content_fwd.hpp>
头文件 <boost/mpi/status.hpp>
头文件 <boost/mpi/timer.hpp>

头文件 <boost/mpi.hpp>

该文件是一个顶层便利头文件,包含了所有 Boost.MPI 库的头文件。关注编译时间的用户可能希望仅包含来自 Boost.MPI 库的特定头文件。

此头文件提供了一个符合 STL 标准的分配器,该分配器使用 MPI-2 内存分配工具。

namespace boost {
  namespace mpi {
    template<typename T> class allocator;

    template<> class allocator<void>;
    template<typename T1, typename T2> 
      bool operator==(const allocator< T1 > &, const allocator< T2 > &);
    template<typename T1, typename T2> 
      bool operator!=(const allocator< T1 > &, const allocator< T2 > &);
  }
}

此头文件定义了支持具有笛卡尔拓扑的 MPI 通信器的工具。如果在编译时已知,则可以通过模板化的通信器类静态强制执行隐含网格的维度。否则,将提供非模板、动态的基类。

namespace boost {
  namespace mpi {
    class cartesian_communicator;

    struct cartesian_dimension;

    class cartesian_topology;

    template<> struct is_mpi_datatype<cartesian_dimension>;

    // Test if the dimensions values are identical. 
    bool operator==(cartesian_dimension const & d1, 
                    cartesian_dimension const & d2);

    // Test if the dimension values are different. 
    bool operator!=(cartesian_dimension const & d1, 
                    cartesian_dimension const & d2);

    // Pretty printing of a cartesian dimension (size, periodic) 
    std::ostream & 
    operator<<(std::ostream & out, cartesian_dimension const & d);
    bool operator==(cartesian_topology const & t1, 
                    cartesian_topology const & t2);
    bool operator!=(cartesian_topology const & t1, 
                    cartesian_topology const & t2);

    // Pretty printing of a cartesian topology. 
    std::ostream & 
    operator<<(std::ostream & out, cartesian_topology const & t);
    std::vector< int > & cartesian_dimensions(int, std::vector< int > &);
  }
}

此头文件包含 MPI 集合操作,这些操作实现了各种并行算法,这些算法需要通信器内所有进程的协调。头文件 collectives_fwd.hpp 为每个操作提供了前向声明。要仅包含特定的集合算法,请使用头文件 boost/mpi/collectives/algorithm_name.hpp

namespace boost {
  namespace mpi {
    template<typename T> 
      void all_gather(const communicator &, const T &, std::vector< T > &);
    template<typename T> void all_gather(const communicator &, const T &, T *);
    template<typename T> 
      void all_gather(const communicator &, const T *, int, 
                      std::vector< T > &);
    template<typename T> 
      void all_gather(const communicator &, const T *, int, T *);
    template<typename T, typename Op> 
      void all_reduce(const communicator &, const T *, int, T *, Op);
    template<typename T, typename Op> 
      void all_reduce(const communicator &, const T &, T &, Op);
    template<typename T, typename Op> 
      T all_reduce(const communicator &, const T &, Op);
    template<typename T, typename Op> 
      void all_reduce(const communicator &, inplace_t< T * >, int, Op);
    template<typename T, typename Op> 
      void all_reduce(const communicator &, inplace_t< T >, Op);
    template<typename T> 
      void all_to_all(const communicator &, const std::vector< T > &, 
                      std::vector< T > &);
    template<typename T> void all_to_all(const communicator &, const T *, T *);
    template<typename T> 
      void all_to_all(const communicator &, const std::vector< T > &, int, 
                      std::vector< T > &);
    template<typename T> 
      void all_to_all(const communicator &, const T *, int, T *);
    template<typename T> void broadcast(const communicator &, T &, int);
    template<typename T> void broadcast(const communicator &, T *, int, int);
    template<typename T> 
      void broadcast(const communicator &, skeleton_proxy< T > &, int);
    template<typename T> 
      void broadcast(const communicator &, const skeleton_proxy< T > &, int);
    template<typename T> 
      void gather(const communicator &, const T &, std::vector< T > &, int);
    template<typename T> 
      void gather(const communicator &, const T &, T *, int);
    template<typename T> void gather(const communicator &, const T &, int);
    template<typename T> 
      void gather(const communicator &, const T *, int, std::vector< T > &, 
                  int);
    template<typename T> 
      void gather(const communicator &, const T *, int, T *, int);
    template<typename T> 
      void gather(const communicator &, const T *, int, int);
    template<typename T> 
      void gatherv(const communicator &, const std::vector< T > &, T *, 
                   const std::vector< int > &, const std::vector< int > &, 
                   int);
    template<typename T> 
      void gatherv(const communicator &, const T *, int, T *, 
                   const std::vector< int > &, const std::vector< int > &, 
                   int);
    template<typename T> 
      void gatherv(const communicator &, const std::vector< T > &, int);
    template<typename T> 
      void gatherv(const communicator &, const T *, int, int);
    template<typename T> 
      void gatherv(const communicator &, const T *, int, T *, 
                   const std::vector< int > &, int);
    template<typename T> 
      void gatherv(const communicator &, const std::vector< T > &, T *, 
                   const std::vector< int > &, int);
    template<typename T> 
      void scatter(const communicator &, const std::vector< T > &, T &, int);
    template<typename T> 
      void scatter(const communicator &, const T *, T &, int);
    template<typename T> void scatter(const communicator &, T &, int);
    template<typename T> 
      void scatter(const communicator &, const std::vector< T > &, T *, int, 
                   int);
    template<typename T> 
      void scatter(const communicator &, const T *, T *, int, int);
    template<typename T> void scatter(const communicator &, T *, int, int);
    template<typename T> 
      void scatterv(const communicator &, const std::vector< T > &, 
                    const std::vector< int > &, const std::vector< int > &, 
                    T *, int, int);
    template<typename T> 
      void scatterv(const communicator &, const T *, 
                    const std::vector< int > &, const std::vector< int > &, 
                    T *, int, int);
    template<typename T> void scatterv(const communicator &, T *, int, int);
    template<typename T> 
      void scatterv(const communicator &, const T *, 
                    const std::vector< int > &, T *, int);
    template<typename T> 
      void scatterv(const communicator &, const std::vector< T > &, 
                    const std::vector< int > &, T *, int);
    template<typename T, typename Op> 
      void reduce(const communicator &, const T &, T &, Op, int);
    template<typename T, typename Op> 
      void reduce(const communicator &, const T &, Op, int);
    template<typename T, typename Op> 
      void reduce(const communicator &, const T *, int, T *, Op, int);
    template<typename T, typename Op> 
      void reduce(const communicator &, const T *, int, Op, int);
    template<typename T, typename Op> 
      void scan(const communicator &, const T &, T &, Op);
    template<typename T, typename Op> 
      T scan(const communicator &, const T &, Op);
    template<typename T, typename Op> 
      void scan(const communicator &, const T *, int, T *, Op);
  }
}

此头文件为头文件 collectives.hpp 中包含的所有集合操作提供了前向声明。

此头文件定义了 communicator 类,它是 Boost.MPI 中所有通信的基础,并提供点对点通信操作。

namespace boost {
  namespace mpi {
    class communicator;

    enum comm_create_kind;

    const int any_source;    // A constant representing "any process.". 
    const int any_tag;    // A constant representing "any tag.". 
    BOOST_MPI_DECL bool operator==(const communicator &, const communicator &);
    bool operator!=(const communicator &, const communicator &);
  }
}

此头文件提供 MPI 配置详细信息,这些信息公开了底层 MPI 实现的功能,并在 Windows 上提供自动链接支持。

MPICH_IGNORE_CXX_SEEK
OMPI_SKIP_MPICXX
BOOST_MPI_HOMOGENEOUS
BOOST_MPI_VERSION
BOOST_MPI_SUBVERSION
BOOST_MPI_CALLING_CONVENTION
BOOST_MPI_BCAST_BOTTOM_WORKS_FINE
BOOST_MPI_DECL

此头文件提供了从 C++ 类型到 MPI 数据类型的映射。

BOOST_IS_MPI_DATATYPE(T)
namespace boost {
  namespace mpi {
    template<typename T> struct is_mpi_builtin_datatype;
    template<typename T> struct is_mpi_byte_datatype;
    template<typename T> struct is_mpi_complex_datatype;
    template<typename T> struct is_mpi_datatype;
    template<typename T> struct is_mpi_floating_point_datatype;
    template<typename T> struct is_mpi_integer_datatype;
    template<typename T> struct is_mpi_logical_datatype;
    template<typename T> MPI_Datatype get_mpi_datatype(const T &);
  }
}

此头文件为头文件 datatype.hpp 的内容提供了前向声明。它主要供需要专门化 is_mpi_datatype 的用户定义的 C++ 类使用。

namespace boost {
  namespace mpi {
    struct packed;
    template<typename T> MPI_Datatype get_mpi_datatype();
  }
}

此头文件提供了 environment 类,该类提供了初始化、终结和查询 Boost MPI 环境状态的例程。

namespace boost {
  namespace mpi {
    class environment;
    namespace threading {
      enum level;
      std::ostream & operator<<(std::ostream &, level);
      std::istream & operator>>(std::istream &, level &);
    }
  }
}

此头文件提供了异常类,这些异常类向用户报告 MPI 错误,以及将 MPI 错误代码转换为 Boost.MPI 异常的宏。

BOOST_MPI_CHECK_RESULT(MPIFunc, Args)
namespace boost {
  namespace mpi {
    class exception;
  }
}

此头文件定义了支持具有图形拓扑的 MPI 通信器的工具,使用 Boost 图形库定义的图形接口。可以构造一个通信器,其拓扑由满足 Boost 图形库图形概念要求的任何图形描述。同样,任何具有图形拓扑的通信器都可以被 Boost 图形库视为图形,从而允许在进程拓扑上使用 BGL 的图形算法。

namespace boost {
  template<> struct graph_traits<mpi::graph_communicator>;
  namespace mpi {
    class graph_communicator;

    // Returns the source vertex from an edge in the graph topology of a communicator. 
    int source(const std::pair< int, int > & edge, const graph_communicator &);

    // Returns the target vertex from an edge in the graph topology of a communicator. 
    int target(const std::pair< int, int > & edge, const graph_communicator &);

    // Returns an iterator range containing all of the edges outgoing from the given vertex in a graph topology of a communicator. 
    unspecified out_edges(int vertex, const graph_communicator & comm);

    // Returns the out-degree of a vertex in the graph topology of a communicator. 
    int out_degree(int vertex, const graph_communicator & comm);

    // Returns an iterator range containing all of the neighbors of the given vertex in the communicator's graph topology. 
    unspecified adjacent_vertices(int vertex, const graph_communicator & comm);

    // Returns an iterator range that contains all of the vertices with the communicator's graph topology, i.e., all of the process ranks in the communicator. 
    std::pair< counting_iterator< int >, counting_iterator< int > > 
    vertices(const graph_communicator & comm);

    // Returns the number of vertices within the graph topology of the communicator, i.e., the number of processes in the communicator. 
    int num_vertices(const graph_communicator & comm);

    // Returns an iterator range that contains all of the edges with the communicator's graph topology. 
    unspecified edges(const graph_communicator & comm);

    // Returns the number of edges in the communicator's graph topology. 
    int num_edges(const graph_communicator & comm);
    identity_property_map get(vertex_index_t, const graph_communicator &);
    int get(vertex_index_t, const graph_communicator &, int);
  }
}

头文件 <boost/mpi/group.hpp>

此头文件定义了 group 类,该类允许用户操作和查询进程组。

namespace boost {
  namespace mpi {
    class group;
    BOOST_MPI_DECL bool operator==(const group &, const group &);
    bool operator!=(const group &, const group &);
    BOOST_MPI_DECL group operator|(const group &, const group &);
    BOOST_MPI_DECL group operator&(const group &, const group &);
    BOOST_MPI_DECL group operator-(const group &, const group &);
  }
}

此头文件提供了帮助程序,以指示 MPI 集合操作,缓冲区可以用作输入和输出。

namespace boost {
  namespace mpi {
    template<typename T> struct inplace_t;

    template<typename T> struct inplace_t<T *>;
    template<typename T> inplace_t< T > inplace(T &);
    template<typename T> inplace_t< T * > inplace(T *);
  }
}

此头文件定义了 intercommunicator 类,该类允许不同进程组之间进行通信。

namespace boost {
  namespace mpi {
    class intercommunicator;
  }
}

此头文件定义了用于完成非阻塞通信请求的操作。

namespace boost {
  namespace mpi {
    template<typename ForwardIterator> 
      std::pair< status, ForwardIterator > 
      wait_any(ForwardIterator, ForwardIterator);
    template<typename ForwardIterator> 
      optional< std::pair< status, ForwardIterator > > 
      test_any(ForwardIterator, ForwardIterator);
    template<typename ForwardIterator, typename OutputIterator> 
      OutputIterator 
      wait_all(ForwardIterator, ForwardIterator, OutputIterator);
    template<typename ForwardIterator> 
      void wait_all(ForwardIterator, ForwardIterator);
    template<typename ForwardIterator, typename OutputIterator> 
      optional< OutputIterator > 
      test_all(ForwardIterator, ForwardIterator, OutputIterator);
    template<typename ForwardIterator> 
      bool test_all(ForwardIterator, ForwardIterator);
    template<typename BidirectionalIterator, typename OutputIterator> 
      std::pair< OutputIterator, BidirectionalIterator > 
      wait_some(BidirectionalIterator, BidirectionalIterator, OutputIterator);
    template<typename BidirectionalIterator> 
      BidirectionalIterator 
      wait_some(BidirectionalIterator, BidirectionalIterator);
    template<typename BidirectionalIterator, typename OutputIterator> 
      std::pair< OutputIterator, BidirectionalIterator > 
      test_some(BidirectionalIterator, BidirectionalIterator, OutputIterator);
    template<typename BidirectionalIterator> 
      BidirectionalIterator 
      test_some(BidirectionalIterator, BidirectionalIterator);
  }
}

此头文件提供了从函数对象到 MPI 集合操作中使用的 MPI_Op 常量的映射。它还提供了标准 <functional> 头文件中不存在的几种新函数对象类型,这些类型直接映射到 MPI_Op

namespace boost {
  namespace mpi {
    template<typename T> struct bitwise_and;
    template<typename T> struct bitwise_or;
    template<typename T> struct bitwise_xor;
    template<typename Op, typename T> struct is_commutative;
    template<typename Op, typename T> struct is_mpi_op;
    template<typename T> struct logical_xor;
    template<typename T> struct maximum;
    template<typename T> struct minimum;
  }
}

此头文件提供了使用 MPI_Pack 将可序列化数据类型打包到缓冲区中的工具。然后,可以通过 MPI 传输缓冲区,然后通过 packed_oarchive.hppMPI_Unpack 中的工具解包。

namespace boost {
  namespace mpi {
    class packed_iarchive;

    typedef packed_iprimitive iprimitive;
  }
}

此头文件提供了使用 MPI_Unpack 从缓冲区解包可序列化数据类型的工具。缓冲区通常通过 MPI 接收,并且已通过 packed_iarchive.hppMPI_Pack 中的工具打包。

namespace boost {
  namespace mpi {
    class packed_oarchive;

    typedef packed_oprimitive oprimitive;
  }
}

此头文件与 Boost.MPI 的 Python 绑定交互。此头文件中的例程可用于向 Boost.MPI 注册用户定义和库定义的数据类型,以实现高效的(反)序列化以及骨架和内容的分离传输。

namespace boost {
  namespace mpi {
    namespace python {
      template<typename T> 
        void register_serialized(const T & = T(), PyTypeObject * = 0);
      template<typename T> 
        void register_skeleton_and_content(const T & = T(), 
                                           PyTypeObject * = 0);
    }
  }
}

此头文件定义了类 request,其中包含非阻塞通信的请求。

namespace boost {
  namespace mpi {
    class request;
  }
}

此头文件提供了允许数据类型结构(称为“骨架”)与存储在这些数据类型中的内容分开传输和接收的工具。当稳定数据结构(例如,网格或图形)中的数据需要重复传输时,这些工具很有用。在这种情况下,仅传输骨架一次即可节省通信工作(无需再次发送)和本地计算(只需对内容执行一次序列化)。

此头文件包含使用单独传输数据结构骨架和数据结构内容所需的所有前向声明。要实际传输骨架或内容,请包含头文件 boost/mpi/skeleton_and_content.hpp

namespace boost {
  namespace mpi {
    template<typename T> struct skeleton_proxy;
    template<typename T> const skeleton_proxy< T > skeleton(T & x);
    template<typename T> const content get_content(const T & x);
  }
}

此头文件定义了类 status,它报告点对点通信的结果。

namespace boost {
  namespace mpi {
    class status;
  }
}

头文件 <boost/mpi/timer.hpp>

此头文件提供了 timer 类,该类提供对 MPI 定时器的访问。

namespace boost {
  namespace mpi {
    class timer;
  }
}

PrevUpHomeNext