1HWLOC(7) hwloc HWLOC(7)
2
3
4
6 hwloc - General information about hwloc ("hardware locality").
7
9 hwloc provides command line tools and a C API to obtain the hierarchi‐
10 cal map of key computing elements, such as: NUMA memory nodes, shared
11 caches, processor packages, processor cores, and processor "threads".
12 hwloc also gathers various attributes such as cache and memory informa‐
13 tion, and is portable across a variety of different operating systems
14 and platforms.
15
16 Definitions
17 hwloc has some specific definitions for terms that are used in this man
18 page and other hwloc documentation.
19
20 hwloc CPU set:
21 A set of processors included in an hwloc object, expressed as a
22 bitmask indexed by the physical numbers of the CPUs (as announced
23 by the OS). The hwloc definition of "CPU set" does not carry any
24 the same connotations as Linux's "CPU set" (e.g., process affin‐
25 ity, etc.).
26
27 hwloc node set:
28 A set of NUMA memory nodes near an hwloc object, expressed as a
29 bitmask indexed by the physical numbers of the NUMA nodes (as
30 announced by the OS).
31
32 Linux CPU set:
33 See http://www.mjmwired.net/kernel/Documentation/cpusets.txt for a
34 discussion of Linux CPU sets. A super-short-ignoring-many-details
35 description (taken from that page) is:
36
37 "Cpusets provide a mechanism for assigning a set of CPUs and Mem‐
38 ory Nodes to a set of tasks."
39
40 Linux Cgroup:
41 See http://www.mjmwired.net/kernel/Documentation/cgroups.txt for a
42 discussion of Linux control groups. A super-short-ignoring-many-
43 details description (taken from that page) is:
44
45 "Control Groups provide a mechanism for aggregating/partitioning
46 sets of tasks, and all their future children, into hierarchical
47 groups with specialized behaviour."
48
49 To be clear, hwloc supports all of the above concepts. It is simply
50 worth noting that they are different things.
51
52 Location Specification
53 Locations refer to specific regions within a topology. Before reading
54 the rest of this man page, it may be useful to read lstopo(1) and/or
55 run lstopo on your machine to see the reported topology tree. Seeing
56 and understanding a topology tree will definitely help in understanding
57 the concepts that are discussed below.
58
59 Locations can be specified in multiple ways:
60
61 Tuples: Tuples of hwloc "objects" and associated indexes can be spec‐
62 ified in the form object:index. hwloc objects represent
63 types of mapped items (e.g., packages, cores, etc.) in a
64 topology tree; indexes are non-negative integers that specify
65 a unique physical object in a topology tree. Both concepts
66 are described in detail, below.
67
68 Indexes may also be specified as ranges. x-y enumerates from
69 index x to y. x:y enumerates y objects starting from index x
70 (wrapping around the end of the index range if needed). x-
71 enumerates all objects starting from index x. all, odd, and
72 even are also supported for listing all objects, or only
73 those with odd or even indexes.
74
75 Chaining multiple tuples together in the more general form
76 object1:index[.object2:index2[...]] is permissable. While
77 the first tuple's object may appear anywhere in the topology,
78 the Nth tuple's object must have a shallower topology depth
79 than the (N+1)th tuple's object. Put simply: as you move
80 right in a tuple chain, objects must go deeper in the topol‐
81 ogy tree. When using logical indexes (which is the default),
82 indexes specified in chained tuples are relative to the scope
83 of the parent object. For example, "package:0.core:1" refers
84 to the second core in the first package.
85
86 When using OS/physical indexes, the first object matching the
87 given index is used.
88
89 PCI and OS devices may also be designed using their identi‐
90 fier. For example, "pci=02:03.1" is the PCI device with bus
91 ID "02:03.1". "os=eth0" is the network interface whose soft‐
92 ware name is "eth0".
93
94 Hex: For tools that manipulate object as sets (e.g. hwloc-calc and
95 hwloc-bind), locations can also be specified as hexidecimal
96 bitmasks prefixed with "0x". Commas must be used to separate
97 the hex digits into blocks of 8, such as
98 "0xffc0140,0x00020110". Leading zeros in each block do not
99 need to be specified. For example, "0xffc0140,0x20110" is
100 equivalent to the prior example, and "0x0000000f" is exactly
101 equivalent to "0xf". Intermediate blocks of 8 digits that
102 are all zeoro can be left empty; "0xff0,,0x13" is equivalent
103 to "0xff0,0x00000000,0x13". If the location is prefixed with
104 the special string "0xf...f", then all unspecified bits are
105 set (as if the set were infinite). For example, "0xf...f,0x1"
106 sets both the first bit and all bits starting with the 33rd.
107 The string "0xf...f" -- with no other specified values --
108 sets all bits.
109
110 "all" and "root" are special locations consisting in the root object in
111 tree. It contains the entire current topology.
112
113 Some tools directly operate on these objects (e.g. hwloc-info and
114 hwloc-annotate). They do not support hexadecimal locations because
115 each location may correspond to multiple objects. For instance, there
116 can be exactly one L3 cache per package and NUMA node, which means it's
117 the same location. If multiple locations are given on the command-
118 line, these tools will operation on each location individually and con‐
119 secutively.
120
121 Some other tools internally manipulate objects as sets (e.g. hwloc-calc
122 and hwloc-bind). They translate each input location into a hexidecimal
123 location. When I/O or Misc objects are used, they are translated into
124 the set of processors (or NUMA nodes) that are close to the given
125 object (because I/O or Misc objects do not contain processors or NUMA
126 nodes).
127
128 If multiple locations are specified on the command-line (delimited by
129 whitespace), they are combined (the overall location is wider). If
130 prefixed with "~", the given location will be cleared instead of added
131 to the current list of locations. If prefixed with "x", the given
132 location will be and'ed instead of added to the current list. If pre‐
133 fixed with "^", the given location will be xor'ed.
134
135 More complex operations may be performed by using hwloc-calc to compute
136 intermediate values.
137
138 hwloc Objects
139 Objects in tuples can be any of the following strings (listed from
140 "biggest" to "smallest"):
141
142 machine A set of processors and memory.
143
144 numanode A NUMA node; a set of processors around memory which the pro‐
145 cessors can directly access. If hbm is used instead of
146 numanode in locations, command-line tools only consider high-
147 bandwidth memory nodes such as Intel Xeon Phi MCDRAM.
148
149 package Typically a physical package or chip, that goes into a pack‐
150 age, it is a grouping of one or more processors.
151
152 l1cache ... l5cache
153 A data (or unified) cache.
154
155 l1icache ... l3icache
156 An instruction cache.
157
158 core A single, physical processing unit which may still contain
159 multiple logical processors, such as hardware threads.
160
161 pu Short for processor unit (not process!). The smallest physi‐
162 cal execution unit that hwloc recognizes. For example, there
163 may be multiple PUs on a core (e.g., hardware threads).
164
165 osdev, pcidev, bridge, and misc may also be used to specify special
166 devices although some of them have dedicated identification ways as
167 explained in Location Specification.
168
169 Finally, note that an object can be denoted by its numeric "depth" in
170 the topology graph.
171
172 hwloc Indexes
173 Indexes are integer values that uniquely specify a given object of a
174 specific type. Indexes can be expressed either as logical values or
175 physical values. Most hwloc utilities accept logical indexes by
176 default. Passing --physical switches to physical/OS indexes. Both
177 logical and physical indexes are described on this man page.
178
179 Logical indexes are relative to the object order in the output from the
180 lstopo command. They always start with 0 and increment by 1 for each
181 successive object.
182
183 Physical indexes are how the operating system refers to objects. Note
184 that while physical indexes are non-negative integer values, the hard‐
185 ware and/or operating system may choose arbitrary values -- they may
186 not start with 0, and successive objects may not have consecutive val‐
187 ues.
188
189 For example, if the first few lines of lstopo -p output are the follow‐
190 ing:
191
192 Machine (47GB)
193 NUMANode P#0 (24GB) + Package P#0 + L3 (12MB)
194 L2 (256KB) + L1 (32KB) + Core P#0 + PU P#0
195 L2 (256KB) + L1 (32KB) + Core P#1 + PU P#0
196 L2 (256KB) + L1 (32KB) + Core P#2 + PU P#0
197 L2 (256KB) + L1 (32KB) + Core P#8 + PU P#0
198 L2 (256KB) + L1 (32KB) + Core P#9 + PU P#0
199 L2 (256KB) + L1 (32KB) + Core P#10 + PU P#0
200 NUMANode P#1 (24GB) + Package P#1 + L3 (12MB)
201 L2 (256KB) + L1 (32KB) + Core P#0 + PU P#0
202 L2 (256KB) + L1 (32KB) + Core P#1 + PU P#0
203 L2 (256KB) + L1 (32KB) + Core P#2 + PU P#0
204 L2 (256KB) + L1 (32KB) + Core P#8 + PU P#0
205 L2 (256KB) + L1 (32KB) + Core P#9 + PU P#0
206 L2 (256KB) + L1 (32KB) + Core P#10 + PU P#0
207
208 In this example, the first core on the second package is logically num‐
209 ber 6 (i.e., logically the 7th core, starting from 0). Its physical
210 index is 0, but note that another core also has a physical index of 0.
211 Hence, physical indexes may only be relevant within the scope of their
212 parent (or set of ancestors). In this example, to uniquely identify
213 logical core 6 with physical indexes, you must specify (at a minimum)
214 both a package and a core: package 1, core 0.
215
216 Index values, regardless of whether they are logical or physical, can
217 be expressed in several different forms (where X, Y, and N are positive
218 integers):
219
220 X The object with index value X.
221
222 X-Y All the objects with index values >= X and <= Y.
223
224 X- All the objects with index values >= X.
225
226 X:N N objects starting with index X, possibly wrapping around the
227 end of the level.
228
229 all A special index value indicating all valid index values.
230
231 odd A special index value indicating all valid odd index values.
232
233 even A special index value indicating all valid even index values.
234
235 REMEMBER: hwloc's command line tools accept logical indexes for loca‐
236 tion values by default. Use --physical and --logical to switch from
237 one mode to another.
238
240 hwloc's command line tool documentation: lstopo(1), hwloc-bind(1),
241 hwloc-calc(1), hwloc-distrib(1), hwloc-ps(1).
242
243 hwloc has many C API functions, each of which have their own man page.
244 Some top-level man pages are also provided, grouping similar functions
245 together. A few good places to start might include: hwlocal‐
246 ity_objects(3), hwlocality_types(3), hwlocality_creation(3), hwlocal‐
247 ity_cpuset(3), hwlocality_information(3), and hwlocality_binding(3).
248
249 For a listing of all available hwloc man pages, look at all "hwloc*"
250 files in the man1 and man3 directories.
251
252
253
2542.0.4 Jun 03, 2019 HWLOC(7)