OpenMPI  0.1.1
bitmap.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2009 CNRS
3  * Copyright © 2009-2011 inria. All rights reserved.
4  * Copyright © 2009-2011 Université Bordeaux 1
5  * Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
6  * See COPYING in top-level directory.
7  */
8 
9 /** \file
10  * \brief The bitmap API, for use in hwloc itself.
11  */
12 
13 #ifndef HWLOC_BITMAP_H
14 #define HWLOC_BITMAP_H
15 
16 #include <hwloc/autogen/config.h>
17 #include <assert.h>
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 
25 /** \defgroup hwlocality_bitmap The bitmap API
26  *
27  * The ::hwloc_bitmap_t type represents a set of objects, typically OS
28  * processors -- which may actually be hardware threads (represented
29  * by ::hwloc_cpuset_t, which is a typedef for ::hwloc_bitmap_t) -- or
30  * memory nodes (represented by ::hwloc_nodeset_t, which is also a
31  * typedef for ::hwloc_bitmap_t).
32  *
33  * <em>Both CPU and node sets are always indexed by OS physical number.</em>
34  *
35  * \note CPU sets and nodesets are described in \ref hwlocality_sets.
36  *
37  * A bitmap may be of infinite size.
38  * @{
39  */
40 
41 
42 /** \brief
43  * Set of bits represented as an opaque pointer to an internal bitmap.
44  */
45 typedef struct hwloc_bitmap_s * hwloc_bitmap_t;
46 /** \brief a non-modifiable ::hwloc_bitmap_t */
47 typedef const struct hwloc_bitmap_s * hwloc_const_bitmap_t;
48 
49 
50 /*
51  * Bitmap allocation, freeing and copying.
52  */
53 
54 /** \brief Allocate a new empty bitmap.
55  *
56  * \returns A valid bitmap or \c NULL.
57  *
58  * The bitmap should be freed by a corresponding call to
59  * hwloc_bitmap_free().
60  */
61 HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc(void) __hwloc_attribute_malloc;
62 
63 /** \brief Allocate a new full bitmap. */
64 HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc_full(void) __hwloc_attribute_malloc;
65 
66 /** \brief Free bitmap \p bitmap.
67  *
68  * If \p bitmap is \c NULL, no operation is performed.
69  */
70 HWLOC_DECLSPEC void hwloc_bitmap_free(hwloc_bitmap_t bitmap);
71 
72 /** \brief Duplicate bitmap \p bitmap by allocating a new bitmap and copying \p bitmap contents.
73  *
74  * If \p bitmap is \c NULL, \c NULL is returned.
75  */
76 HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_dup(hwloc_const_bitmap_t bitmap) __hwloc_attribute_malloc;
77 
78 /** \brief Copy the contents of bitmap \p src into the already allocated bitmap \p dst */
79 HWLOC_DECLSPEC void hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src);
80 
81 
82 /*
83  * Bitmap/String Conversion
84  */
85 
86 /** \brief Stringify a bitmap.
87  *
88  * Up to \p buflen characters may be written in buffer \p buf.
89  *
90  * If \p buflen is 0, \p buf may safely be \c NULL.
91  *
92  * \return the number of character that were actually written if not truncating,
93  * or that would have been written (not including the ending \\0).
94  */
95 HWLOC_DECLSPEC int hwloc_bitmap_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
96 
97 /** \brief Stringify a bitmap into a newly allocated string.
98  */
99 HWLOC_DECLSPEC int hwloc_bitmap_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
100 
101 /** \brief Parse a bitmap string and stores it in bitmap \p bitmap.
102  */
103 HWLOC_DECLSPEC int hwloc_bitmap_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
104 
105 /** \brief Stringify a bitmap in the list format.
106  *
107  * Lists are comma-separated indexes or ranges.
108  * Ranges are dash separated indexes.
109  * The last range may not have a ending indexes if the bitmap is infinite.
110  *
111  * Up to \p buflen characters may be written in buffer \p buf.
112  *
113  * If \p buflen is 0, \p buf may safely be \c NULL.
114  *
115  * \return the number of character that were actually written if not truncating,
116  * or that would have been written (not including the ending \\0).
117  */
118 HWLOC_DECLSPEC int hwloc_bitmap_list_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
119 
120 /** \brief Stringify a bitmap into a newly allocated list string.
121  */
122 HWLOC_DECLSPEC int hwloc_bitmap_list_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
123 
124 /** \brief Parse a list string and stores it in bitmap \p bitmap.
125  */
126 HWLOC_DECLSPEC int hwloc_bitmap_list_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
127 
128 /** \brief Stringify a bitmap in the taskset-specific format.
129  *
130  * The taskset command manipulates bitmap strings that contain a single
131  * (possible very long) hexadecimal number starting with 0x.
132  *
133  * Up to \p buflen characters may be written in buffer \p buf.
134  *
135  * If \p buflen is 0, \p buf may safely be \c NULL.
136  *
137  * \return the number of character that were actually written if not truncating,
138  * or that would have been written (not including the ending \\0).
139  */
140 HWLOC_DECLSPEC int hwloc_bitmap_taskset_snprintf(char * __hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap);
141 
142 /** \brief Stringify a bitmap into a newly allocated taskset-specific string.
143  */
144 HWLOC_DECLSPEC int hwloc_bitmap_taskset_asprintf(char ** strp, hwloc_const_bitmap_t bitmap);
145 
146 /** \brief Parse a taskset-specific bitmap string and stores it in bitmap \p bitmap.
147  */
148 HWLOC_DECLSPEC int hwloc_bitmap_taskset_sscanf(hwloc_bitmap_t bitmap, const char * __hwloc_restrict string);
149 
150 
151 /*
152  * Building bitmaps.
153  */
154 
155 /** \brief Empty the bitmap \p bitmap */
156 HWLOC_DECLSPEC void hwloc_bitmap_zero(hwloc_bitmap_t bitmap);
157 
158 /** \brief Fill bitmap \p bitmap with all possible indexes (even if those objects don't exist or are otherwise unavailable) */
159 HWLOC_DECLSPEC void hwloc_bitmap_fill(hwloc_bitmap_t bitmap);
160 
161 /** \brief Empty the bitmap \p bitmap and add bit \p id */
162 HWLOC_DECLSPEC void hwloc_bitmap_only(hwloc_bitmap_t bitmap, unsigned id);
163 
164 /** \brief Fill the bitmap \p and clear the index \p id */
165 HWLOC_DECLSPEC void hwloc_bitmap_allbut(hwloc_bitmap_t bitmap, unsigned id);
166 
167 /** \brief Setup bitmap \p bitmap from unsigned long \p mask */
168 HWLOC_DECLSPEC void hwloc_bitmap_from_ulong(hwloc_bitmap_t bitmap, unsigned long mask);
169 
170 /** \brief Setup bitmap \p bitmap from unsigned long \p mask used as \p i -th subset */
171 HWLOC_DECLSPEC void hwloc_bitmap_from_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
172 
173 
174 /*
175  * Modifying bitmaps.
176  */
177 
178 /** \brief Add index \p id in bitmap \p bitmap */
179 HWLOC_DECLSPEC void hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id);
180 
181 /** \brief Add indexes from \p begin to \p end in bitmap \p bitmap.
182  *
183  * If \p end is \c -1, the range is infinite.
184  */
185 HWLOC_DECLSPEC void hwloc_bitmap_set_range(hwloc_bitmap_t bitmap, unsigned begin, int end);
186 
187 /** \brief Replace \p i -th subset of bitmap \p bitmap with unsigned long \p mask */
188 HWLOC_DECLSPEC void hwloc_bitmap_set_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask);
189 
190 /** \brief Remove index \p id from bitmap \p bitmap */
191 HWLOC_DECLSPEC void hwloc_bitmap_clr(hwloc_bitmap_t bitmap, unsigned id);
192 
193 /** \brief Remove indexes from \p begin to \p end in bitmap \p bitmap.
194  *
195  * If \p end is \c -1, the range is infinite.
196  */
197 HWLOC_DECLSPEC void hwloc_bitmap_clr_range(hwloc_bitmap_t bitmap, unsigned begin, int end);
198 
199 /** \brief Keep a single index among those set in bitmap \p bitmap
200  *
201  * May be useful before binding so that the process does not
202  * have a chance of migrating between multiple logical CPUs
203  * in the original mask.
204  */
205 HWLOC_DECLSPEC void hwloc_bitmap_singlify(hwloc_bitmap_t bitmap);
206 
207 
208 /*
209  * Consulting bitmaps.
210  */
211 
212 /** \brief Convert the beginning part of bitmap \p bitmap into unsigned long \p mask */
213 HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ulong(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
214 
215 /** \brief Convert the \p i -th subset of bitmap \p bitmap into unsigned long mask */
216 HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ith_ulong(hwloc_const_bitmap_t bitmap, unsigned i) __hwloc_attribute_pure;
217 
218 /** \brief Test whether index \p id is part of bitmap \p bitmap */
219 HWLOC_DECLSPEC int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id) __hwloc_attribute_pure;
220 
221 /** \brief Test whether bitmap \p bitmap is empty */
222 HWLOC_DECLSPEC int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
223 
224 /** \brief Test whether bitmap \p bitmap is completely full */
225 HWLOC_DECLSPEC int hwloc_bitmap_isfull(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
226 
227 /** \brief Compute the first index (least significant bit) in bitmap \p bitmap
228  *
229  * \return -1 if no index is set.
230  */
231 HWLOC_DECLSPEC int hwloc_bitmap_first(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
232 
233 /** \brief Compute the next index in bitmap \p bitmap which is after index \p prev
234  *
235  * If \p prev is -1, the first index is returned.
236  *
237  * \return -1 if no index with higher index is bitmap.
238  */
239 HWLOC_DECLSPEC int hwloc_bitmap_next(hwloc_const_bitmap_t bitmap, int prev) __hwloc_attribute_pure;
240 
241 /** \brief Compute the last index (most significant bit) in bitmap \p bitmap
242  *
243  * \return -1 if no index is bitmap, or if the index bitmap is infinite.
244  */
245 HWLOC_DECLSPEC int hwloc_bitmap_last(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
246 
247 /** \brief Compute the "weight" of bitmap \p bitmap (i.e., number of
248  * indexes that are in the bitmap).
249  *
250  * \return the number of indexes that are in the bitmap.
251  */
252 HWLOC_DECLSPEC int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure;
253 
254 /** \brief Loop macro iterating on bitmap \p bitmap
255  * \hideinitializer
256  *
257  * \p index is the loop variable; it should be an unsigned int. The
258  * first iteration will set \p index to the lowest index in the bitmap.
259  * Successive iterations will iterate through, in order, all remaining
260  * indexes that in the bitmap. To be specific: each iteration will return a
261  * value for \p index such that hwloc_bitmap_isset(bitmap, index) is true.
262  *
263  * The assert prevents the loop from being infinite if the bitmap is infinite.
264  */
265 #define hwloc_bitmap_foreach_begin(id, bitmap) \
266 do { \
267  assert(hwloc_bitmap_weight(bitmap) != -1); \
268  for (id = hwloc_bitmap_first(bitmap); \
269  (unsigned) id != (unsigned) -1; \
270  id = hwloc_bitmap_next(bitmap, id)) { \
271 /** \brief End of loop. Needs a terminating ';'.
272  * \hideinitializer
273  *
274  * \sa hwloc_bitmap_foreach_begin */
275 #define hwloc_bitmap_foreach_end() \
276  } \
277 } while (0)
278 
279 
280 /*
281  * Combining bitmaps.
282  */
283 
284 /** \brief Or bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res */
285 HWLOC_DECLSPEC void hwloc_bitmap_or (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
286 
287 /** \brief And bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res */
288 HWLOC_DECLSPEC void hwloc_bitmap_and (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
289 
290 /** \brief And bitmap \p bitmap1 and the negation of \p bitmap2 and store the result in bitmap \p res */
291 HWLOC_DECLSPEC void hwloc_bitmap_andnot (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
292 
293 /** \brief Xor bitmaps \p bitmap1 and \p bitmap2 and store the result in bitmap \p res */
294 HWLOC_DECLSPEC void hwloc_bitmap_xor (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2);
295 
296 /** \brief Negate bitmap \p bitmap and store the result in bitmap \p res */
297 HWLOC_DECLSPEC void hwloc_bitmap_not (hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap);
298 
299 
300 /*
301  * Comparing bitmaps.
302  */
303 
304 /** \brief Test whether bitmaps \p bitmap1 and \p bitmap2 intersects */
305 HWLOC_DECLSPEC int hwloc_bitmap_intersects (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
306 
307 /** \brief Test whether bitmap \p sub_bitmap is part of bitmap \p super_bitmap */
308 HWLOC_DECLSPEC int hwloc_bitmap_isincluded (hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap) __hwloc_attribute_pure;
309 
310 /** \brief Test whether bitmap \p bitmap1 is equal to bitmap \p bitmap2 */
311 HWLOC_DECLSPEC int hwloc_bitmap_isequal (hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
312 
313 /** \brief Compare bitmaps \p bitmap1 and \p bitmap2 using their lowest index.
314  *
315  * Smaller least significant bit is smaller.
316  * The empty bitmap is considered higher than anything.
317  */
318 HWLOC_DECLSPEC int hwloc_bitmap_compare_first(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
319 
320 /** \brief Compare bitmaps \p bitmap1 and \p bitmap2 using their highest index.
321  *
322  * Higher most significant bit is higher.
323  * The empty bitmap is considered lower than anything.
324  */
325 HWLOC_DECLSPEC int hwloc_bitmap_compare(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure;
326 
327 /** @} */
328 
329 
330 #ifdef __cplusplus
331 } /* extern "C" */
332 #endif
333 
334 
335 #endif /* HWLOC_BITMAP_H */
HWLOC_DECLSPEC void hwloc_bitmap_zero(hwloc_bitmap_t bitmap)
Empty the bitmap bitmap.
HWLOC_DECLSPEC int hwloc_bitmap_first(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure
Compute the first index (least significant bit) in bitmap bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_copy(hwloc_bitmap_t dst, hwloc_const_bitmap_t src)
Copy the contents of bitmap src into the already allocated bitmap dst.
HWLOC_DECLSPEC int hwloc_bitmap_iszero(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure
Test whether bitmap bitmap is empty.
HWLOC_DECLSPEC void hwloc_bitmap_clr_range(hwloc_bitmap_t bitmap, unsigned begin, int end)
Remove indexes from begin to end in bitmap bitmap.
HWLOC_DECLSPEC int hwloc_bitmap_taskset_asprintf(char **strp, hwloc_const_bitmap_t bitmap)
Stringify a bitmap into a newly allocated taskset-specific string.
HWLOC_DECLSPEC int hwloc_bitmap_snprintf(char *__hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap)
Stringify a bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_not(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap)
Negate bitmap bitmap and store the result in bitmap res.
HWLOC_DECLSPEC int hwloc_bitmap_last(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure
Compute the last index (most significant bit) in bitmap bitmap.
struct hwloc_bitmap_s * hwloc_bitmap_t
Set of bits represented as an opaque pointer to an internal bitmap.
Definition: bitmap.h:45
HWLOC_DECLSPEC void hwloc_bitmap_set_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask)
Replace i -th subset of bitmap bitmap with unsigned long mask.
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_dup(hwloc_const_bitmap_t bitmap) __hwloc_attribute_malloc
Duplicate bitmap bitmap by allocating a new bitmap and copying bitmap contents.
HWLOC_DECLSPEC int hwloc_bitmap_taskset_snprintf(char *__hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap)
Stringify a bitmap in the taskset-specific format.
HWLOC_DECLSPEC int hwloc_bitmap_list_asprintf(char **strp, hwloc_const_bitmap_t bitmap)
Stringify a bitmap into a newly allocated list string.
HWLOC_DECLSPEC int hwloc_bitmap_isincluded(hwloc_const_bitmap_t sub_bitmap, hwloc_const_bitmap_t super_bitmap) __hwloc_attribute_pure
Test whether bitmap sub_bitmap is part of bitmap super_bitmap.
HWLOC_DECLSPEC int hwloc_bitmap_compare_first(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure
Compare bitmaps bitmap1 and bitmap2 using their lowest index.
HWLOC_DECLSPEC int hwloc_bitmap_isset(hwloc_const_bitmap_t bitmap, unsigned id) __hwloc_attribute_pure
Test whether index id is part of bitmap bitmap.
HWLOC_DECLSPEC int hwloc_bitmap_sscanf(hwloc_bitmap_t bitmap, const char *__hwloc_restrict string)
Parse a bitmap string and stores it in bitmap bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_singlify(hwloc_bitmap_t bitmap)
Keep a single index among those set in bitmap bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_free(hwloc_bitmap_t bitmap)
Free bitmap bitmap.
HWLOC_DECLSPEC int hwloc_bitmap_taskset_sscanf(hwloc_bitmap_t bitmap, const char *__hwloc_restrict string)
Parse a taskset-specific bitmap string and stores it in bitmap bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_only(hwloc_bitmap_t bitmap, unsigned id)
Empty the bitmap bitmap and add bit id.
const struct hwloc_bitmap_s * hwloc_const_bitmap_t
a non-modifiable hwloc_bitmap_t
Definition: bitmap.h:47
HWLOC_DECLSPEC int hwloc_bitmap_isequal(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure
Test whether bitmap bitmap1 is equal to bitmap bitmap2.
HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ulong(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure
Convert the beginning part of bitmap bitmap into unsigned long mask.
HWLOC_DECLSPEC void hwloc_bitmap_xor(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2)
Xor bitmaps bitmap1 and bitmap2 and store the result in bitmap res.
HWLOC_DECLSPEC int hwloc_bitmap_intersects(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure
Test whether bitmaps bitmap1 and bitmap2 intersects.
HWLOC_DECLSPEC void hwloc_bitmap_and(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2)
And bitmaps bitmap1 and bitmap2 and store the result in bitmap res.
HWLOC_DECLSPEC void hwloc_bitmap_from_ulong(hwloc_bitmap_t bitmap, unsigned long mask)
Setup bitmap bitmap from unsigned long mask.
HWLOC_DECLSPEC int hwloc_bitmap_asprintf(char **strp, hwloc_const_bitmap_t bitmap)
Stringify a bitmap into a newly allocated string.
HWLOC_DECLSPEC unsigned long hwloc_bitmap_to_ith_ulong(hwloc_const_bitmap_t bitmap, unsigned i) __hwloc_attribute_pure
Convert the i -th subset of bitmap bitmap into unsigned long mask.
HWLOC_DECLSPEC void hwloc_bitmap_andnot(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2)
And bitmap bitmap1 and the negation of bitmap2 and store the result in bitmap res.
HWLOC_DECLSPEC int hwloc_bitmap_next(hwloc_const_bitmap_t bitmap, int prev) __hwloc_attribute_pure
Compute the next index in bitmap bitmap which is after index prev.
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc_full(void) __hwloc_attribute_malloc
Allocate a new full bitmap.
Definition: cpuset.c:100
HWLOC_DECLSPEC int hwloc_bitmap_isfull(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure
Test whether bitmap bitmap is completely full.
HWLOC_DECLSPEC void hwloc_bitmap_from_ith_ulong(hwloc_bitmap_t bitmap, unsigned i, unsigned long mask)
Setup bitmap bitmap from unsigned long mask used as i -th subset.
HWLOC_DECLSPEC void hwloc_bitmap_allbut(hwloc_bitmap_t bitmap, unsigned id)
Fill the bitmap and clear the index id.
HWLOC_DECLSPEC int hwloc_bitmap_list_snprintf(char *__hwloc_restrict buf, size_t buflen, hwloc_const_bitmap_t bitmap)
Stringify a bitmap in the list format.
HWLOC_DECLSPEC void hwloc_bitmap_fill(hwloc_bitmap_t bitmap)
Fill bitmap bitmap with all possible indexes (even if those objects don't exist or are otherwise unav...
HWLOC_DECLSPEC int hwloc_bitmap_compare(hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2) __hwloc_attribute_pure
Compare bitmaps bitmap1 and bitmap2 using their highest index.
HWLOC_DECLSPEC void hwloc_bitmap_set(hwloc_bitmap_t bitmap, unsigned id)
Add index id in bitmap bitmap.
HWLOC_DECLSPEC int hwloc_bitmap_list_sscanf(hwloc_bitmap_t bitmap, const char *__hwloc_restrict string)
Parse a list string and stores it in bitmap bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_or(hwloc_bitmap_t res, hwloc_const_bitmap_t bitmap1, hwloc_const_bitmap_t bitmap2)
Or bitmaps bitmap1 and bitmap2 and store the result in bitmap res.
HWLOC_DECLSPEC int hwloc_bitmap_weight(hwloc_const_bitmap_t bitmap) __hwloc_attribute_pure
Compute the "weight" of bitmap bitmap (i.e., number of indexes that are in the bitmap).
HWLOC_DECLSPEC hwloc_bitmap_t hwloc_bitmap_alloc(void) __hwloc_attribute_malloc
Allocate a new empty bitmap.
Definition: cpuset.c:76
Definition: cpuset.c:38
HWLOC_DECLSPEC void hwloc_bitmap_clr(hwloc_bitmap_t bitmap, unsigned id)
Remove index id from bitmap bitmap.
HWLOC_DECLSPEC void hwloc_bitmap_set_range(hwloc_bitmap_t bitmap, unsigned begin, int end)
Add indexes from begin to end in bitmap bitmap.