The bitmap api -
The hwloc_bitmap_t type represents a set of objects, typically OS processors -- which may actually be hardware threads (represented by hwloc_cpuset_t, which is a typedef for hwloc_bitmap_t) -- or memory nodes (represented by hwloc_nodeset_t, which is also a typedef for hwloc_bitmap_t).
Both CPU and node sets are always indexed by OS physical number.
Note:
CPU sets and nodesets are described in Object Sets (hwloc_cpuset_t and hwloc_nodeset_t).
A bitmap may be of infinite size.
Note:
Several examples of using the bitmap API are available under the doc/examples/ directory in the source tree. Regression tests such as tests/hwloc_bitmap*.c also make intensive use of this API.
Loop macro iterating on bitmap bitmap. index is the loop variable; it should be an unsigned int. The first iteration will set index to the lowest index in the bitmap. Successive iterations will iterate through, in order, all remaining indexes that in the bitmap. To be specific: each iteration will return a value for index such that hwloc_bitmap_isset(bitmap, index) is true.
The assert prevents the loop from being infinite if the bitmap is infinite.
Value:
} } while (0)
Set of bits represented as an opaque pointer to an internal bitmap.
a non-modifiable hwloc_bitmap_t
Fill the bitmap and clear the index id.
Allocate a new empty bitmap.
Returns:
A valid bitmap or NULL.
The bitmap should be freed by a corresponding call to hwloc_bitmap_free().
Allocate a new full bitmap.
And bitmaps bitmap1 and bitmap2 and store the result in bitmap res. res can be the same as bitmap1 or bitmap2
And bitmap bitmap1 and the negation of bitmap2 and store the result in bitmap res. res can be the same as bitmap1 or bitmap2
Stringify a bitmap into a newly allocated string.
Remove index id from bitmap bitmap.
Remove indexes from begin to end in bitmap bitmap. If end is -1, the range is infinite.
Compare bitmaps bitmap1 and bitmap2 using their highest index. Higher most significant bit is higher. The empty bitmap is considered lower than anything.
Compare bitmaps bitmap1 and bitmap2 using their lowest index. Smaller least significant bit is smaller. The empty bitmap is considered higher than anything.
Copy the contents of bitmap src into the already allocated bitmap dst.
Duplicate bitmap bitmap by allocating a new bitmap and copying bitmap contents. If bitmap is NULL, NULL is returned.
Fill bitmap bitmap with all possible indexes (even if those objects don't exist or are otherwise unavailable)
Compute the first index (least significant bit) in bitmap bitmap.
Returns:
-1 if no index is set.
Free bitmap bitmap. If bitmap is NULL, no operation is performed.
Setup bitmap bitmap from unsigned long mask used as i -th subset.
Setup bitmap bitmap from unsigned long mask.
Test whether bitmaps bitmap1 and bitmap2 intersects.
Test whether bitmap bitmap1 is equal to bitmap bitmap2.
Test whether bitmap bitmap is completely full.
Test whether bitmap sub_bitmap is part of bitmap super_bitmap.
Test whether index id is part of bitmap bitmap.
Test whether bitmap bitmap is empty.
Compute the last index (most significant bit) in bitmap bitmap.
Returns:
-1 if no index is bitmap, or if the index bitmap is infinite.
Stringify a bitmap into a newly allocated list string.
Stringify a bitmap in the list format. Lists are comma-separated indexes or ranges. Ranges are dash separated indexes. The last range may not have a ending indexes if the bitmap is infinite.
Up to buflen characters may be written in buffer buf.
If buflen is 0, buf may safely be NULL.
Returns:
the number of character that were actually written if not truncating, or that would have been written (not including the ending \0).
Parse a list string and stores it in bitmap bitmap.
Compute the next index in bitmap bitmap which is after index prev. If prev is -1, the first index is returned.
Returns:
-1 if no index with higher index is bitmap.
Negate bitmap bitmap and store the result in bitmap res. res can be the same as bitmap
Empty the bitmap bitmap and add bit id.
Or bitmaps bitmap1 and bitmap2 and store the result in bitmap res. res can be the same as bitmap1 or bitmap2
Add index id in bitmap bitmap.
Replace i -th subset of bitmap bitmap with unsigned long mask.
Add indexes from begin to end in bitmap bitmap. If end is -1, the range is infinite.
Keep a single index among those set in bitmap bitmap. May be useful before binding so that the process does not have a chance of migrating between multiple logical CPUs in the original mask.
Stringify a bitmap. Up to buflen characters may be written in buffer buf.
If buflen is 0, buf may safely be NULL.
Returns:
the number of character that were actually written if not truncating, or that would have been written (not including the ending \0).
Parse a bitmap string and stores it in bitmap bitmap.
Stringify a bitmap into a newly allocated taskset-specific string.
Stringify a bitmap in the taskset-specific format. The taskset command manipulates bitmap strings that contain a single (possible very long) hexadecimal number starting with 0x.
Up to buflen characters may be written in buffer buf.
If buflen is 0, buf may safely be NULL.
Returns:
the number of character that were actually written if not truncating, or that would have been written (not including the ending \0).
Parse a taskset-specific bitmap string and stores it in bitmap bitmap.
Convert the i -th subset of bitmap bitmap into unsigned long mask.
Convert the beginning part of bitmap bitmap into unsigned long mask.
Compute the 'weight' of bitmap bitmap (i.e., number of indexes that are in the bitmap).
Returns:
the number of indexes that are in the bitmap.
Xor bitmaps bitmap1 and bitmap2 and store the result in bitmap res. res can be the same as bitmap1 or bitmap2
Empty the bitmap bitmap.
Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code.