173
184
<a name="l00202"></a>00202 <span class="keywordflow">return</span> obj1;
174
185
<a name="l00203"></a>00203 }
175
186
<a name="l00204"></a>00204
176
<a name="l00207"></a>00207 <span class="keyword">static</span> inline <span class="keywordtype">int</span>
177
<a name="l00208"></a><a class="code" href="a00046.html#ga38d9bd3a7566d0e6b0ab95d652557707">00208</a> <a class="code" href="a00046.html#ga38d9bd3a7566d0e6b0ab95d652557707" title="Returns true if _obj_ is inside the subtree beginning with subtree_root.">hwloc_obj_is_in_subtree</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology , <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> subtree_root)
178
<a name="l00209"></a>00209 {
179
<a name="l00210"></a>00210 <span class="keywordflow">return</span> <a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, subtree_root-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
180
<a name="l00211"></a>00211 }
181
<a name="l00212"></a>00212
182
<a name="l00229"></a>00229 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
183
<a name="l00230"></a><a class="code" href="a00047.html#gabcd5fa81a95fa5335950cae092277d5b">00230</a> <a class="code" href="a00047.html#gabcd5fa81a95fa5335950cae092277d5b" title="Get the first largest object included in the given cpuset set.">hwloc_get_first_largest_obj_inside_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>)
184
<a name="l00231"></a>00231 {
185
<a name="l00232"></a>00232 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology);
186
<a name="l00233"></a>00233 <span class="keywordflow">if</span> (!<a class="code" href="a00056.html#ga575c27953709a8cb9a047aae65157526" title="Test whether bitmaps bitmap1 and bitmap2 intersects.">hwloc_bitmap_intersects</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
187
<a name="l00234"></a>00234 <span class="keywordflow">return</span> NULL;
188
<a name="l00235"></a>00235 <span class="keywordflow">while</span> (!<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>)) {
189
<a name="l00236"></a>00236 <span class="comment">/* while the object intersects without being included, look at its children */</span>
190
<a name="l00237"></a>00237 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> child = NULL;
191
<a name="l00238"></a>00238 <span class="keywordflow">while</span> ((child = <a class="code" href="a00046.html#gae5ef1af636849f77714e1584ba78cf9c" title="Return the next child.">hwloc_get_next_child</a>(topology, obj, child)) != NULL) {
192
<a name="l00239"></a>00239 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#ga575c27953709a8cb9a047aae65157526" title="Test whether bitmaps bitmap1 and bitmap2 intersects.">hwloc_bitmap_intersects</a>(child-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
193
<a name="l00240"></a>00240 <span class="keywordflow">break</span>;
194
<a name="l00241"></a>00241 }
195
<a name="l00242"></a>00242 <span class="keywordflow">if</span> (!child)
196
<a name="l00243"></a>00243 <span class="comment">/* no child intersects, return their father */</span>
197
<a name="l00244"></a>00244 <span class="keywordflow">return</span> obj;
198
<a name="l00245"></a>00245 <span class="comment">/* found one intersecting child, look at its children */</span>
199
<a name="l00246"></a>00246 obj = child;
200
<a name="l00247"></a>00247 }
201
<a name="l00248"></a>00248 <span class="comment">/* obj is included, return it */</span>
202
<a name="l00249"></a>00249 <span class="keywordflow">return</span> obj;
203
<a name="l00250"></a>00250 }
204
<a name="l00251"></a>00251
205
<a name="l00256"></a>00256 <span class="keywordtype">int</span> <a class="code" href="a00047.html#gaab04c89623662e63a48ed2cd48eb601c" title="Get the set of largest objects covering exactly a given cpuset set.">hwloc_get_largest_objs_inside_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
206
<a name="l00257"></a>00257 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> * restrict objs, <span class="keywordtype">int</span> max);
207
<a name="l00258"></a>00258
208
<a name="l00265"></a>00265 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
209
<a name="l00266"></a><a class="code" href="a00047.html#ga8af256c2572f16520f95440b884c1bd6">00266</a> <a class="code" href="a00047.html#ga8af256c2572f16520f95440b884c1bd6" title="Return the next object at depth depth included in CPU set set.">hwloc_get_next_obj_inside_cpuset_by_depth</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
210
<a name="l00267"></a>00267 <span class="keywordtype">unsigned</span> depth, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
211
<a name="l00268"></a>00268 {
212
<a name="l00269"></a>00269 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> next = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, prev);
213
<a name="l00270"></a>00270 <span class="keywordflow">while</span> (next && !<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(next-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
214
<a name="l00271"></a>00271 next = next-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
215
<a name="l00272"></a>00272 <span class="keywordflow">return</span> next;
216
<a name="l00273"></a>00273 }
217
<a name="l00274"></a>00274
218
<a name="l00281"></a>00281 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
219
<a name="l00282"></a><a class="code" href="a00047.html#ga934e7ecd68b33403e0c0be779d9ed1e6">00282</a> <a class="code" href="a00047.html#ga934e7ecd68b33403e0c0be779d9ed1e6" title="Return the next object of type type included in CPU set set.">hwloc_get_next_obj_inside_cpuset_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
220
<a name="l00283"></a>00283 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
221
<a name="l00284"></a>00284 {
222
<a name="l00285"></a>00285 <span class="keywordtype">int</span> depth = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
223
<a name="l00286"></a>00286 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> || depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
224
<a name="l00287"></a>00287 <span class="keywordflow">return</span> NULL;
225
<a name="l00288"></a>00288 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga8af256c2572f16520f95440b884c1bd6" title="Return the next object at depth depth included in CPU set set.">hwloc_get_next_obj_inside_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth, prev);
226
<a name="l00289"></a>00289 }
227
<a name="l00290"></a>00290
228
<a name="l00293"></a>00293 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
229
<a name="l00294"></a><a class="code" href="a00047.html#ga20703980008f82379f98f56857611a1a">00294</a> <a class="code" href="a00047.html#ga20703980008f82379f98f56857611a1a" title="Return the index -th object at depth depth included in CPU set set.">hwloc_get_obj_inside_cpuset_by_depth</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
230
<a name="l00295"></a>00295 <span class="keywordtype">unsigned</span> depth, <span class="keywordtype">unsigned</span> idx)
231
<a name="l00296"></a>00296 {
232
<a name="l00297"></a>00297 <span class="keywordtype">unsigned</span> count = 0;
233
<a name="l00298"></a>00298 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00041.html#gaedd78240b0c1108355586a268ec5a697" title="Returns the topology object at index index from depth depth.">hwloc_get_obj_by_depth</a> (topology, depth, 0);
234
<a name="l00299"></a>00299 <span class="keywordflow">while</span> (obj) {
235
<a name="l00300"></a>00300 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>)) {
236
<a name="l00301"></a>00301 <span class="keywordflow">if</span> (count == idx)
237
<a name="l00302"></a>00302 <span class="keywordflow">return</span> obj;
238
<a name="l00303"></a>00303 count++;
239
<a name="l00304"></a>00304 }
240
<a name="l00305"></a>00305 obj = obj-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
241
<a name="l00306"></a>00306 }
242
<a name="l00307"></a>00307 <span class="keywordflow">return</span> NULL;
243
<a name="l00308"></a>00308 }
244
<a name="l00309"></a>00309
245
<a name="l00316"></a>00316 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
246
<a name="l00317"></a><a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b">00317</a> <a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b" title="Return the idx -th object of type type included in CPU set set.">hwloc_get_obj_inside_cpuset_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
247
<a name="l00318"></a>00318 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type, <span class="keywordtype">unsigned</span> idx)
248
<a name="l00319"></a>00319 {
249
<a name="l00320"></a>00320 <span class="keywordtype">int</span> depth = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
250
<a name="l00321"></a>00321 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> || depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
251
<a name="l00322"></a>00322 <span class="keywordflow">return</span> NULL;
252
<a name="l00323"></a>00323 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga20703980008f82379f98f56857611a1a" title="Return the index -th object at depth depth included in CPU set set.">hwloc_get_obj_inside_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth, idx);
253
<a name="l00324"></a>00324 }
254
<a name="l00325"></a>00325
255
<a name="l00327"></a>00327 <span class="keyword">static</span> inline <span class="keywordtype">unsigned</span>
256
<a name="l00328"></a><a class="code" href="a00047.html#ga6807db0012369efe19b8d3dcee235493">00328</a> <a class="code" href="a00047.html#ga6807db0012369efe19b8d3dcee235493" title="Return the number of objects at depth depth included in CPU set set.">hwloc_get_nbobjs_inside_cpuset_by_depth</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
257
<a name="l00329"></a>00329 <span class="keywordtype">unsigned</span> depth)
258
<a name="l00330"></a>00330 {
259
<a name="l00331"></a>00331 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00041.html#gaedd78240b0c1108355586a268ec5a697" title="Returns the topology object at index index from depth depth.">hwloc_get_obj_by_depth</a> (topology, depth, 0);
260
<a name="l00332"></a>00332 <span class="keywordtype">int</span> count = 0;
261
<a name="l00333"></a>00333 <span class="keywordflow">while</span> (obj) {
262
<a name="l00334"></a>00334 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
263
<a name="l00335"></a>00335 count++;
264
<a name="l00336"></a>00336 obj = obj-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
265
<a name="l00337"></a>00337 }
266
<a name="l00338"></a>00338 <span class="keywordflow">return</span> count;
267
<a name="l00339"></a>00339 }
268
<a name="l00340"></a>00340
269
<a name="l00347"></a>00347 <span class="keyword">static</span> inline <span class="keywordtype">int</span>
270
<a name="l00348"></a><a class="code" href="a00047.html#ga72c5bc4317a4c3938e32447b769813a0">00348</a> <a class="code" href="a00047.html#ga72c5bc4317a4c3938e32447b769813a0" title="Return the number of objects of type type included in CPU set set.">hwloc_get_nbobjs_inside_cpuset_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
271
<a name="l00349"></a>00349 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type)
272
<a name="l00350"></a>00350 {
273
<a name="l00351"></a>00351 <span class="keywordtype">int</span> depth = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
274
<a name="l00352"></a>00352 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a>)
275
<a name="l00353"></a>00353 <span class="keywordflow">return</span> 0;
276
<a name="l00354"></a>00354 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
277
<a name="l00355"></a>00355 <span class="keywordflow">return</span> -1; <span class="comment">/* FIXME: agregate nbobjs from different levels? */</span>
278
<a name="l00356"></a>00356 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga6807db0012369efe19b8d3dcee235493" title="Return the number of objects at depth depth included in CPU set set.">hwloc_get_nbobjs_inside_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth);
279
<a name="l00357"></a>00357 }
280
<a name="l00358"></a>00358
281
<a name="l00371"></a>00371 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
282
<a name="l00372"></a><a class="code" href="a00048.html#gab56b99460194bbcb36016d36d55132a7">00372</a> <a class="code" href="a00048.html#gab56b99460194bbcb36016d36d55132a7" title="Get the child covering at least CPU set set.">hwloc_get_child_covering_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology , <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
283
<a name="l00373"></a>00373 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> parent)
284
<a name="l00374"></a>00374 {
285
<a name="l00375"></a>00375 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> child;
286
<a name="l00376"></a>00376
287
<a name="l00377"></a>00377 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(<span class="keyword">set</span>))
288
<a name="l00378"></a>00378 <span class="keywordflow">return</span> NULL;
289
<a name="l00379"></a>00379
290
<a name="l00380"></a>00380 child = parent-><a class="code" href="a00012.html#af51d08a0a79dba517c06c5afedc8d2dc" title="First child.">first_child</a>;
291
<a name="l00381"></a>00381 <span class="keywordflow">while</span> (child) {
292
<a name="l00382"></a>00382 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(<span class="keyword">set</span>, child-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>))
293
<a name="l00383"></a>00383 <span class="keywordflow">return</span> child;
294
<a name="l00384"></a>00384 child = child-><a class="code" href="a00012.html#a7f2343ed476fe4942e6fffd4cade1b40" title="Next object below the same parent.">next_sibling</a>;
295
<a name="l00385"></a>00385 }
296
<a name="l00386"></a>00386 <span class="keywordflow">return</span> NULL;
297
<a name="l00387"></a>00387 }
298
<a name="l00388"></a>00388
299
<a name="l00393"></a>00393 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
300
<a name="l00394"></a><a class="code" href="a00048.html#ga2a0de36ea0c3c70fb5f4cba0bb192582">00394</a> <a class="code" href="a00048.html#ga2a0de36ea0c3c70fb5f4cba0bb192582" title="Get the lowest object covering at least CPU set set.">hwloc_get_obj_covering_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>)
301
<a name="l00395"></a>00395 {
302
<a name="l00396"></a>00396 <span class="keyword">struct </span><a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj</a> *current = <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology);
303
<a name="l00397"></a>00397
304
<a name="l00398"></a>00398 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(<span class="keyword">set</span>))
305
<a name="l00399"></a>00399 <span class="keywordflow">return</span> NULL;
306
<a name="l00400"></a>00400
307
<a name="l00401"></a>00401 <span class="keywordflow">if</span> (!<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(<span class="keyword">set</span>, current-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>))
308
<a name="l00402"></a>00402 <span class="keywordflow">return</span> NULL;
309
<a name="l00403"></a>00403
310
<a name="l00404"></a>00404 <span class="keywordflow">while</span> (1) {
311
<a name="l00405"></a>00405 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> child = <a class="code" href="a00048.html#gab56b99460194bbcb36016d36d55132a7" title="Get the child covering at least CPU set set.">hwloc_get_child_covering_cpuset</a>(topology, <span class="keyword">set</span>, current);
312
<a name="l00406"></a>00406 <span class="keywordflow">if</span> (!child)
313
<a name="l00407"></a>00407 <span class="keywordflow">return</span> current;
314
<a name="l00408"></a>00408 current = child;
315
<a name="l00409"></a>00409 }
316
<a name="l00410"></a>00410 }
317
<a name="l00411"></a>00411
318
<a name="l00412"></a>00412
319
<a name="l00428"></a>00428 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
320
<a name="l00429"></a><a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b">00429</a> <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
321
<a name="l00430"></a>00430 <span class="keywordtype">unsigned</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a>, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
322
<a name="l00431"></a>00431 {
323
<a name="l00432"></a>00432 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> next = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, prev);
324
<a name="l00433"></a>00433 <span class="keywordflow">while</span> (next && !<a class="code" href="a00056.html#ga575c27953709a8cb9a047aae65157526" title="Test whether bitmaps bitmap1 and bitmap2 intersects.">hwloc_bitmap_intersects</a>(<span class="keyword">set</span>, next-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>))
325
<a name="l00434"></a>00434 next = next-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
326
<a name="l00435"></a>00435 <span class="keywordflow">return</span> next;
327
<a name="l00436"></a>00436 }
328
<a name="l00437"></a>00437
329
<a name="l00450"></a>00450 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
330
<a name="l00451"></a><a class="code" href="a00049.html#ga5915ea30f326676b3a4cfff371ce04d1">00451</a> <a class="code" href="a00049.html#ga5915ea30f326676b3a4cfff371ce04d1" title="Iterate through same-type objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_type</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
331
<a name="l00452"></a>00452 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> <a class="code" href="a00012.html#acc4f0803f244867e68fe0036800be5de" title="Type of object.">type</a>, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
332
<a name="l00453"></a>00453 {
333
<a name="l00454"></a>00454 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
334
<a name="l00455"></a>00455 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> || depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
335
<a name="l00456"></a>00456 <span class="keywordflow">return</span> NULL;
336
<a name="l00457"></a>00457 <span class="keywordflow">return</span> <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth, prev);
337
<a name="l00458"></a>00458 }
338
<a name="l00459"></a>00459
339
<a name="l00472"></a>00472 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
340
<a name="l00473"></a><a class="code" href="a00050.html#gae744419648117cbd613a038074aa0627">00473</a> <a class="code" href="a00050.html#gae744419648117cbd613a038074aa0627" title="Get the first cache covering a cpuset set.">hwloc_get_cache_covering_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>)
341
<a name="l00474"></a>00474 {
342
<a name="l00475"></a>00475 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> current = <a class="code" href="a00048.html#ga2a0de36ea0c3c70fb5f4cba0bb192582" title="Get the lowest object covering at least CPU set set.">hwloc_get_obj_covering_cpuset</a>(topology, <span class="keyword">set</span>);
343
<a name="l00476"></a>00476 <span class="keywordflow">while</span> (current) {
344
<a name="l00477"></a>00477 <span class="keywordflow">if</span> (current-><a class="code" href="a00012.html#acc4f0803f244867e68fe0036800be5de" title="Type of object.">type</a> == <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55a56ee0b7eca88f363b75b34fdde8c9ddc" title="Data cache. Can be L1, L2, L3, ...">HWLOC_OBJ_CACHE</a>)
345
<a name="l00478"></a>00478 <span class="keywordflow">return</span> current;
346
<a name="l00479"></a>00479 current = current-><a class="code" href="a00012.html#adc494f6aed939992be1c55cca5822900" title="Parent, NULL if root (system object)">parent</a>;
347
<a name="l00480"></a>00480 }
348
<a name="l00481"></a>00481 <span class="keywordflow">return</span> NULL;
349
<a name="l00482"></a>00482 }
350
<a name="l00483"></a>00483
351
<a name="l00488"></a>00488 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
352
<a name="l00489"></a><a class="code" href="a00050.html#ga75e961873d4b976ab10bc4739248c96d">00489</a> <a class="code" href="a00050.html#ga75e961873d4b976ab10bc4739248c96d" title="Get the first cache shared between an object and somebody else.">hwloc_get_shared_cache_covering_obj</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology , <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj)
353
<a name="l00490"></a>00490 {
354
<a name="l00491"></a>00491 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> current = obj-><a class="code" href="a00012.html#adc494f6aed939992be1c55cca5822900" title="Parent, NULL if root (system object)">parent</a>;
355
<a name="l00492"></a>00492 <span class="keywordflow">while</span> (current) {
356
<a name="l00493"></a>00493 <span class="keywordflow">if</span> (!<a class="code" href="a00056.html#ga4dd6a75ab63d33ef33bd626b0e489388" title="Test whether bitmap bitmap1 is equal to bitmap bitmap2.">hwloc_bitmap_isequal</a>(current-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>)
357
<a name="l00494"></a>00494 && current-><a class="code" href="a00012.html#acc4f0803f244867e68fe0036800be5de" title="Type of object.">type</a> == <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55a56ee0b7eca88f363b75b34fdde8c9ddc" title="Data cache. Can be L1, L2, L3, ...">HWLOC_OBJ_CACHE</a>)
358
<a name="l00495"></a>00495 <span class="keywordflow">return</span> current;
359
<a name="l00496"></a>00496 current = current-><a class="code" href="a00012.html#adc494f6aed939992be1c55cca5822900" title="Parent, NULL if root (system object)">parent</a>;
360
<a name="l00497"></a>00497 }
361
<a name="l00498"></a>00498 <span class="keywordflow">return</span> NULL;
362
<a name="l00499"></a>00499 }
363
<a name="l00500"></a>00500
364
<a name="l00516"></a>00516 <span class="comment">/* TODO: rather provide an iterator? Provide a way to know how much should be allocated? By returning the total number of objects instead? */</span>
365
<a name="l00517"></a>00517 <span class="keywordtype">unsigned</span> <a class="code" href="a00051.html#ga26c2ac4f25b1ed293249c88e232f1bea" title="Do a depth-first traversal of the topology to find and sort.">hwloc_get_closest_objs</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> src, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> * restrict objs, <span class="keywordtype">unsigned</span> max);
366
<a name="l00518"></a>00518
367
<a name="l00529"></a>00529 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
368
<a name="l00530"></a><a class="code" href="a00051.html#ga3d32c128aa36b5c9d56f6bf9e70d0e78">00530</a> <a class="code" href="a00051.html#ga3d32c128aa36b5c9d56f6bf9e70d0e78" title="Find an object below another object, both specified by types and indexes.">hwloc_get_obj_below_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology,
369
<a name="l00531"></a>00531 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type1, <span class="keywordtype">unsigned</span> idx1,
370
<a name="l00532"></a>00532 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type2, <span class="keywordtype">unsigned</span> idx2)
371
<a name="l00533"></a>00533 {
372
<a name="l00534"></a>00534 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
373
<a name="l00535"></a>00535
374
<a name="l00536"></a>00536 obj = <a class="code" href="a00041.html#ga701f83b2cf0cb8e0acd58cd2dc1c67a2" title="Returns the topology object at index index with type type.">hwloc_get_obj_by_type</a> (topology, type1, idx1);
375
<a name="l00537"></a>00537 <span class="keywordflow">if</span> (!obj)
376
<a name="l00538"></a>00538 <span class="keywordflow">return</span> NULL;
377
<a name="l00539"></a>00539
378
<a name="l00540"></a>00540 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b" title="Return the idx -th object of type type included in CPU set set.">hwloc_get_obj_inside_cpuset_by_type</a>(topology, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, type2, idx2);
379
<a name="l00541"></a>00541 }
380
<a name="l00542"></a>00542
381
<a name="l00558"></a>00558 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
382
<a name="l00559"></a><a class="code" href="a00051.html#ga340bb7021204078c30382ea77d38bde9">00559</a> <a class="code" href="a00051.html#ga340bb7021204078c30382ea77d38bde9" title="Find an object below a chain of objects specified by types and indexes.">hwloc_get_obj_below_array_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <span class="keywordtype">int</span> nr, <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> *typev, <span class="keywordtype">unsigned</span> *idxv)
383
<a name="l00560"></a>00560 {
384
<a name="l00561"></a>00561 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology);
385
<a name="l00562"></a>00562 <span class="keywordtype">int</span> i;
386
<a name="l00563"></a>00563
387
<a name="l00564"></a>00564 <span class="keywordflow">for</span>(i=0; i<nr; i++) {
388
<a name="l00565"></a>00565 obj = <a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b" title="Return the idx -th object of type type included in CPU set set.">hwloc_get_obj_inside_cpuset_by_type</a>(topology, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, typev[i], idxv[i]);
389
<a name="l00566"></a>00566 <span class="keywordflow">if</span> (!obj)
390
<a name="l00567"></a>00567 <span class="keywordflow">return</span> NULL;
391
<a name="l00568"></a>00568 }
392
<a name="l00569"></a>00569
393
<a name="l00570"></a>00570 <span class="keywordflow">return</span> obj;
394
<a name="l00571"></a>00571 }
395
<a name="l00572"></a>00572
396
<a name="l00594"></a>00594 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
397
<a name="l00595"></a>00595 <a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619" title="Distribute n items over the topology under root.">hwloc_distributev</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> *root, <span class="keywordtype">unsigned</span> n_roots, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *<a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keywordtype">unsigned</span> n, <span class="keywordtype">unsigned</span> until);
187
<a name="l00209"></a>00209 <span class="keyword">static</span> inline <span class="keywordtype">int</span>
188
<a name="l00210"></a><a class="code" href="a00046.html#ga38d9bd3a7566d0e6b0ab95d652557707">00210</a> <a class="code" href="a00046.html#ga38d9bd3a7566d0e6b0ab95d652557707" title="Returns true if obj is inside the subtree beginning with subtree_root.">hwloc_obj_is_in_subtree</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology , <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> subtree_root)
189
<a name="l00211"></a>00211 {
190
<a name="l00212"></a>00212 <span class="keywordflow">return</span> <a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, subtree_root-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
191
<a name="l00213"></a>00213 }
192
<a name="l00214"></a>00214
193
<a name="l00231"></a>00231 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
194
<a name="l00232"></a><a class="code" href="a00047.html#gabcd5fa81a95fa5335950cae092277d5b">00232</a> <a class="code" href="a00047.html#gabcd5fa81a95fa5335950cae092277d5b" title="Get the first largest object included in the given cpuset set.">hwloc_get_first_largest_obj_inside_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>)
195
<a name="l00233"></a>00233 {
196
<a name="l00234"></a>00234 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology);
197
<a name="l00235"></a>00235 <span class="keywordflow">if</span> (!<a class="code" href="a00056.html#ga575c27953709a8cb9a047aae65157526" title="Test whether bitmaps bitmap1 and bitmap2 intersects.">hwloc_bitmap_intersects</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
198
<a name="l00236"></a>00236 <span class="keywordflow">return</span> NULL;
199
<a name="l00237"></a>00237 <span class="keywordflow">while</span> (!<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>)) {
200
<a name="l00238"></a>00238 <span class="comment">/* while the object intersects without being included, look at its children */</span>
201
<a name="l00239"></a>00239 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> child = NULL;
202
<a name="l00240"></a>00240 <span class="keywordflow">while</span> ((child = <a class="code" href="a00046.html#gae5ef1af636849f77714e1584ba78cf9c" title="Return the next child.">hwloc_get_next_child</a>(topology, obj, child)) != NULL) {
203
<a name="l00241"></a>00241 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#ga575c27953709a8cb9a047aae65157526" title="Test whether bitmaps bitmap1 and bitmap2 intersects.">hwloc_bitmap_intersects</a>(child-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
204
<a name="l00242"></a>00242 <span class="keywordflow">break</span>;
205
<a name="l00243"></a>00243 }
206
<a name="l00244"></a>00244 <span class="keywordflow">if</span> (!child)
207
<a name="l00245"></a>00245 <span class="comment">/* no child intersects, return their father */</span>
208
<a name="l00246"></a>00246 <span class="keywordflow">return</span> obj;
209
<a name="l00247"></a>00247 <span class="comment">/* found one intersecting child, look at its children */</span>
210
<a name="l00248"></a>00248 obj = child;
211
<a name="l00249"></a>00249 }
212
<a name="l00250"></a>00250 <span class="comment">/* obj is included, return it */</span>
213
<a name="l00251"></a>00251 <span class="keywordflow">return</span> obj;
214
<a name="l00252"></a>00252 }
215
<a name="l00253"></a>00253
216
<a name="l00258"></a>00258 <span class="keywordtype">int</span> <a class="code" href="a00047.html#gaab04c89623662e63a48ed2cd48eb601c" title="Get the set of largest objects covering exactly a given cpuset set.">hwloc_get_largest_objs_inside_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
217
<a name="l00259"></a>00259 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> * restrict objs, <span class="keywordtype">int</span> max);
218
<a name="l00260"></a>00260
219
<a name="l00267"></a>00267 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
220
<a name="l00268"></a><a class="code" href="a00047.html#ga8af256c2572f16520f95440b884c1bd6">00268</a> <a class="code" href="a00047.html#ga8af256c2572f16520f95440b884c1bd6" title="Return the next object at depth depth included in CPU set set.">hwloc_get_next_obj_inside_cpuset_by_depth</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
221
<a name="l00269"></a>00269 <span class="keywordtype">unsigned</span> depth, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
222
<a name="l00270"></a>00270 {
223
<a name="l00271"></a>00271 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> next = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, prev);
224
<a name="l00272"></a>00272 <span class="keywordflow">while</span> (next && !<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(next-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
225
<a name="l00273"></a>00273 next = next-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
226
<a name="l00274"></a>00274 <span class="keywordflow">return</span> next;
227
<a name="l00275"></a>00275 }
228
<a name="l00276"></a>00276
229
<a name="l00283"></a>00283 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
230
<a name="l00284"></a><a class="code" href="a00047.html#ga934e7ecd68b33403e0c0be779d9ed1e6">00284</a> <a class="code" href="a00047.html#ga934e7ecd68b33403e0c0be779d9ed1e6" title="Return the next object of type type included in CPU set set.">hwloc_get_next_obj_inside_cpuset_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
231
<a name="l00285"></a>00285 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
232
<a name="l00286"></a>00286 {
233
<a name="l00287"></a>00287 <span class="keywordtype">int</span> depth = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
234
<a name="l00288"></a>00288 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> || depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
235
<a name="l00289"></a>00289 <span class="keywordflow">return</span> NULL;
236
<a name="l00290"></a>00290 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga8af256c2572f16520f95440b884c1bd6" title="Return the next object at depth depth included in CPU set set.">hwloc_get_next_obj_inside_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth, prev);
237
<a name="l00291"></a>00291 }
238
<a name="l00292"></a>00292
239
<a name="l00295"></a>00295 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
240
<a name="l00296"></a><a class="code" href="a00047.html#ga20703980008f82379f98f56857611a1a">00296</a> <a class="code" href="a00047.html#ga20703980008f82379f98f56857611a1a" title="Return the index -th object at depth depth included in CPU set set.">hwloc_get_obj_inside_cpuset_by_depth</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
241
<a name="l00297"></a>00297 <span class="keywordtype">unsigned</span> depth, <span class="keywordtype">unsigned</span> idx)
242
<a name="l00298"></a>00298 {
243
<a name="l00299"></a>00299 <span class="keywordtype">unsigned</span> count = 0;
244
<a name="l00300"></a>00300 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00041.html#gaedd78240b0c1108355586a268ec5a697" title="Returns the topology object at index index from depth depth.">hwloc_get_obj_by_depth</a> (topology, depth, 0);
245
<a name="l00301"></a>00301 <span class="keywordflow">while</span> (obj) {
246
<a name="l00302"></a>00302 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>)) {
247
<a name="l00303"></a>00303 <span class="keywordflow">if</span> (count == idx)
248
<a name="l00304"></a>00304 <span class="keywordflow">return</span> obj;
249
<a name="l00305"></a>00305 count++;
250
<a name="l00306"></a>00306 }
251
<a name="l00307"></a>00307 obj = obj-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
252
<a name="l00308"></a>00308 }
253
<a name="l00309"></a>00309 <span class="keywordflow">return</span> NULL;
254
<a name="l00310"></a>00310 }
255
<a name="l00311"></a>00311
256
<a name="l00318"></a>00318 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
257
<a name="l00319"></a><a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b">00319</a> <a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b" title="Return the idx -th object of type type included in CPU set set.">hwloc_get_obj_inside_cpuset_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
258
<a name="l00320"></a>00320 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type, <span class="keywordtype">unsigned</span> idx)
259
<a name="l00321"></a>00321 {
260
<a name="l00322"></a>00322 <span class="keywordtype">int</span> depth = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
261
<a name="l00323"></a>00323 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> || depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
262
<a name="l00324"></a>00324 <span class="keywordflow">return</span> NULL;
263
<a name="l00325"></a>00325 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga20703980008f82379f98f56857611a1a" title="Return the index -th object at depth depth included in CPU set set.">hwloc_get_obj_inside_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth, idx);
264
<a name="l00326"></a>00326 }
265
<a name="l00327"></a>00327
266
<a name="l00329"></a>00329 <span class="keyword">static</span> inline <span class="keywordtype">unsigned</span>
267
<a name="l00330"></a><a class="code" href="a00047.html#ga6807db0012369efe19b8d3dcee235493">00330</a> <a class="code" href="a00047.html#ga6807db0012369efe19b8d3dcee235493" title="Return the number of objects at depth depth included in CPU set set.">hwloc_get_nbobjs_inside_cpuset_by_depth</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
268
<a name="l00331"></a>00331 <span class="keywordtype">unsigned</span> depth)
269
<a name="l00332"></a>00332 {
270
<a name="l00333"></a>00333 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00041.html#gaedd78240b0c1108355586a268ec5a697" title="Returns the topology object at index index from depth depth.">hwloc_get_obj_by_depth</a> (topology, depth, 0);
271
<a name="l00334"></a>00334 <span class="keywordtype">int</span> count = 0;
272
<a name="l00335"></a>00335 <span class="keywordflow">while</span> (obj) {
273
<a name="l00336"></a>00336 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keyword">set</span>))
274
<a name="l00337"></a>00337 count++;
275
<a name="l00338"></a>00338 obj = obj-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
276
<a name="l00339"></a>00339 }
277
<a name="l00340"></a>00340 <span class="keywordflow">return</span> count;
278
<a name="l00341"></a>00341 }
279
<a name="l00342"></a>00342
280
<a name="l00349"></a>00349 <span class="keyword">static</span> inline <span class="keywordtype">int</span>
281
<a name="l00350"></a><a class="code" href="a00047.html#ga72c5bc4317a4c3938e32447b769813a0">00350</a> <a class="code" href="a00047.html#ga72c5bc4317a4c3938e32447b769813a0" title="Return the number of objects of type type included in CPU set set.">hwloc_get_nbobjs_inside_cpuset_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
282
<a name="l00351"></a>00351 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type)
283
<a name="l00352"></a>00352 {
284
<a name="l00353"></a>00353 <span class="keywordtype">int</span> depth = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
285
<a name="l00354"></a>00354 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a>)
286
<a name="l00355"></a>00355 <span class="keywordflow">return</span> 0;
287
<a name="l00356"></a>00356 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
288
<a name="l00357"></a>00357 <span class="keywordflow">return</span> -1; <span class="comment">/* FIXME: agregate nbobjs from different levels? */</span>
289
<a name="l00358"></a>00358 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga6807db0012369efe19b8d3dcee235493" title="Return the number of objects at depth depth included in CPU set set.">hwloc_get_nbobjs_inside_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth);
290
<a name="l00359"></a>00359 }
291
<a name="l00360"></a>00360
292
<a name="l00373"></a>00373 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
293
<a name="l00374"></a><a class="code" href="a00048.html#gab56b99460194bbcb36016d36d55132a7">00374</a> <a class="code" href="a00048.html#gab56b99460194bbcb36016d36d55132a7" title="Get the child covering at least CPU set set.">hwloc_get_child_covering_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology , <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
294
<a name="l00375"></a>00375 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> parent)
295
<a name="l00376"></a>00376 {
296
<a name="l00377"></a>00377 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> child;
297
<a name="l00378"></a>00378
298
<a name="l00379"></a>00379 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(<span class="keyword">set</span>))
299
<a name="l00380"></a>00380 <span class="keywordflow">return</span> NULL;
300
<a name="l00381"></a>00381
301
<a name="l00382"></a>00382 child = parent-><a class="code" href="a00012.html#af51d08a0a79dba517c06c5afedc8d2dc" title="First child.">first_child</a>;
302
<a name="l00383"></a>00383 <span class="keywordflow">while</span> (child) {
303
<a name="l00384"></a>00384 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(<span class="keyword">set</span>, child-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>))
304
<a name="l00385"></a>00385 <span class="keywordflow">return</span> child;
305
<a name="l00386"></a>00386 child = child-><a class="code" href="a00012.html#a7f2343ed476fe4942e6fffd4cade1b40" title="Next object below the same parent.">next_sibling</a>;
306
<a name="l00387"></a>00387 }
307
<a name="l00388"></a>00388 <span class="keywordflow">return</span> NULL;
308
<a name="l00389"></a>00389 }
309
<a name="l00390"></a>00390
310
<a name="l00395"></a>00395 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
311
<a name="l00396"></a><a class="code" href="a00048.html#ga2a0de36ea0c3c70fb5f4cba0bb192582">00396</a> <a class="code" href="a00048.html#ga2a0de36ea0c3c70fb5f4cba0bb192582" title="Get the lowest object covering at least CPU set set.">hwloc_get_obj_covering_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>)
312
<a name="l00397"></a>00397 {
313
<a name="l00398"></a>00398 <span class="keyword">struct </span><a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj</a> *current = <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology);
314
<a name="l00399"></a>00399
315
<a name="l00400"></a>00400 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(<span class="keyword">set</span>))
316
<a name="l00401"></a>00401 <span class="keywordflow">return</span> NULL;
317
<a name="l00402"></a>00402
318
<a name="l00403"></a>00403 <span class="keywordflow">if</span> (!<a class="code" href="a00056.html#gaae29e14a926c198e8f91e6e4790621e7" title="Test whether bitmap sub_bitmap is part of bitmap super_bitmap.">hwloc_bitmap_isincluded</a>(<span class="keyword">set</span>, current-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>))
319
<a name="l00404"></a>00404 <span class="keywordflow">return</span> NULL;
320
<a name="l00405"></a>00405
321
<a name="l00406"></a>00406 <span class="keywordflow">while</span> (1) {
322
<a name="l00407"></a>00407 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> child = <a class="code" href="a00048.html#gab56b99460194bbcb36016d36d55132a7" title="Get the child covering at least CPU set set.">hwloc_get_child_covering_cpuset</a>(topology, <span class="keyword">set</span>, current);
323
<a name="l00408"></a>00408 <span class="keywordflow">if</span> (!child)
324
<a name="l00409"></a>00409 <span class="keywordflow">return</span> current;
325
<a name="l00410"></a>00410 current = child;
326
<a name="l00411"></a>00411 }
327
<a name="l00412"></a>00412 }
328
<a name="l00413"></a>00413
329
<a name="l00414"></a>00414
330
<a name="l00430"></a>00430 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
331
<a name="l00431"></a><a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b">00431</a> <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
332
<a name="l00432"></a>00432 <span class="keywordtype">unsigned</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a>, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
333
<a name="l00433"></a>00433 {
334
<a name="l00434"></a>00434 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> next = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, prev);
335
<a name="l00435"></a>00435 <span class="keywordflow">while</span> (next && !<a class="code" href="a00056.html#ga575c27953709a8cb9a047aae65157526" title="Test whether bitmaps bitmap1 and bitmap2 intersects.">hwloc_bitmap_intersects</a>(<span class="keyword">set</span>, next-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>))
336
<a name="l00436"></a>00436 next = next-><a class="code" href="a00012.html#a85a788017457129589318b6c39451acf" title="Next object of same type.">next_cousin</a>;
337
<a name="l00437"></a>00437 <span class="keywordflow">return</span> next;
338
<a name="l00438"></a>00438 }
339
<a name="l00439"></a>00439
340
<a name="l00452"></a>00452 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
341
<a name="l00453"></a><a class="code" href="a00049.html#ga5915ea30f326676b3a4cfff371ce04d1">00453</a> <a class="code" href="a00049.html#ga5915ea30f326676b3a4cfff371ce04d1" title="Iterate through same-type objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_type</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>,
342
<a name="l00454"></a>00454 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> <a class="code" href="a00012.html#acc4f0803f244867e68fe0036800be5de" title="Type of object.">type</a>, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> prev)
343
<a name="l00455"></a>00455 {
344
<a name="l00456"></a>00456 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, type);
345
<a name="l00457"></a>00457 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> || depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575ae99465995cacde6c210d5fc2e409798c" title="Objects of given type exist at different depth in the topology.">HWLOC_TYPE_DEPTH_MULTIPLE</a>)
346
<a name="l00458"></a>00458 <span class="keywordflow">return</span> NULL;
347
<a name="l00459"></a>00459 <span class="keywordflow">return</span> <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(topology, <span class="keyword">set</span>, depth, prev);
348
<a name="l00460"></a>00460 }
349
<a name="l00461"></a>00461
350
<a name="l00474"></a>00474 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
351
<a name="l00475"></a><a class="code" href="a00050.html#gae744419648117cbd613a038074aa0627">00475</a> <a class="code" href="a00050.html#gae744419648117cbd613a038074aa0627" title="Get the first cache covering a cpuset set.">hwloc_get_cache_covering_cpuset</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <span class="keyword">set</span>)
352
<a name="l00476"></a>00476 {
353
<a name="l00477"></a>00477 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> current = <a class="code" href="a00048.html#ga2a0de36ea0c3c70fb5f4cba0bb192582" title="Get the lowest object covering at least CPU set set.">hwloc_get_obj_covering_cpuset</a>(topology, <span class="keyword">set</span>);
354
<a name="l00478"></a>00478 <span class="keywordflow">while</span> (current) {
355
<a name="l00479"></a>00479 <span class="keywordflow">if</span> (current-><a class="code" href="a00012.html#acc4f0803f244867e68fe0036800be5de" title="Type of object.">type</a> == <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55a56ee0b7eca88f363b75b34fdde8c9ddc" title="Data cache. Can be L1, L2, L3, ...">HWLOC_OBJ_CACHE</a>)
356
<a name="l00480"></a>00480 <span class="keywordflow">return</span> current;
357
<a name="l00481"></a>00481 current = current-><a class="code" href="a00012.html#adc494f6aed939992be1c55cca5822900" title="Parent, NULL if root (system object)">parent</a>;
358
<a name="l00482"></a>00482 }
359
<a name="l00483"></a>00483 <span class="keywordflow">return</span> NULL;
360
<a name="l00484"></a>00484 }
361
<a name="l00485"></a>00485
362
<a name="l00490"></a>00490 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
363
<a name="l00491"></a><a class="code" href="a00050.html#ga75e961873d4b976ab10bc4739248c96d">00491</a> <a class="code" href="a00050.html#ga75e961873d4b976ab10bc4739248c96d" title="Get the first cache shared between an object and somebody else.">hwloc_get_shared_cache_covering_obj</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology , <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj)
364
<a name="l00492"></a>00492 {
365
<a name="l00493"></a>00493 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> current = obj-><a class="code" href="a00012.html#adc494f6aed939992be1c55cca5822900" title="Parent, NULL if root (system object)">parent</a>;
366
<a name="l00494"></a>00494 <span class="keywordflow">while</span> (current) {
367
<a name="l00495"></a>00495 <span class="keywordflow">if</span> (!<a class="code" href="a00056.html#ga4dd6a75ab63d33ef33bd626b0e489388" title="Test whether bitmap bitmap1 is equal to bitmap bitmap2.">hwloc_bitmap_isequal</a>(current-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>)
368
<a name="l00496"></a>00496 && current-><a class="code" href="a00012.html#acc4f0803f244867e68fe0036800be5de" title="Type of object.">type</a> == <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55a56ee0b7eca88f363b75b34fdde8c9ddc" title="Data cache. Can be L1, L2, L3, ...">HWLOC_OBJ_CACHE</a>)
369
<a name="l00497"></a>00497 <span class="keywordflow">return</span> current;
370
<a name="l00498"></a>00498 current = current-><a class="code" href="a00012.html#adc494f6aed939992be1c55cca5822900" title="Parent, NULL if root (system object)">parent</a>;
371
<a name="l00499"></a>00499 }
372
<a name="l00500"></a>00500 <span class="keywordflow">return</span> NULL;
373
<a name="l00501"></a>00501 }
374
<a name="l00502"></a>00502
375
<a name="l00518"></a>00518 <span class="comment">/* TODO: rather provide an iterator? Provide a way to know how much should be allocated? By returning the total number of objects instead? */</span>
376
<a name="l00519"></a>00519 <span class="keywordtype">unsigned</span> <a class="code" href="a00051.html#ga26c2ac4f25b1ed293249c88e232f1bea" title="Do a depth-first traversal of the topology to find and sort.">hwloc_get_closest_objs</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> src, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> * restrict objs, <span class="keywordtype">unsigned</span> max);
377
<a name="l00520"></a>00520
378
<a name="l00531"></a>00531 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
379
<a name="l00532"></a><a class="code" href="a00051.html#ga3d32c128aa36b5c9d56f6bf9e70d0e78">00532</a> <a class="code" href="a00051.html#ga3d32c128aa36b5c9d56f6bf9e70d0e78" title="Find an object below another object, both specified by types and indexes.">hwloc_get_obj_below_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology,
380
<a name="l00533"></a>00533 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type1, <span class="keywordtype">unsigned</span> idx1,
381
<a name="l00534"></a>00534 <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> type2, <span class="keywordtype">unsigned</span> idx2)
382
<a name="l00535"></a>00535 {
383
<a name="l00536"></a>00536 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
384
<a name="l00537"></a>00537
385
<a name="l00538"></a>00538 obj = <a class="code" href="a00041.html#ga701f83b2cf0cb8e0acd58cd2dc1c67a2" title="Returns the topology object at index index with type type.">hwloc_get_obj_by_type</a> (topology, type1, idx1);
386
<a name="l00539"></a>00539 <span class="keywordflow">if</span> (!obj)
387
<a name="l00540"></a>00540 <span class="keywordflow">return</span> NULL;
388
<a name="l00541"></a>00541
389
<a name="l00542"></a>00542 <span class="keywordflow">return</span> <a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b" title="Return the idx -th object of type type included in CPU set set.">hwloc_get_obj_inside_cpuset_by_type</a>(topology, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, type2, idx2);
390
<a name="l00543"></a>00543 }
391
<a name="l00544"></a>00544
392
<a name="l00560"></a>00560 <span class="keyword">static</span> inline <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a>
393
<a name="l00561"></a><a class="code" href="a00051.html#ga340bb7021204078c30382ea77d38bde9">00561</a> <a class="code" href="a00051.html#ga340bb7021204078c30382ea77d38bde9" title="Find an object below a chain of objects specified by types and indexes.">hwloc_get_obj_below_array_by_type</a> (<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <span class="keywordtype">int</span> nr, <a class="code" href="a00035.html#gacd37bb612667dc437d66bfb175a8dc55" title="Type of topology object.">hwloc_obj_type_t</a> *typev, <span class="keywordtype">unsigned</span> *idxv)
394
<a name="l00562"></a>00562 {
395
<a name="l00563"></a>00563 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj = <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology);
396
<a name="l00564"></a>00564 <span class="keywordtype">int</span> i;
397
<a name="l00565"></a>00565
398
<a name="l00566"></a>00566 <span class="keywordflow">for</span>(i=0; i<nr; i++) {
399
<a name="l00567"></a>00567 obj = <a class="code" href="a00047.html#ga50a80a0021e5843d968c3b97aebaad9b" title="Return the idx -th object of type type included in CPU set set.">hwloc_get_obj_inside_cpuset_by_type</a>(topology, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, typev[i], idxv[i]);
400
<a name="l00568"></a>00568 <span class="keywordflow">if</span> (!obj)
401
<a name="l00569"></a>00569 <span class="keywordflow">return</span> NULL;
402
<a name="l00570"></a>00570 }
403
<a name="l00571"></a>00571
404
<a name="l00572"></a>00572 <span class="keywordflow">return</span> obj;
405
<a name="l00573"></a>00573 }
406
<a name="l00574"></a>00574
398
407
<a name="l00596"></a>00596 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
399
<a name="l00597"></a><a class="code" href="a00052.html#ga6d5c88292ad5aa062c1bebc99369c042">00597</a> <a class="code" href="a00052.html#ga6d5c88292ad5aa062c1bebc99369c042">hwloc_distribute</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> root, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *<a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keywordtype">unsigned</span> n, <span class="keywordtype">unsigned</span> until)
400
<a name="l00598"></a>00598 {
401
<a name="l00599"></a>00599 <span class="keywordtype">unsigned</span> i;
402
<a name="l00600"></a>00600
403
<a name="l00601"></a>00601 <span class="keywordflow">if</span> (!root-><a class="code" href="a00012.html#aac3f6da35c9b57599909a44ce2b716c1" title="Number of children.">arity</a> || n == 1 || root-><a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> >= until) {
404
<a name="l00602"></a>00602 <span class="comment">/* Got to the bottom, we can't split any more, put everything there. */</span>
405
<a name="l00603"></a>00603 <span class="keywordflow">for</span> (i=0; i<n; i++)
406
<a name="l00604"></a>00604 cpuset[i] = <a class="code" href="a00056.html#gaaa4ed76211cd3694dfbea2109fc440be" title="Duplicate bitmap bitmap by allocating a new bitmap and copying bitmap contents.">hwloc_bitmap_dup</a>(root-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
407
<a name="l00605"></a>00605 <span class="keywordflow">return</span>;
408
<a name="l00606"></a>00606 }
409
<a name="l00607"></a>00607
410
<a name="l00608"></a>00608 <a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619" title="Distribute n items over the topology under root.">hwloc_distributev</a>(topology, root-><a class="code" href="a00012.html#a04d05403da37bfe17cd63b7c7dd07b1f" title="Children, children[0 .. arity -1].">children</a>, root-><a class="code" href="a00012.html#aac3f6da35c9b57599909a44ce2b716c1" title="Number of children.">arity</a>, cpuset, n, until);
411
<a name="l00609"></a>00609 }
412
<a name="l00610"></a>00610
413
<a name="l00616"></a>00616 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
414
<a name="l00617"></a><a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619">00617</a> <a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619" title="Distribute n items over the topology under root.">hwloc_distributev</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> *roots, <span class="keywordtype">unsigned</span> n_roots, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *<a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keywordtype">unsigned</span> n, <span class="keywordtype">unsigned</span> until)
415
<a name="l00618"></a>00618 {
416
<a name="l00619"></a>00619 <span class="keywordtype">unsigned</span> i;
417
<a name="l00620"></a>00620 <span class="keywordtype">unsigned</span> tot_weight;
418
<a name="l00621"></a>00621 <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *cpusetp = <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>;
419
<a name="l00622"></a>00622
420
<a name="l00623"></a>00623 tot_weight = 0;
421
<a name="l00624"></a>00624 <span class="keywordflow">for</span> (i = 0; i < n_roots; i++)
422
<a name="l00625"></a>00625 tot_weight += <a class="code" href="a00056.html#ga12d520387be74f849f191d7a06ac325c" title="Compute the &quot;weight&quot; of bitmap bitmap (i.e., number of indexes that are in the bitmap)...">hwloc_bitmap_weight</a>(roots[i]->cpuset);
423
<a name="l00626"></a>00626
424
<a name="l00627"></a>00627 <span class="keywordflow">for</span> (i = 0; i < n_roots; i++) {
425
<a name="l00628"></a>00628 <span class="comment">/* Give to roots[i] a portion proportional to its weight */</span>
426
<a name="l00629"></a>00629 <span class="keywordtype">unsigned</span> weight = <a class="code" href="a00056.html#ga12d520387be74f849f191d7a06ac325c" title="Compute the &quot;weight&quot; of bitmap bitmap (i.e., number of indexes that are in the bitmap)...">hwloc_bitmap_weight</a>(roots[i]->cpuset);
427
<a name="l00630"></a>00630 <span class="keywordtype">unsigned</span> chunk = (n * weight + tot_weight-1) / tot_weight;
428
<a name="l00631"></a>00631 <a class="code" href="a00052.html#ga6d5c88292ad5aa062c1bebc99369c042">hwloc_distribute</a>(topology, roots[i], cpusetp, chunk, until);
429
<a name="l00632"></a>00632 cpusetp += chunk;
430
<a name="l00633"></a>00633 tot_weight -= weight;
431
<a name="l00634"></a>00634 n -= chunk;
432
<a name="l00635"></a>00635 }
433
<a name="l00636"></a>00636 }
434
<a name="l00637"></a>00637
435
<a name="l00644"></a>00644 <span class="keyword">static</span> inline <span class="keywordtype">void</span> *
436
<a name="l00645"></a><a class="code" href="a00052.html#ga3e772fbc4de626ed80f13d332b7d4d03">00645</a> <a class="code" href="a00052.html#ga3e772fbc4de626ed80f13d332b7d4d03" title="Allocate some memory on the given nodeset nodeset.">hwloc_alloc_membind_policy_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <span class="keywordtype">size_t</span> len, <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>, <a class="code" href="a00044.html#gac9764f79505775d06407b40f5e4661e8" title="Memory binding policy.">hwloc_membind_policy_t</a> policy, <span class="keywordtype">int</span> flags)
437
<a name="l00646"></a>00646 {
438
<a name="l00647"></a>00647 <span class="keywordtype">void</span> *p = <a class="code" href="a00044.html#gaeaa00714a9c4319bda0a74ca6f8720e8" title="Allocate some memory on the given nodeset nodeset.">hwloc_alloc_membind_nodeset</a>(topology, len, nodeset, policy, flags);
439
<a name="l00648"></a>00648 <span class="keywordflow">if</span> (p)
440
<a name="l00649"></a>00649 <span class="keywordflow">return</span> p;
441
<a name="l00650"></a>00650 <a class="code" href="a00044.html#ga747962cbb16fd12ad6d126011c734a27" title="Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) spe...">hwloc_set_membind_nodeset</a>(topology, nodeset, policy, flags);
442
<a name="l00651"></a>00651 p = <a class="code" href="a00044.html#gac5586e58cf25c3596b7d4aa31ce13259" title="Allocate some memory.">hwloc_alloc</a>(topology, len);
443
<a name="l00652"></a>00652 <span class="keywordflow">if</span> (p && policy != <a class="code" href="a00044.html#ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0" title="Allocate memory but do not immediately bind it to a specific locality. Instead, each page in the allo...">HWLOC_MEMBIND_FIRSTTOUCH</a>)
444
<a name="l00653"></a>00653 <span class="comment">/* Enforce the binding by touching the data */</span>
445
<a name="l00654"></a>00654 memset(p, 0, len);
446
<a name="l00655"></a>00655 <span class="keywordflow">return</span> p;
447
<a name="l00656"></a>00656 }
448
<a name="l00657"></a>00657
449
<a name="l00662"></a>00662 <span class="keyword">static</span> inline <span class="keywordtype">void</span> *
450
<a name="l00663"></a><a class="code" href="a00052.html#ga6178c6a9ec1dd88ec9f6a9fcdcc7d634">00663</a> <a class="code" href="a00052.html#ga6178c6a9ec1dd88ec9f6a9fcdcc7d634" title="Allocate some memory on the memory nodes near given cpuset cpuset.">hwloc_alloc_membind_policy</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <span class="keywordtype">size_t</span> len, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00044.html#gac9764f79505775d06407b40f5e4661e8" title="Memory binding policy.">hwloc_membind_policy_t</a> policy, <span class="keywordtype">int</span> flags)
451
<a name="l00664"></a>00664 {
452
<a name="l00665"></a>00665 <span class="keywordtype">void</span> *p = <a class="code" href="a00044.html#ga221a7edc5d436300374fa16463f607e5" title="Allocate some memory on memory nodes near the given cpuset cpuset.">hwloc_alloc_membind</a>(topology, len, cpuset, policy, flags);
453
<a name="l00666"></a>00666 <span class="keywordflow">if</span> (p)
454
<a name="l00667"></a>00667 <span class="keywordflow">return</span> p;
455
<a name="l00668"></a>00668 <a class="code" href="a00044.html#ga8b6d1d90227aff8e44ef26bc1f8a8f95" title="Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) nea...">hwloc_set_membind</a>(topology, cpuset, policy, flags);
456
<a name="l00669"></a>00669 p = <a class="code" href="a00044.html#gac5586e58cf25c3596b7d4aa31ce13259" title="Allocate some memory.">hwloc_alloc</a>(topology, len);
457
<a name="l00670"></a>00670 <span class="keywordflow">if</span> (p && policy != <a class="code" href="a00044.html#ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0" title="Allocate memory but do not immediately bind it to a specific locality. Instead, each page in the allo...">HWLOC_MEMBIND_FIRSTTOUCH</a>)
458
<a name="l00671"></a>00671 <span class="comment">/* Enforce the binding by touching the data */</span>
459
<a name="l00672"></a>00672 memset(p, 0, len);
460
<a name="l00673"></a>00673 <span class="keywordflow">return</span> p;
461
<a name="l00674"></a>00674 }
462
<a name="l00675"></a>00675
463
<a name="l00692"></a>00692 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
464
<a name="l00693"></a><a class="code" href="a00053.html#ga75f0ac3ac41e9915541c3ae3153a6e26">00693</a> <a class="code" href="a00053.html#ga75f0ac3ac41e9915541c3ae3153a6e26" title="Get complete CPU set.">hwloc_topology_get_complete_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
465
<a name="l00694"></a>00694 {
466
<a name="l00695"></a>00695 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a91788a9da687beb7224cc1fd7b75208c" title="The complete CPU set of logical processors of this object,.">complete_cpuset</a>;
467
<a name="l00696"></a>00696 }
468
<a name="l00697"></a>00697
469
<a name="l00708"></a>00708 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
470
<a name="l00709"></a><a class="code" href="a00053.html#ga4497338d1cbae6f8a6d68cb14234d5d8">00709</a> <a class="code" href="a00053.html#ga4497338d1cbae6f8a6d68cb14234d5d8" title="Get topology CPU set.">hwloc_topology_get_topology_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
471
<a name="l00710"></a>00710 {
472
<a name="l00711"></a>00711 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>;
473
<a name="l00712"></a>00712 }
474
<a name="l00713"></a>00713
475
<a name="l00723"></a>00723 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
476
<a name="l00724"></a><a class="code" href="a00053.html#gad00abc77f1670049a5b2139471d0c8db">00724</a> <a class="code" href="a00053.html#gad00abc77f1670049a5b2139471d0c8db" title="Get online CPU set.">hwloc_topology_get_online_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
477
<a name="l00725"></a>00725 {
478
<a name="l00726"></a>00726 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a8842d56c2975380f327ea401c5f53564" title="The CPU set of online logical processors.">online_cpuset</a>;
479
<a name="l00727"></a>00727 }
480
<a name="l00728"></a>00728
481
<a name="l00738"></a>00738 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
482
<a name="l00739"></a><a class="code" href="a00053.html#ga95f116c4c0b1ff2c6418c16341fc2e57">00739</a> <a class="code" href="a00053.html#ga95f116c4c0b1ff2c6418c16341fc2e57" title="Get allowed CPU set.">hwloc_topology_get_allowed_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
483
<a name="l00740"></a>00740 {
484
<a name="l00741"></a>00741 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#afa3c59a6dd3da8ffa48710780a1bfb34" title="The CPU set of allowed logical processors.">allowed_cpuset</a>;
485
<a name="l00742"></a>00742 }
486
<a name="l00743"></a>00743
487
<a name="l00760"></a>00760 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a>
488
<a name="l00761"></a><a class="code" href="a00054.html#gaf8331b6d5e60c463f7ebe21a878561d4">00761</a> <a class="code" href="a00054.html#gaf8331b6d5e60c463f7ebe21a878561d4" title="Get complete node set.">hwloc_topology_get_complete_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
489
<a name="l00762"></a>00762 {
490
<a name="l00763"></a>00763 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#ac38c4012127525ef74c5615c526f4c2e" title="The complete NUMA node set of this object,.">complete_nodeset</a>;
491
<a name="l00764"></a>00764 }
492
<a name="l00765"></a>00765
493
<a name="l00776"></a>00776 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a>
494
<a name="l00777"></a><a class="code" href="a00054.html#gae6821ede7676dfac0515a4b7b04b0397">00777</a> <a class="code" href="a00054.html#gae6821ede7676dfac0515a4b7b04b0397" title="Get topology node set.">hwloc_topology_get_topology_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
495
<a name="l00778"></a>00778 {
496
<a name="l00779"></a>00779 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>;
497
<a name="l00780"></a>00780 }
498
<a name="l00781"></a>00781
499
<a name="l00791"></a>00791 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a>
500
<a name="l00792"></a><a class="code" href="a00054.html#ga5d829323f8d283687be43ea8c894eb3b">00792</a> <a class="code" href="a00054.html#ga5d829323f8d283687be43ea8c894eb3b" title="Get allowed node set.">hwloc_topology_get_allowed_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
501
<a name="l00793"></a>00793 {
502
<a name="l00794"></a>00794 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a19e3d0a5951a7510fc4fc4722a9bf531" title="The set of allowed NUMA memory nodes.">allowed_nodeset</a>;
503
<a name="l00795"></a>00795 }
504
<a name="l00796"></a>00796
505
<a name="l00827"></a>00827 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
506
<a name="l00828"></a><a class="code" href="a00055.html#ga60ecc4ae480c28b5fbd34aca4fc37daa">00828</a> <a class="code" href="a00055.html#ga60ecc4ae480c28b5fbd34aca4fc37daa" title="Convert a CPU set into a NUMA node set and handle non-NUMA cases.">hwloc_cpuset_to_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga37e35730fa7e775b5bb0afe893d6d508" title="A node set is a bitmap whose bits are set according to NUMA memory node physical OS indexes...">hwloc_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
507
<a name="l00829"></a>00829 {
508
<a name="l00830"></a>00830 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
509
<a name="l00831"></a>00831 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
510
<a name="l00832"></a>00832
511
<a name="l00833"></a>00833 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a>) {
512
<a name="l00834"></a>00834 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(cpuset))
513
<a name="l00835"></a>00835 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(nodeset);
514
<a name="l00836"></a>00836 <span class="keywordflow">else</span>
515
<a name="l00837"></a>00837 <span class="comment">/* Assume the whole system */</span>
516
<a name="l00838"></a>00838 <a class="code" href="a00056.html#ga52456f7ef79d68e610cb65e3f7ffafad" title="Fill bitmap bitmap with all possible indexes (even if those objects don&#39;t exist or are otherwise ...">hwloc_bitmap_fill</a>(nodeset);
517
<a name="l00839"></a>00839 <span class="keywordflow">return</span>;
518
<a name="l00840"></a>00840 }
519
<a name="l00841"></a>00841
520
<a name="l00842"></a>00842 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(nodeset);
521
<a name="l00843"></a>00843 obj = NULL;
522
<a name="l00844"></a>00844 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(topology, cpuset, depth, obj)) != NULL)
523
<a name="l00845"></a>00845 <a class="code" href="a00056.html#ga497556af0cc34f109ae0277999c074d3" title="Add index id in bitmap bitmap.">hwloc_bitmap_set</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>);
524
<a name="l00846"></a>00846 }
525
<a name="l00847"></a>00847
526
<a name="l00855"></a>00855 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
527
<a name="l00856"></a><a class="code" href="a00055.html#ga9162785e39d7c697f76f99524c4a2fb4">00856</a> <a class="code" href="a00055.html#ga9162785e39d7c697f76f99524c4a2fb4" title="Convert a CPU set into a NUMA node set without handling non-NUMA cases.">hwloc_cpuset_to_nodeset_strict</a>(<span class="keyword">struct</span> hwloc_topology *topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga37e35730fa7e775b5bb0afe893d6d508" title="A node set is a bitmap whose bits are set according to NUMA memory node physical OS indexes...">hwloc_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
528
<a name="l00857"></a>00857 {
529
<a name="l00858"></a>00858 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
530
<a name="l00859"></a>00859 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
531
<a name="l00860"></a>00860 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> )
532
<a name="l00861"></a>00861 <span class="keywordflow">return</span>;
533
<a name="l00862"></a>00862 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(nodeset);
534
<a name="l00863"></a>00863 obj = NULL;
535
<a name="l00864"></a>00864 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(topology, cpuset, depth, obj)) != NULL)
536
<a name="l00865"></a>00865 <a class="code" href="a00056.html#ga497556af0cc34f109ae0277999c074d3" title="Add index id in bitmap bitmap.">hwloc_bitmap_set</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>);
537
<a name="l00866"></a>00866 }
538
<a name="l00867"></a>00867
539
<a name="l00876"></a>00876 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
540
<a name="l00877"></a><a class="code" href="a00055.html#gaa677fd588304b5615de4ea78104adfb5">00877</a> <a class="code" href="a00055.html#gaa677fd588304b5615de4ea78104adfb5" title="Convert a NUMA node set into a CPU set and handle non-NUMA cases.">hwloc_cpuset_from_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
541
<a name="l00878"></a>00878 {
542
<a name="l00879"></a>00879 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
543
<a name="l00880"></a>00880 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
544
<a name="l00881"></a>00881
545
<a name="l00882"></a>00882 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> ) {
546
<a name="l00883"></a>00883 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(nodeset))
547
<a name="l00884"></a>00884 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(cpuset);
548
<a name="l00885"></a>00885 <span class="keywordflow">else</span>
549
<a name="l00886"></a>00886 <span class="comment">/* Assume the whole system */</span>
550
<a name="l00887"></a>00887 <a class="code" href="a00056.html#ga52456f7ef79d68e610cb65e3f7ffafad" title="Fill bitmap bitmap with all possible indexes (even if those objects don&#39;t exist or are otherwise ...">hwloc_bitmap_fill</a>(cpuset);
551
<a name="l00888"></a>00888 <span class="keywordflow">return</span>;
552
<a name="l00889"></a>00889 }
553
<a name="l00890"></a>00890
554
<a name="l00891"></a>00891 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(cpuset);
555
<a name="l00892"></a>00892 obj = NULL;
556
<a name="l00893"></a>00893 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, obj)) != NULL) {
557
<a name="l00894"></a>00894 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#ga2583f44cbdb5fff2ea40efdcf3975d3f" title="Test whether index id is part of bitmap bitmap.">hwloc_bitmap_isset</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>))
558
<a name="l00895"></a>00895 <a class="code" href="a00056.html#ga1ba1de709ee9a7cf5cc8ad2d9a1a81d4" title="Or bitmaps bitmap1 and bitmap2 and store the result in bitmap res.">hwloc_bitmap_or</a>(cpuset, cpuset, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
559
<a name="l00896"></a>00896 }
560
<a name="l00897"></a>00897 }
561
<a name="l00898"></a>00898
562
<a name="l00906"></a>00906 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
563
<a name="l00907"></a><a class="code" href="a00055.html#gaa7c3f39802b00a758c58e024a8119979">00907</a> <a class="code" href="a00055.html#gaa7c3f39802b00a758c58e024a8119979" title="Convert a NUMA node set into a CPU set without handling non-NUMA cases.">hwloc_cpuset_from_nodeset_strict</a>(<span class="keyword">struct</span> hwloc_topology *topology, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
564
<a name="l00908"></a>00908 {
565
<a name="l00909"></a>00909 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
566
<a name="l00910"></a>00910 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
567
<a name="l00911"></a>00911 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> )
568
<a name="l00912"></a>00912 <span class="keywordflow">return</span>;
569
<a name="l00913"></a>00913 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(cpuset);
570
<a name="l00914"></a>00914 obj = NULL;
571
<a name="l00915"></a>00915 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, obj)) != NULL)
572
<a name="l00916"></a>00916 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#ga2583f44cbdb5fff2ea40efdcf3975d3f" title="Test whether index id is part of bitmap bitmap.">hwloc_bitmap_isset</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>))
573
<a name="l00917"></a>00917 <a class="code" href="a00056.html#ga1ba1de709ee9a7cf5cc8ad2d9a1a81d4" title="Or bitmaps bitmap1 and bitmap2 and store the result in bitmap res.">hwloc_bitmap_or</a>(cpuset, cpuset, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
574
<a name="l00918"></a>00918 }
575
<a name="l00919"></a>00919
576
<a name="l00924"></a>00924 <span class="preprocessor">#ifdef __cplusplus</span>
577
<a name="l00925"></a>00925 <span class="preprocessor"></span>} <span class="comment">/* extern "C" */</span>
578
<a name="l00926"></a>00926 <span class="preprocessor">#endif</span>
579
<a name="l00927"></a>00927 <span class="preprocessor"></span>
580
<a name="l00928"></a>00928
581
<a name="l00929"></a>00929 <span class="preprocessor">#endif </span><span class="comment">/* HWLOC_HELPER_H */</span>
408
<a name="l00597"></a>00597 <a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619" title="Distribute n items over the topology under root.">hwloc_distributev</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> *root, <span class="keywordtype">unsigned</span> n_roots, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *<a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keywordtype">unsigned</span> n, <span class="keywordtype">unsigned</span> until);
409
<a name="l00598"></a>00598 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
410
<a name="l00599"></a><a class="code" href="a00052.html#ga6d5c88292ad5aa062c1bebc99369c042">00599</a> <a class="code" href="a00052.html#ga6d5c88292ad5aa062c1bebc99369c042">hwloc_distribute</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> root, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *<a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keywordtype">unsigned</span> n, <span class="keywordtype">unsigned</span> until)
411
<a name="l00600"></a>00600 {
412
<a name="l00601"></a>00601 <span class="keywordtype">unsigned</span> i;
413
<a name="l00602"></a>00602
414
<a name="l00603"></a>00603 <span class="keywordflow">if</span> (!root-><a class="code" href="a00012.html#aac3f6da35c9b57599909a44ce2b716c1" title="Number of children.">arity</a> || n == 1 || root-><a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> >= until) {
415
<a name="l00604"></a>00604 <span class="comment">/* Got to the bottom, we can't split any more, put everything there. */</span>
416
<a name="l00605"></a>00605 <span class="keywordflow">for</span> (i=0; i<n; i++)
417
<a name="l00606"></a>00606 cpuset[i] = <a class="code" href="a00056.html#gaaa4ed76211cd3694dfbea2109fc440be" title="Duplicate bitmap bitmap by allocating a new bitmap and copying bitmap contents.">hwloc_bitmap_dup</a>(root-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
418
<a name="l00607"></a>00607 <span class="keywordflow">return</span>;
419
<a name="l00608"></a>00608 }
420
<a name="l00609"></a>00609
421
<a name="l00610"></a>00610 <a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619" title="Distribute n items over the topology under root.">hwloc_distributev</a>(topology, root-><a class="code" href="a00012.html#a04d05403da37bfe17cd63b7c7dd07b1f" title="Children, children[0 .. arity -1].">children</a>, root-><a class="code" href="a00012.html#aac3f6da35c9b57599909a44ce2b716c1" title="Number of children.">arity</a>, cpuset, n, until);
422
<a name="l00611"></a>00611 }
423
<a name="l00612"></a>00612
424
<a name="l00618"></a>00618 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
425
<a name="l00619"></a><a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619">00619</a> <a class="code" href="a00052.html#gaf057d7c5e3cb3df897ce527258537619" title="Distribute n items over the topology under root.">hwloc_distributev</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> *roots, <span class="keywordtype">unsigned</span> n_roots, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *<a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <span class="keywordtype">unsigned</span> n, <span class="keywordtype">unsigned</span> until)
426
<a name="l00620"></a>00620 {
427
<a name="l00621"></a>00621 <span class="keywordtype">unsigned</span> i;
428
<a name="l00622"></a>00622 <span class="keywordtype">unsigned</span> tot_weight;
429
<a name="l00623"></a>00623 <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> *cpusetp = <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>;
430
<a name="l00624"></a>00624
431
<a name="l00625"></a>00625 tot_weight = 0;
432
<a name="l00626"></a>00626 <span class="keywordflow">for</span> (i = 0; i < n_roots; i++)
433
<a name="l00627"></a>00627 tot_weight += <a class="code" href="a00056.html#ga12d520387be74f849f191d7a06ac325c" title="Compute the &quot;weight&quot; of bitmap bitmap (i.e., number of indexes that are in the bitmap)...">hwloc_bitmap_weight</a>(roots[i]->cpuset);
434
<a name="l00628"></a>00628
435
<a name="l00629"></a>00629 <span class="keywordflow">for</span> (i = 0; i < n_roots; i++) {
436
<a name="l00630"></a>00630 <span class="comment">/* Give to roots[i] a portion proportional to its weight */</span>
437
<a name="l00631"></a>00631 <span class="keywordtype">unsigned</span> weight = <a class="code" href="a00056.html#ga12d520387be74f849f191d7a06ac325c" title="Compute the &quot;weight&quot; of bitmap bitmap (i.e., number of indexes that are in the bitmap)...">hwloc_bitmap_weight</a>(roots[i]->cpuset);
438
<a name="l00632"></a>00632 <span class="keywordtype">unsigned</span> chunk = (n * weight + tot_weight-1) / tot_weight;
439
<a name="l00633"></a>00633 <a class="code" href="a00052.html#ga6d5c88292ad5aa062c1bebc99369c042">hwloc_distribute</a>(topology, roots[i], cpusetp, chunk, until);
440
<a name="l00634"></a>00634 cpusetp += chunk;
441
<a name="l00635"></a>00635 tot_weight -= weight;
442
<a name="l00636"></a>00636 n -= chunk;
443
<a name="l00637"></a>00637 }
444
<a name="l00638"></a>00638 }
445
<a name="l00639"></a>00639
446
<a name="l00646"></a>00646 <span class="keyword">static</span> inline <span class="keywordtype">void</span> *
447
<a name="l00647"></a><a class="code" href="a00052.html#ga3e772fbc4de626ed80f13d332b7d4d03">00647</a> <a class="code" href="a00052.html#ga3e772fbc4de626ed80f13d332b7d4d03" title="Allocate some memory on the given nodeset nodeset.">hwloc_alloc_membind_policy_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <span class="keywordtype">size_t</span> len, <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>, <a class="code" href="a00044.html#gac9764f79505775d06407b40f5e4661e8" title="Memory binding policy.">hwloc_membind_policy_t</a> policy, <span class="keywordtype">int</span> flags)
448
<a name="l00648"></a>00648 {
449
<a name="l00649"></a>00649 <span class="keywordtype">void</span> *p = <a class="code" href="a00044.html#gaeaa00714a9c4319bda0a74ca6f8720e8" title="Allocate some memory on the given nodeset nodeset.">hwloc_alloc_membind_nodeset</a>(topology, len, nodeset, policy, flags);
450
<a name="l00650"></a>00650 <span class="keywordflow">if</span> (p)
451
<a name="l00651"></a>00651 <span class="keywordflow">return</span> p;
452
<a name="l00652"></a>00652 <a class="code" href="a00044.html#ga747962cbb16fd12ad6d126011c734a27" title="Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) spe...">hwloc_set_membind_nodeset</a>(topology, nodeset, policy, flags);
453
<a name="l00653"></a>00653 p = <a class="code" href="a00044.html#gac5586e58cf25c3596b7d4aa31ce13259" title="Allocate some memory.">hwloc_alloc</a>(topology, len);
454
<a name="l00654"></a>00654 <span class="keywordflow">if</span> (p && policy != <a class="code" href="a00044.html#ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0" title="Allocate memory but do not immediately bind it to a specific locality. Instead, each page in the allo...">HWLOC_MEMBIND_FIRSTTOUCH</a>)
455
<a name="l00655"></a>00655 <span class="comment">/* Enforce the binding by touching the data */</span>
456
<a name="l00656"></a>00656 memset(p, 0, len);
457
<a name="l00657"></a>00657 <span class="keywordflow">return</span> p;
458
<a name="l00658"></a>00658 }
459
<a name="l00659"></a>00659
460
<a name="l00664"></a>00664 <span class="keyword">static</span> inline <span class="keywordtype">void</span> *
461
<a name="l00665"></a><a class="code" href="a00052.html#ga6178c6a9ec1dd88ec9f6a9fcdcc7d634">00665</a> <a class="code" href="a00052.html#ga6178c6a9ec1dd88ec9f6a9fcdcc7d634" title="Allocate some memory on the memory nodes near given cpuset cpuset.">hwloc_alloc_membind_policy</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <span class="keywordtype">size_t</span> len, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00044.html#gac9764f79505775d06407b40f5e4661e8" title="Memory binding policy.">hwloc_membind_policy_t</a> policy, <span class="keywordtype">int</span> flags)
462
<a name="l00666"></a>00666 {
463
<a name="l00667"></a>00667 <span class="keywordtype">void</span> *p = <a class="code" href="a00044.html#ga221a7edc5d436300374fa16463f607e5" title="Allocate some memory on memory nodes near the given cpuset cpuset.">hwloc_alloc_membind</a>(topology, len, cpuset, policy, flags);
464
<a name="l00668"></a>00668 <span class="keywordflow">if</span> (p)
465
<a name="l00669"></a>00669 <span class="keywordflow">return</span> p;
466
<a name="l00670"></a>00670 <a class="code" href="a00044.html#ga8b6d1d90227aff8e44ef26bc1f8a8f95" title="Set the default memory binding policy of the current process or thread to prefer the NUMA node(s) nea...">hwloc_set_membind</a>(topology, cpuset, policy, flags);
467
<a name="l00671"></a>00671 p = <a class="code" href="a00044.html#gac5586e58cf25c3596b7d4aa31ce13259" title="Allocate some memory.">hwloc_alloc</a>(topology, len);
468
<a name="l00672"></a>00672 <span class="keywordflow">if</span> (p && policy != <a class="code" href="a00044.html#ggac9764f79505775d06407b40f5e4661e8a979c7aa78dd32780858f30f47a72cca0" title="Allocate memory but do not immediately bind it to a specific locality. Instead, each page in the allo...">HWLOC_MEMBIND_FIRSTTOUCH</a>)
469
<a name="l00673"></a>00673 <span class="comment">/* Enforce the binding by touching the data */</span>
470
<a name="l00674"></a>00674 memset(p, 0, len);
471
<a name="l00675"></a>00675 <span class="keywordflow">return</span> p;
472
<a name="l00676"></a>00676 }
473
<a name="l00677"></a>00677
474
<a name="l00694"></a>00694 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
475
<a name="l00695"></a><a class="code" href="a00053.html#ga75f0ac3ac41e9915541c3ae3153a6e26">00695</a> <a class="code" href="a00053.html#ga75f0ac3ac41e9915541c3ae3153a6e26" title="Get complete CPU set.">hwloc_topology_get_complete_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
476
<a name="l00696"></a>00696 {
477
<a name="l00697"></a>00697 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a91788a9da687beb7224cc1fd7b75208c" title="The complete CPU set of logical processors of this object,.">complete_cpuset</a>;
478
<a name="l00698"></a>00698 }
479
<a name="l00699"></a>00699
480
<a name="l00710"></a>00710 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
481
<a name="l00711"></a><a class="code" href="a00053.html#ga4497338d1cbae6f8a6d68cb14234d5d8">00711</a> <a class="code" href="a00053.html#ga4497338d1cbae6f8a6d68cb14234d5d8" title="Get topology CPU set.">hwloc_topology_get_topology_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
482
<a name="l00712"></a>00712 {
483
<a name="l00713"></a>00713 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>;
484
<a name="l00714"></a>00714 }
485
<a name="l00715"></a>00715
486
<a name="l00725"></a>00725 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
487
<a name="l00726"></a><a class="code" href="a00053.html#gad00abc77f1670049a5b2139471d0c8db">00726</a> <a class="code" href="a00053.html#gad00abc77f1670049a5b2139471d0c8db" title="Get online CPU set.">hwloc_topology_get_online_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
488
<a name="l00727"></a>00727 {
489
<a name="l00728"></a>00728 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a8842d56c2975380f327ea401c5f53564" title="The CPU set of online logical processors.">online_cpuset</a>;
490
<a name="l00729"></a>00729 }
491
<a name="l00730"></a>00730
492
<a name="l00740"></a>00740 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a>
493
<a name="l00741"></a><a class="code" href="a00053.html#ga95f116c4c0b1ff2c6418c16341fc2e57">00741</a> <a class="code" href="a00053.html#ga95f116c4c0b1ff2c6418c16341fc2e57" title="Get allowed CPU set.">hwloc_topology_get_allowed_cpuset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
494
<a name="l00742"></a>00742 {
495
<a name="l00743"></a>00743 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#afa3c59a6dd3da8ffa48710780a1bfb34" title="The CPU set of allowed logical processors.">allowed_cpuset</a>;
496
<a name="l00744"></a>00744 }
497
<a name="l00745"></a>00745
498
<a name="l00762"></a>00762 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a>
499
<a name="l00763"></a><a class="code" href="a00054.html#gaf8331b6d5e60c463f7ebe21a878561d4">00763</a> <a class="code" href="a00054.html#gaf8331b6d5e60c463f7ebe21a878561d4" title="Get complete node set.">hwloc_topology_get_complete_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
500
<a name="l00764"></a>00764 {
501
<a name="l00765"></a>00765 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#ac38c4012127525ef74c5615c526f4c2e" title="The complete NUMA node set of this object,.">complete_nodeset</a>;
502
<a name="l00766"></a>00766 }
503
<a name="l00767"></a>00767
504
<a name="l00778"></a>00778 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a>
505
<a name="l00779"></a><a class="code" href="a00054.html#gae6821ede7676dfac0515a4b7b04b0397">00779</a> <a class="code" href="a00054.html#gae6821ede7676dfac0515a4b7b04b0397" title="Get topology node set.">hwloc_topology_get_topology_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
506
<a name="l00780"></a>00780 {
507
<a name="l00781"></a>00781 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>;
508
<a name="l00782"></a>00782 }
509
<a name="l00783"></a>00783
510
<a name="l00793"></a>00793 <span class="keyword">static</span> inline <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a>
511
<a name="l00794"></a><a class="code" href="a00054.html#ga5d829323f8d283687be43ea8c894eb3b">00794</a> <a class="code" href="a00054.html#ga5d829323f8d283687be43ea8c894eb3b" title="Get allowed node set.">hwloc_topology_get_allowed_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology)
512
<a name="l00795"></a>00795 {
513
<a name="l00796"></a>00796 <span class="keywordflow">return</span> <a class="code" href="a00046.html#ga632edae4a651996895ebde85ea2c1264" title="Returns the top-object of the topology-tree.">hwloc_get_root_obj</a>(topology)-><a class="code" href="a00012.html#a19e3d0a5951a7510fc4fc4722a9bf531" title="The set of allowed NUMA memory nodes.">allowed_nodeset</a>;
514
<a name="l00797"></a>00797 }
515
<a name="l00798"></a>00798
516
<a name="l00829"></a>00829 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
517
<a name="l00830"></a><a class="code" href="a00055.html#ga60ecc4ae480c28b5fbd34aca4fc37daa">00830</a> <a class="code" href="a00055.html#ga60ecc4ae480c28b5fbd34aca4fc37daa" title="Convert a CPU set into a NUMA node set and handle non-NUMA cases.">hwloc_cpuset_to_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga37e35730fa7e775b5bb0afe893d6d508" title="A node set is a bitmap whose bits are set according to NUMA memory node physical OS indexes...">hwloc_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
518
<a name="l00831"></a>00831 {
519
<a name="l00832"></a>00832 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
520
<a name="l00833"></a>00833 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
521
<a name="l00834"></a>00834
522
<a name="l00835"></a>00835 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a>) {
523
<a name="l00836"></a>00836 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(cpuset))
524
<a name="l00837"></a>00837 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(nodeset);
525
<a name="l00838"></a>00838 <span class="keywordflow">else</span>
526
<a name="l00839"></a>00839 <span class="comment">/* Assume the whole system */</span>
527
<a name="l00840"></a>00840 <a class="code" href="a00056.html#ga52456f7ef79d68e610cb65e3f7ffafad" title="Fill bitmap bitmap with all possible indexes (even if those objects don&#39;t exist or are otherwise ...">hwloc_bitmap_fill</a>(nodeset);
528
<a name="l00841"></a>00841 <span class="keywordflow">return</span>;
529
<a name="l00842"></a>00842 }
530
<a name="l00843"></a>00843
531
<a name="l00844"></a>00844 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(nodeset);
532
<a name="l00845"></a>00845 obj = NULL;
533
<a name="l00846"></a>00846 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(topology, cpuset, depth, obj)) != NULL)
534
<a name="l00847"></a>00847 <a class="code" href="a00056.html#ga497556af0cc34f109ae0277999c074d3" title="Add index id in bitmap bitmap.">hwloc_bitmap_set</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>);
535
<a name="l00848"></a>00848 }
536
<a name="l00849"></a>00849
537
<a name="l00857"></a>00857 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
538
<a name="l00858"></a><a class="code" href="a00055.html#ga9162785e39d7c697f76f99524c4a2fb4">00858</a> <a class="code" href="a00055.html#ga9162785e39d7c697f76f99524c4a2fb4" title="Convert a CPU set into a NUMA node set without handling non-NUMA cases.">hwloc_cpuset_to_nodeset_strict</a>(<span class="keyword">struct</span> hwloc_topology *topology, <a class="code" href="a00034.html#ga1f784433e9b606261f62d1134f6a3b25" title="A non-modifiable hwloc_cpuset_t.">hwloc_const_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga37e35730fa7e775b5bb0afe893d6d508" title="A node set is a bitmap whose bits are set according to NUMA memory node physical OS indexes...">hwloc_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
539
<a name="l00859"></a>00859 {
540
<a name="l00860"></a>00860 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
541
<a name="l00861"></a>00861 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
542
<a name="l00862"></a>00862 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> )
543
<a name="l00863"></a>00863 <span class="keywordflow">return</span>;
544
<a name="l00864"></a>00864 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(nodeset);
545
<a name="l00865"></a>00865 obj = NULL;
546
<a name="l00866"></a>00866 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00049.html#ga2f9a4ec15e9cfae8c21501257a51ce5b" title="Iterate through same-depth objects covering at least CPU set set.">hwloc_get_next_obj_covering_cpuset_by_depth</a>(topology, cpuset, depth, obj)) != NULL)
547
<a name="l00867"></a>00867 <a class="code" href="a00056.html#ga497556af0cc34f109ae0277999c074d3" title="Add index id in bitmap bitmap.">hwloc_bitmap_set</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>);
548
<a name="l00868"></a>00868 }
549
<a name="l00869"></a>00869
550
<a name="l00878"></a>00878 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
551
<a name="l00879"></a><a class="code" href="a00055.html#gaa677fd588304b5615de4ea78104adfb5">00879</a> <a class="code" href="a00055.html#gaa677fd588304b5615de4ea78104adfb5" title="Convert a NUMA node set into a CPU set and handle non-NUMA cases.">hwloc_cpuset_from_nodeset</a>(<a class="code" href="a00033.html#ga9d1e76ee15a7dee158b786c30b6a6e38" title="Topology context.">hwloc_topology_t</a> topology, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
552
<a name="l00880"></a>00880 {
553
<a name="l00881"></a>00881 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
554
<a name="l00882"></a>00882 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
555
<a name="l00883"></a>00883
556
<a name="l00884"></a>00884 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> ) {
557
<a name="l00885"></a>00885 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#gaa94fed35d2a598bc4a8657b6955b7bf5" title="Test whether bitmap bitmap is empty.">hwloc_bitmap_iszero</a>(nodeset))
558
<a name="l00886"></a>00886 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(cpuset);
559
<a name="l00887"></a>00887 <span class="keywordflow">else</span>
560
<a name="l00888"></a>00888 <span class="comment">/* Assume the whole system */</span>
561
<a name="l00889"></a>00889 <a class="code" href="a00056.html#ga52456f7ef79d68e610cb65e3f7ffafad" title="Fill bitmap bitmap with all possible indexes (even if those objects don&#39;t exist or are otherwise ...">hwloc_bitmap_fill</a>(cpuset);
562
<a name="l00890"></a>00890 <span class="keywordflow">return</span>;
563
<a name="l00891"></a>00891 }
564
<a name="l00892"></a>00892
565
<a name="l00893"></a>00893 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(cpuset);
566
<a name="l00894"></a>00894 obj = NULL;
567
<a name="l00895"></a>00895 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, obj)) != NULL) {
568
<a name="l00896"></a>00896 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#ga2583f44cbdb5fff2ea40efdcf3975d3f" title="Test whether index id is part of bitmap bitmap.">hwloc_bitmap_isset</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>))
569
<a name="l00897"></a>00897 <a class="code" href="a00056.html#ga1ba1de709ee9a7cf5cc8ad2d9a1a81d4" title="Or bitmaps bitmap1 and bitmap2 and store the result in bitmap res.">hwloc_bitmap_or</a>(cpuset, cpuset, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
570
<a name="l00898"></a>00898 }
571
<a name="l00899"></a>00899 }
572
<a name="l00900"></a>00900
573
<a name="l00908"></a>00908 <span class="keyword">static</span> inline <span class="keywordtype">void</span>
574
<a name="l00909"></a><a class="code" href="a00055.html#gaa7c3f39802b00a758c58e024a8119979">00909</a> <a class="code" href="a00055.html#gaa7c3f39802b00a758c58e024a8119979" title="Convert a NUMA node set into a CPU set without handling non-NUMA cases.">hwloc_cpuset_from_nodeset_strict</a>(<span class="keyword">struct</span> hwloc_topology *topology, <a class="code" href="a00034.html#ga4bbf39b68b6f568fb92739e7c0ea7801" title="A CPU set is a bitmap whose bits are set according to CPU physical OS indexes.">hwloc_cpuset_t</a> <a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>, <a class="code" href="a00034.html#ga2f5276235841ad66a79bedad16a5a10c" title="A non-modifiable hwloc_nodeset_t.">hwloc_const_nodeset_t</a> <a class="code" href="a00012.html#a08f0d0e16c619a6e653526cbee4ffea3" title="NUMA nodes covered by this object or containing this object.">nodeset</a>)
575
<a name="l00910"></a>00910 {
576
<a name="l00911"></a>00911 <span class="keywordtype">int</span> <a class="code" href="a00012.html#a9d82690370275d42d652eccdea5d3ee5" title="Vertical index in the hierarchy.">depth</a> = <a class="code" href="a00040.html#gaea7c64dd59467f5201ba87712710b14d" title="Returns the depth of objects of type type.">hwloc_get_type_depth</a>(topology, <a class="code" href="a00035.html#ggacd37bb612667dc437d66bfb175a8dc55aaf0964881117bdedf1a5e9332cd120dd" title="NUMA node. A set of processors around memory which the processors can directly access.">HWLOC_OBJ_NODE</a>);
577
<a name="l00912"></a>00912 <a class="code" href="a00012.html" title="Structure of a topology object.">hwloc_obj_t</a> obj;
578
<a name="l00913"></a>00913 <span class="keywordflow">if</span> (depth == <a class="code" href="a00040.html#ggaf4e663cf42bbe20756b849c6293ef575a0565ab92ab72cb0cec91e23003294aad" title="No object of given type exists in the topology.">HWLOC_TYPE_DEPTH_UNKNOWN</a> )
579
<a name="l00914"></a>00914 <span class="keywordflow">return</span>;
580
<a name="l00915"></a>00915 <a class="code" href="a00056.html#ga6c540b9fe63b8223b6aba46d56dd63b8" title="Empty the bitmap bitmap.">hwloc_bitmap_zero</a>(cpuset);
581
<a name="l00916"></a>00916 obj = NULL;
582
<a name="l00917"></a>00917 <span class="keywordflow">while</span> ((obj = <a class="code" href="a00046.html#gab7c1dce3f42ece5bfa621e87cf332418" title="Returns the next object at depth depth.">hwloc_get_next_obj_by_depth</a>(topology, depth, obj)) != NULL)
583
<a name="l00918"></a>00918 <span class="keywordflow">if</span> (<a class="code" href="a00056.html#ga2583f44cbdb5fff2ea40efdcf3975d3f" title="Test whether index id is part of bitmap bitmap.">hwloc_bitmap_isset</a>(nodeset, obj-><a class="code" href="a00012.html#a61a7a80a68eaccbaaa28269e678c81a9" title="OS-provided physical index number.">os_index</a>))
584
<a name="l00919"></a>00919 <a class="code" href="a00056.html#ga1ba1de709ee9a7cf5cc8ad2d9a1a81d4" title="Or bitmaps bitmap1 and bitmap2 and store the result in bitmap res.">hwloc_bitmap_or</a>(cpuset, cpuset, obj-><a class="code" href="a00012.html#a67925e0f2c47f50408fbdb9bddd0790f" title="CPUs covered by this object.">cpuset</a>);
585
<a name="l00920"></a>00920 }
586
<a name="l00921"></a>00921
587
<a name="l00926"></a>00926 <span class="preprocessor">#ifdef __cplusplus</span>
588
<a name="l00927"></a>00927 <span class="preprocessor"></span>} <span class="comment">/* extern "C" */</span>
589
<a name="l00928"></a>00928 <span class="preprocessor">#endif</span>
590
<a name="l00929"></a>00929 <span class="preprocessor"></span>
591
<a name="l00930"></a>00930
592
<a name="l00931"></a>00931 <span class="preprocessor">#endif </span><span class="comment">/* HWLOC_HELPER_H */</span>
582
593
</pre></div></div>
584
<hr class="footer"/><address class="footer"><small>Generated on Mon Jan 24 2011 17:12:07 for Hardware Locality (hwloc) by 
595
<hr class="footer"/><address class="footer"><small>Generated on Wed Apr 6 2011 17:31:40 for Hardware Locality (hwloc) by 
585
596
<a href="http://www.doxygen.org/index.html">
586
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.2 </small></address>
597
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.3 </small></address>