summaryrefslogtreecommitdiff
path: root/doc/html/boost/mpi/group.html
blob: 7adc41d7e2a6c3ccd6e486b07dd6d16da64adab8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class group</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../mpi/reference.html#header.boost.mpi.group_hpp" title="Header &lt;boost/mpi/group.hpp&gt;">
<link rel="prev" href="../graph_traits__idp151451520.html" title="Struct graph_traits&lt;mpi::graph_communicator&gt;">
<link rel="next" href="operator___idp224063376.html" title="Function operator==">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../graph_traits__idp151451520.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mpi/reference.html#header.boost.mpi.group_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator___idp224063376.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="boost.mpi.group"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class group</span></h2>
<p>boost::mpi::group &#8212; A <code class="computeroutput">group</code> is a representation of a subset of the processes within a <code class="computeroutput">communicator</code>. </p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../mpi/reference.html#header.boost.mpi.group_hpp" title="Header &lt;boost/mpi/group.hpp&gt;">boost/mpi/group.hpp</a>&gt;

</span>
<span class="keyword">class</span> <a class="link" href="group.html" title="Class group">group</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// <a class="link" href="group.html#boost.mpi.groupconstruct-copy-destruct">construct/copy/destruct</a></span>
  <a class="link" href="group.html#idp35547680-bb"><span class="identifier">group</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="group.html#idp35548272-bb"><span class="identifier">group</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MPI_Group</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">bool</span><span class="special">)</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="group.html#idp142344496-bb">public member functions</a></span>
  <span class="identifier">optional</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <a class="link" href="group.html#idp142345056-bb"><span class="identifier">rank</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">int</span> <a class="link" href="group.html#idp142348240-bb"><span class="identifier">size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">,</span> <span class="keyword">typename</span> OutputIterator<span class="special">&gt;</span> 
    <span class="identifier">OutputIterator</span> 
    <a class="link" href="group.html#idp144023936-bb"><span class="identifier">translate_ranks</span></a><span class="special">(</span><span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">InputIterator</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="group.html" title="Class group">group</a> <span class="special">&amp;</span><span class="special">,</span> 
                    <span class="identifier">OutputIterator</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="group.html#idp91745232-bb"><span class="keyword">operator</span> <span class="keyword">bool</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <a class="link" href="group.html#idp91747408-bb"><span class="keyword">operator</span> <span class="identifier">MPI_Group</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">&gt;</span> <a class="link" href="group.html" title="Class group">group</a> <a class="link" href="group.html#idp92750000-bb"><span class="identifier">include</span></a><span class="special">(</span><span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">InputIterator</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">&gt;</span> <a class="link" href="group.html" title="Class group">group</a> <a class="link" href="group.html#idp92757408-bb"><span class="identifier">exclude</span></a><span class="special">(</span><span class="identifier">InputIterator</span><span class="special">,</span> <span class="identifier">InputIterator</span><span class="special">)</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="idp333991120"></a><h2>Description</h2>
<p>The <code class="computeroutput">group</code> class allows one to create arbitrary subsets of the processes within a communicator. One can compute the union, intersection, or difference of two groups, or create new groups by specifically including or excluding certain processes. Given a group, one can create a new communicator containing only the processes in that group. </p>
<div class="refsect2">
<a name="idp333992864"></a><h3>
<a name="boost.mpi.groupconstruct-copy-destruct"></a><code class="computeroutput">group</code> 
        public
       construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="idp35547680-bb"></a><span class="identifier">group</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>Constructs an empty group. </li>
<li class="listitem">
<pre class="literallayout"><a name="idp35548272-bb"></a><span class="identifier">group</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">MPI_Group</span> <span class="special">&amp;</span> in_group<span class="special">,</span> <span class="keyword">bool</span> adopt<span class="special">)</span><span class="special">;</span></pre>Constructs a group from an <code class="computeroutput">MPI_Group</code>. <p>This routine allows one to construct a Boost.MPI <code class="computeroutput">group</code> from a C <code class="computeroutput">MPI_Group</code>. The <code class="computeroutput">group</code> object can (optionally) adopt the <code class="computeroutput">MPI_Group</code>, after which point the <code class="computeroutput">group</code> object becomes responsible for freeing the <code class="computeroutput">MPI_Group</code> when the last copy of <code class="computeroutput">group</code> disappears.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">adopt</code></span></p></td>
<td><p>Whether the <code class="computeroutput">group</code> should adopt the <code class="computeroutput">MPI_Group</code>. When true, the <code class="computeroutput">group</code> object (or one of its copies) will free the group (via <code class="computeroutput">MPI_Comm_free</code>) when the last copy is destroyed. Otherwise, the user is responsible for calling <code class="computeroutput">MPI_Group_free</code>. </p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">in_group</code></span></p></td>
<td><p>The <code class="computeroutput">MPI_Group</code> used to construct this <code class="computeroutput">group</code>.</p></td>
</tr>
</tbody>
</table></div></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
<div class="refsect2">
<a name="idp334021744"></a><h3>
<a name="idp142344496-bb"></a><code class="computeroutput">group</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="identifier">optional</span><span class="special">&lt;</span> <span class="keyword">int</span> <span class="special">&gt;</span> <a name="idp142345056-bb"></a><span class="identifier">rank</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Determine the rank of the calling process in the group. <p>This routine is equivalent to <code class="computeroutput">MPI_Group_rank</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The rank of the calling process in the group, which will be a value in [0, size()). If the calling process is not in the group, returns an empty value. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">int</span> <a name="idp142348240-bb"></a><span class="identifier">size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Determine the number of processes in the group. <p>This routine is equivalent to <code class="computeroutput">MPI_Group_size</code>.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The number of processes in the group. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">,</span> <span class="keyword">typename</span> OutputIterator<span class="special">&gt;</span> 
  <span class="identifier">OutputIterator</span> 
  <a name="idp144023936-bb"></a><span class="identifier">translate_ranks</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">,</span> 
                  <span class="keyword">const</span> <a class="link" href="group.html" title="Class group">group</a> <span class="special">&amp;</span> to_group<span class="special">,</span> <span class="identifier">OutputIterator</span> out<span class="special">)</span><span class="special">;</span></pre>Translates the ranks from one group into the ranks of the same processes in another group. <p>This routine translates each of the integer rank values in the iterator range <code class="computeroutput"></code>[first, last) from the current group into rank values of the corresponding processes in <code class="computeroutput">to_group</code>. The corresponding rank values are written via the output iterator <code class="computeroutput">out</code>. When there is no correspondence between a rank in the current group and a rank in <code class="computeroutput">to_group</code>, the value <code class="computeroutput">MPI_UNDEFINED</code> is written to the output iterator.</p>
