mpi_bsp_process_group.rst 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. .. Copyright (C) 2004-2009 The Trustees of Indiana University.
  2. Use, modification and distribution is subject to the Boost Software
  3. License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. http://www.boost.org/LICENSE_1_0.txt)
  5. ============================
  6. |Logo| MPI BSP Process Group
  7. ============================
  8. .. contents::
  9. Introduction
  10. ------------
  11. The MPI ``mpi_process_group`` is an implementation of the `process
  12. group`_ interface using the Message Passing Interface (MPI). It is the
  13. primary process group used in the Parallel BGL at this time.
  14. Where Defined
  15. -------------
  16. Header ``<boost/graph/distributed/mpi_process_group.hpp>``
  17. Reference
  18. ---------
  19. ::
  20. namespace boost { namespace graph { namespace distributed {
  21. class mpi_process_group
  22. {
  23. public:
  24. typedef boost::mpi::communicator communicator_type;
  25. // Process group constructors
  26. mpi_process_group(communicator_type comm = communicator_type());
  27. mpi_process_group(std::size_t num_headers, std::size_t buffer_size,
  28. communicator_type comm = communicator_type());
  29. mpi_process_group();
  30. mpi_process_group(const mpi_process_group&, boost::parallel::attach_distributed_object);
  31. // Triggers
  32. template<typename Type, typename Handler>
  33. void trigger(int tag, const Handler& handler);
  34. template<typename Type, typename Handler>
  35. void trigger_with_reply(int tag, const Handler& handler);
  36. trigger_receive_context trigger_context() const;
  37. // Helper operations
  38. void poll();
  39. mpi_process_group base() const;
  40. };
  41. // Process query
  42. int process_id(const mpi_process_group&);
  43. int num_processes(const mpi_process_group&);
  44. // Message transmission
  45. template<typename T>
  46. void send(const mpi_process_group& pg, int dest, int tag, const T& value);
  47. template<typename T>
  48. void receive(const mpi_process_group& pg, int source, int tag, T& value);
  49. optional<std::pair<int, int> > probe(const mpi_process_group& pg);
  50. // Synchronization
  51. void synchronize(const mpi_process_group& pg);
  52. // Out-of-band communication
  53. template<typename T>
  54. void send_oob(const mpi_process_group& pg, int dest, int tag, const T& value);
  55. template<typename T, typename U>
  56. void
  57. send_oob_with_reply(const mpi_process_group& pg, int dest, int
  58. tag, const T& send_value, U& receive_value);
  59. template<typename T>
  60. void receive_oob(const mpi_process_group& pg, int source, int tag, T& value);
  61. } } }
  62. Since the ``mpi_process_group`` is an implementation of the `process
  63. group`_ interface, we omit the description of most of the functions in
  64. the prototype. Two constructors need special mentioning:
  65. ::
  66. mpi_process_group(communicator_type comm = communicator_type());
  67. The constructor can take an optional MPI communicator. As default a communicator
  68. constructed from MPI_COMM_WORLD is used.
  69. ::
  70. mpi_process_group(std::size_t num_headers, std::size_t buffer_size,
  71. communicator_type comm = communicator_type());
  72. For performance fine tuning the maximum number of headers in a message batch
  73. (num_headers) and the maximum combined size of batched messages (buffer_size)
  74. can be specified. The maximum message size of a batch is
  75. 16*num_headers+buffer_size. Sensible default values have been found by optimizing
  76. a typical application on a cluster with Ethernet network, and are num_header=64k
  77. and buffer_size=1MB, for a total maximum batches message size of 2MB.
  78. -----------------------------------------------------------------------------
  79. Copyright (C) 2007 Douglas Gregor
  80. Copyright (C) 2007 Matthias Troyer
  81. .. |Logo| image:: pbgl-logo.png
  82. :align: middle
  83. :alt: Parallel BGL
  84. :target: http://www.osl.iu.edu/research/pbgl
  85. .. _process group: process_group.html