1HWLOC-ANNOTATE(1)                    hwloc                   HWLOC-ANNOTATE(1)
2
3
4

NAME

6       hwloc-annotate - Modify attributes in a XML topology
7

SYNOPSIS

9       hwloc-annotate [options] <input.xml> <output.xml> -- <location1> <loca‐
10       tion2> ... -- <mode> <annotation>
11
12       hwloc-annotate [options]  <input.xml>  <output.xml>  <location>  <mode>
13       <annotation>
14
15       Note  that hwloc(7) provides a detailed explanation of the hwloc system
16       and of valid <location> formats; it should be read before reading  this
17       man page.
18

OPTIONS

20       --ri      Remove  all info attributes that exist with the same name be‐
21                 fore adding the new one.  This option  is  only  accepted  in
22                 "info"  mode.   If  the info value is omitted, existing infos
23                 are replaced with nothing.
24
25       --ci      Clear the existing info attributes in the target objects  be‐
26                 fore  annotating.  If no new annotation has to be added after
27                 clearing, mode should be set to none.
28
29       --cu      Clear the existing userdata  from  the  target  objects.   If
30                 nothing  else has to be performed after clearing, mode should
31                 be set to none.
32
33       --cd      Clear the existing distances from the topology.   If  nothing
34                 else  has  to be performed after clearing, mode should be set
35                 to none.
36
37       --version Report version and exit.
38
39       -h --help Display help message and exit.
40

DESCRIPTION

42       hwloc-annotate loads a topology from a XML file, adds some annotations,
43       and  export  the resulting topology to another XML file.  The input and
44       output files may be the same.
45
46       The annotation may be string info attributes.  This is specified by the
47       mode:
48
49       info <name> <value>
50              Specifies  a  new  string  info attribute whose name is name and
51              value is value.
52
53       subtype <subtype>
54              Specifies that the subtype attribute of the object should now be
55              subtype.  If an empty string is given, the subtype is removed.
56
57       size <size>
58              Specifies  the  size  of a cache or NUMA node.  The value may be
59              suffixed with kB, KiB, MB, MiB, GB, GiB, etc.
60
61       misc <name>
62              Specifies a new Misc object name.
63
64       memattr <name> <flags>
65              Register a new memory attribute whose name is name and flags  is
66              flags.  location is ignored in this mode.
67
68              Flags  may  be  given  as numeric values or as a comma-separated
69              list of flag names that are passed to  hwloc_memattr_register().
70              Those  names may be substrings of actual flag names as long as a
71              single one matches.  For instance, a  value  of  1  (or  higher)
72              means  that  highest  values are considered best for this attri‐
73              bute.
74
75       memattr <name> <initiator> <value>
76              Set the memory attribute (whose name  is  name)  from  initiator
77              initiator  (either  an  object or a CPU-set) to target NUMA node
78              location to value value.
79
80              If this attribute does not require specific initiators,  initia‐
81              tor is ignored.
82
83              Standard  attribute names are Capacity, Locality, Bandwidth, and
84              Latency.  All existing attributes in the input topology  may  be
85              listed with
86
87                  $ lstopo --memattrs -i input.xml
88
89
90       cpukind <cpuset> <efficiency> <flags> [<infoname> <infovalue>]
91              Specifies  the  kind  of CPU for PUs listed in the given cpuset.
92              location is ignored in this mode.
93
94              efficiency is an abstracted efficiency value that  will  enforce
95              ranking of kinds. It should be -1 if unknown.
96
97              flags must be 0 for now.
98
99              If  infoname  and  infovalue  are  given and non-empty, they are
100              added as info attributes to this kind of CPU.
101
102              See the function hwloc_cpukinds_register() for details.
103
104
105       distances <filename> [<flags>]
106              Specifies new distances to be added to the topology using speci‐
107              fications  in  <filename>.   The optional flags (0 unless speci‐
108              fied) corresponds to the flags given to the function  hwloc_dis‐
109              tances_set().  location is ignored in this mode.
110
111              The real first line of the pointed file must be a integer repre‐
112              senting a distances kind as defined in  hwloc/distances.h.   The
113              second  line is the number of objects involved in the distances.
114              The next lines contain one object each.  The next lines  contain
115              one  distance  value  each, or a single line may be given with a
116              integer combination of format x*y or x*y*z.   An  optional  line
117              before  all  others  may start with name= to specify the name of
118              the distances structure if any.
119
120
121       distances-transform <name> links
122              Transform a bandwidth  distances  structure  named  <name>  into
123              links.  See the documentation of HWLOC_DISTANCES_TRANSFORM_LINKS
124              in hwloc/distances.h for details.
125
126       distances-transform <name> merge-switch-ports
127              When switches appear in the matrix as different ports, merge all
128              of them into a single port for clarity.  This currently only ap‐
129              plies to the NVLinkBandwidth matrix between  NVIDIA  GPUs.   See
130              the        documentation        of        HWLOC_DISTANCES_TRANS‐
131              FORM_MERGE_SWITCH_PORTS in hwloc/distances.h for details.
132
133       distances-transform <name> transitive-closure
134              If objects are connected across a switch,  apply  a  transitive-
135              closure  to report the bandwidth through that switch.  This cur‐
136              rently only applies to the NVLinkBandwidth matrix between NVIDIA
137              GPUs.   The  bandwidth between all pairs of GPUs will be exposed
138              instead of bandwidths between single GPUs  and  single  NVSwitch
139              ports.  See the documentation of HWLOC_DISTANCES_TRANSFORM_TRAN‐
140              SITIVE_CLOSURE in hwloc/distances.h for details.
141
142       distances-transform <name> remove-obj <obj>
143              Remove the given  object  from  the  distances  structure  named
144              <name>.
145
146       distances-transform <name> replace-objs <oldtype> <newtype>
147              Replace  objects  of type <oldtype> in distances structure named
148              <name> with objects of type <newtype> with  same  locality.   If
149              <oldtype>  or  <newtype>  are not object types, they are assumed
150              subtypes of OS devices, e.g. "NVML" or "OpenCL".  See the  docu‐
151              mentation      of      hwloc_get_obj_with_same_locality()     in
152              hwloc/helper.h for details.
153
154              If <newtype> is "NULL", objects are removed from  the  distances
155              structure.
156
157
158       none   No  new annotation is added. This is useful when clearing exist‐
159              ing attributes.
160
161       Annotations may be added to one specific object in the topology, all of
162       them,  or  all of a given type.  This is specified by the location (see
163       also EXAMPLES below).  Multiple locations may be affected if  they  are
164       specified  between --.  Objects may be specified as location tuples, as
165       explained in hwloc(7).  However hexadecimal bitmasks are  not  accepted
166       since they may correspond to multiple objects.
167
168       NOTE: The existing annotations may be listed with hwloc-info.
169
170       NOTE: It is highly recommended that you read the hwloc(7) overview page
171       before reading this man  page.   Most  of  the  concepts  described  in
172       hwloc(7) directly apply to the hwloc-annotate utility.
173