<p>

</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term">Parameters:</span></p></td>
<td><div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><code class="computeroutput">first</code></span></p></td>
<td><p>Beginning of the iterator range of ranks in the current group.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">last</code></span></p></td>
<td><p>Past the end of the iterator range of ranks in the current group.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">out</code></span></p></td>
<td><p>The output iterator to which the translated ranks will be written.</p></td>
</tr>
<tr>
<td><p><span class="term"><code class="computeroutput">to_group</code></span></p></td>
<td><p>The group that we are translating ranks to.</p></td>
</tr>
</tbody>
</table></div></td>
</tr>
<tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>the output iterator, which points one step past the last rank written. </p></td>
</tr>
</tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idp91745232-bb"></a><span class="keyword">operator</span> <span class="keyword">bool</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Determines whether the group is non-empty. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>True if the group is not empty, false if it is empty. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><a name="idp91747408-bb"></a><span class="keyword">operator</span> <span class="identifier">MPI_Group</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>Retrieves the underlying <code class="computeroutput">MPI_Group</code> associated with this group. <p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>The <code class="computeroutput">MPI_Group</code> handle manipulated by this object. If this object represents the empty group, returns <code class="computeroutput">MPI_GROUP_EMPTY</code>. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">&gt;</span> 
  <a class="link" href="group.html" title="Class group">group</a> <a name="idp92750000-bb"></a><span class="identifier">include</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">)</span><span class="special">;</span></pre>Creates a new group including a subset of the processes in the current group. <p>This routine creates a new <code class="computeroutput">group</code> which includes only those processes in the current group that are listed in the integer iterator range <code class="computeroutput"></code>[first, last). Equivalent to <code class="computeroutput">MPI_Group_incl</code>.</p>
<p><code class="computeroutput">first</code> The beginning of the iterator range of ranks to include.</p>
<p><code class="computeroutput">last</code> Past the end of the iterator range of ranks to include.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A new group containing those processes with ranks <code class="computeroutput"></code>[first, last) in the current group. </p></td>
</tr></tbody>
</table></div>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> InputIterator<span class="special">&gt;</span> 
  <a class="link" href="group.html" title="Class group">group</a> <a name="idp92757408-bb"></a><span class="identifier">exclude</span><span class="special">(</span><span class="identifier">InputIterator</span> first<span class="special">,</span> <span class="identifier">InputIterator</span> last<span class="special">)</span><span class="special">;</span></pre>Creates a new group from all of the processes in the current group, exluding a specific subset of the processes. <p>This routine creates a new <code class="computeroutput">group</code> which includes all of the processes in the current group except those whose ranks are listed in the integer iterator range <code class="computeroutput"></code>[first, last). Equivalent to <code class="computeroutput">MPI_Group_excl</code>.</p>
<p><code class="computeroutput">first</code> The beginning of the iterator range of ranks to exclude.</p>
<p><code class="computeroutput">last</code> Past the end of the iterator range of ranks to exclude.</p>
<p>
</p>
<div class="variablelist"><table border="0" class="variablelist compact">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term">Returns:</span></p></td>
<td><p>A new group containing all of the processes in the current group except those processes with ranks <code class="computeroutput"></code>[first, last) in the current group. </p></td>
</tr></tbody>
</table></div>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2005-2007 Douglas Gregor,
      Matthias Troyer, Trustees of Indiana University<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">
        http://www.boost.org/LICENSE_1_0.txt </a>)
      </p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="../graph_traits__idp151451520.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../mpi/reference.html#header.boost.mpi.group_hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="operator___idp224063376.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>