EXAMPLES

175       hwloc-annotate's operation is best described through several examples.
176
177       Add an info attribute to all Core and PU objects:
178
179           $  hwloc-annotate  input.xml  output.xml -- Core:all PU:all -- info
180       infoname infovalue
181
182       Only add to all Core objects:
183
184           $ hwloc-annotate input.xml output.xml Core:all info infoname  info‐
185       value
186
187       Add  a Misc object named "foobar" under the root object of the topology
188       and modify the input XML directly:
189
190           $ hwloc-annotate file.xml file.xml root misc foobar
191
192       Add an info attribute to OS device #2 and #3:
193
194           $ hwloc-annotate input.xml output.xml os:2-3  info  infoname  info‐
195       value
196
197       Change  package  objects to green with red text in the lstopo graphical
198       output:
199
200           $ hwloc-annotate topo.xml  topo.xml  package:all  info  lstopoStyle
201       "Background=#00ff00;Text=#ff0000"
202           $ lstopo -i topo.xml
203
204       Set the memory attribute latency to 123 nanoseconds from the PUs in the
205       first package to the first NUMA node:
206
207           $  hwloc-annotate  topo.xml  topo.xml  numanode:0  memattr  Latency
208       $(hwloc-calc package:0) 123
209
210       Register a memory attribute MyApplicationPerformance (with flags speci‐
211       fying that it requires an initiator and reports  higher  values  first)
212       and set its value for initiator CPU-set 0x11 to NUMA node #2 to 2345:
213
214           $  hwloc-annotate  topo.xml topo.xml ignored memattr MyApplication‐
215       Performance need_init,higher
216           $ hwloc-annotate topo.xml topo.xml  numanode:2  memattr  MyApplica‐
217       tionPerformance 0x11 2345
218
219       To clarify that NUMA node #0 is DDR while NUMA node #1 is HBM:
220
221           $ hwloc-annotate topo.xml topo.xml numa:0 subtype DDR
222           $ hwloc-annotate topo.xml topo.xml numa:1 subtype HBM
223
224       Specify  that  PU 0-3 and PU 4-7 are of different kinds, and the latter
225       is more efficient:
226
227           $ hwloc-annotate topo.xml topo.xml dummy cpukind 0x0f 0 0  CoreType
228       Small
229           $  hwloc-annotate topo.xml topo.xml dummy cpukind 0xf0 1 0 CoreType
230       Big
231
232       Replace NUMA nodes with Packages in the NUMALatency  distances  matrix,
233       when they have the exact same locality.
234
235           $  hwloc-annotate topo.xml topo.xml -- dummy -- distances-transform
236       NUMALatency replace-objs numanode packages
237
238       Remove NUMA node #3 from the NUMALatency distances matrix:
239
240           $ hwloc-annotate topo.xml topo.xml -- dummy --  distances-transform
241       NUMALatency remove-obj numa:3
242
243       Merge  all  NVSwitch  ports bandwidth information into a single port in
244       the NVLinkBandwidth matrix:
245
246           $ hwloc-annotate topo.xml topo.xml -- dummy --  distances-transform
247       NVLinkBandwidth merge-switch-ports
248
249       Apply a transitive closure to get inter-GPU bandwidth across NVSwitches
250       in the NVLinkBandwidth matrix:
251
252           $ hwloc-annotate topo.xml topo.xml -- dummy --  distances-transform
253       NVLinkBandwidth transitive-closure
254
255

RETURN VALUE

257       Upon  successful  execution, hwloc-annotate generates the output topol‐
258       ogy.  The return value is 0.
259
260       hwloc-annotate will return nonzero if any kind of error occurs, such as
261       (but not limited to) failure to parse the command line.
262

SEE ALSO

264       hwloc(7), lstopo(1), hwloc-info(1)
265
266
267
268
2692.10.0                           Dec 04, 2023                HWLOC-ANNOTATE(1)
Impressum