hwloc-annotate.1 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. .\" -*- nroff -*-
  2. .\" Copyright © 2013-2022 Inria. All rights reserved.
  3. .\" See COPYING in top-level directory.
  4. .TH HWLOC-ANNOTATE "1" "Sep 07, 2023" "2.9.3" "hwloc"
  5. .SH NAME
  6. hwloc-annotate \- Modify attributes in a XML topology
  7. .
  8. .\" **************************
  9. .\" Synopsis Section
  10. .\" **************************
  11. .SH SYNOPSIS
  12. .B hwloc-annotate
  13. [\fIoptions\fR]
  14. \fI<input.xml>\fR
  15. \fI<output.xml>\fR
  16. -- \fI<location1>\fR \fI<location2>\fR ... --
  17. \fI<mode>\fR
  18. \fI<annotation>\fR
  19. .
  20. .B hwloc-annotate
  21. [\fIoptions\fR]
  22. \fI<input.xml>\fR
  23. \fI<output.xml>\fR
  24. \fI<location>\fR
  25. \fI<mode>\fR
  26. \fI<annotation>\fR
  27. .
  28. .PP
  29. Note that hwloc(7) provides a detailed explanation of the hwloc system
  30. and of valid <location> formats;
  31. it should be read before reading this man page.
  32. .\" **************************
  33. .\" Options Section
  34. .\" **************************
  35. .SH OPTIONS
  36. .
  37. .TP 10
  38. \fB\-\-ri\fR
  39. Remove all info attributes that exist with the same name before adding the new one.
  40. This option is only accepted in "info" mode.
  41. If the info value is omitted, existing infos are replaced with nothing.
  42. .TP
  43. \fB\-\-ci\fR
  44. Clear the existing info attributes in the target objects before annotating.
  45. If no new annotation has to be added after clearing, \fImode\fR should be
  46. set to \fInone\fR.
  47. .TP
  48. \fB\-\-cu\fR
  49. Clear the existing userdata from the target objects.
  50. If nothing else has to be performed after clearing, \fImode\fR should be
  51. set to \fInone\fR.
  52. .
  53. .TP
  54. \fB\-\-cd\fR
  55. Clear the existing distances from the topology.
  56. If nothing else has to be performed after clearing, \fImode\fR should be
  57. set to \fInone\fR.
  58. .TP
  59. \fB\-\-version\fR
  60. Report version and exit.
  61. .TP
  62. \fB\-h\fR \fB\-\-help\fR
  63. Display help message and exit.
  64. .
  65. .\" **************************
  66. .\" Description Section
  67. .\" **************************
  68. .SH DESCRIPTION
  69. .
  70. hwloc-annotate loads a topology from a XML file, adds some annotations,
  71. and export the resulting topology to another XML file.
  72. The input and output files may be the same.
  73. .
  74. .PP
  75. The annotation may be string info attributes.
  76. This is specified by the \fImode\fR:
  77. .
  78. .TP
  79. .B info <name> <value>
  80. Specifies a new string info attribute whose name is \fIname\fR and
  81. value is \fIvalue\fR.
  82. .TP
  83. .B subtype <subtype>
  84. Specifies that the subtype attribute of the object should now be \fIsubtype\fR.
  85. If an empty string is given, the subtype is removed.
  86. .TP
  87. .B size <size>
  88. Specifies the size of a cache or NUMA node.
  89. The value may be suffixed with \fBkB\fR, \fBKiB\fR, \fBMB\fR, \fBMiB\fR,
  90. \fBGB\fR, \fBGiB\fR, etc.
  91. .TP
  92. .B misc <name>
  93. Specifies a new Misc object name.
  94. .TP
  95. .B memattr <name> <flags>
  96. Register a new memory attribute whose name is \fIname\fR and
  97. flags is \fIflags\fR.
  98. \fIlocation\fR is ignored in this mode.
  99. Flags may be given as numeric values or as a comma-separated list of flag names
  100. that are passed to \fIhwloc_memattr_register()\fR.
  101. Those names may be substrings of actual flag names as long as a single one matches.
  102. For instance, a value of \fB1\fR (or \fBhigher\fR) means that
  103. highest values are considered best for this attribute.
  104. .TP
  105. .B memattr <name> <initiator> <value>
  106. Set the memory attribute (whose name is \fIname\fR)
  107. from initiator \fIinitiator\fR (either an object or a CPU-set)
  108. to target NUMA node \fIlocation\fR
  109. to value \fIvalue\fR.
  110. If this attribute does not require specific initiators,
  111. \fIinitiator\fR is ignored.
  112. Standard attribute names are \fICapacity\fR, \fILocality\fR,
  113. \fIBandwidth\fR, and \fILatency\fR.
  114. All existing attributes in the input topology may be listed with
  115. $ lstopo --memattrs -i input.xml
  116. .TP
  117. .B cpukind <cpuset> <efficiency> <flags> [<infoname> <infovalue>]
  118. Specifies the kind of CPU for PUs listed in the given cpuset.
  119. \fIlocation\fR is ignored in this mode.
  120. \fIefficiency\fR is an abstracted efficiency value that will enforce
  121. ranking of kinds. It should be -1 if unknown.
  122. \fIflags\fR must be 0 for now.
  123. If \fIinfoname\fR and \fIinfovalue\fR are given and non-empty,
  124. they are added as info attributes to this kind of CPU.
  125. See the function hwloc_cpukinds_register() for details.
  126. .TP
  127. .B distances <filename> [<flags>]
  128. Specifies new distances to be added to the topology using specifications in \fI<filename>\fR.
  129. The optional \fIflags\fR (0 unless specified) corresponds to the flags
  130. given to the function \fBhwloc_distances_set()\fR.
  131. \fIlocation\fR is ignored in this mode.
  132. The real first line of the pointed file must be a integer representing
  133. a distances \fBkind\fR as defined in \fBhwloc/distances.h\fR.
  134. The second line is the number of objects involved in the distances.
  135. The next lines contain one object each.
  136. The next lines contain one distance value each,
  137. or a single line may be given with a integer combination of format \fBx*y\fR or \fBx*y*z\fR.
  138. An optional line before all others may start with \fBname=\fR
  139. to specify the name of the distances structure if any.
  140. .TP
  141. .B distances-transform <name> links
  142. Transform a bandwidth distances structure named <name> into links.
  143. See the documentation of HWLOC_DISTANCES_TRANSFORM_LINKS in hwloc/distances.h for details.
  144. .TP
  145. .B distances-transform <name> merge-switch-ports
  146. When switches appear in the matrix as different ports, merge all of them
  147. into a single port for clarity.
  148. This currently only applies to the NVLinkBandwidth matrix between NVIDIA GPUs.
  149. See the documentation of HWLOC_DISTANCES_TRANSFORM_MERGE_SWITCH_PORTS in hwloc/distances.h for details.
  150. .TP
  151. .B distances-transform <name> transitive-closure
  152. If objects are connected across a switch, apply a transitive-closure
  153. to report the bandwidth through that switch.
  154. This currently only applies to the NVLinkBandwidth matrix between NVIDIA GPUs.
  155. The bandwidth between all pairs of GPUs will be exposed instead of
  156. bandwidths between single GPUs and single NVSwitch ports.
  157. See the documentation of HWLOC_DISTANCES_TRANSFORM_TRANSITIVE_CLOSURE in hwloc/distances.h for details.
  158. .TP
  159. .B distances-transform <name> remove-obj <obj>
  160. Remove the given object from the distances structure named <name>.
  161. .TP
  162. .B distances-transform <name> replace-objs <oldtype> <newtype>
  163. Replace objects of type <oldtype> in distances structure named <name>
  164. with objects of type <newtype> with same locality.
  165. If <oldtype> or <newtype> are not object types, they are assumed
  166. subtypes of OS devices, e.g. "NVML" or "OpenCL".
  167. See the documentation of hwloc_get_obj_with_same_locality() in hwloc/helper.h for details.
  168. If <newtype> is "NULL", objects are removed from the distances structure.
  169. .TP
  170. .B none
  171. No new annotation is added. This is useful when clearing existing attributes.
  172. .
  173. .PP
  174. Annotations may be added to one specific object in the topology,
  175. all of them, or all of a given type.
  176. This is specified by the \fIlocation\fR (see also EXAMPLES below).
  177. Multiple locations may be affected if they are specified between \fB--\fR.
  178. Objects may be specified as location tuples, as explained in hwloc(7).
  179. However hexadecimal bitmasks are not accepted since they may correspond to multiple objects.
  180. .
  181. .PP
  182. .B NOTE:
  183. The existing annotations may be listed with hwloc-info.
  184. .PP
  185. .B NOTE:
  186. It is highly recommended that you read the hwloc(7) overview page
  187. before reading this man page. Most of the concepts described in
  188. hwloc(7) directly apply to the hwloc-annotate utility.
  189. .
  190. .\" **************************
  191. .\" Examples Section
  192. .\" **************************
  193. .SH EXAMPLES
  194. .PP
  195. hwloc-annotate's operation is best described through several examples.
  196. .
  197. .PP
  198. Add an info attribute to all Core and PU objects:
  199. $ hwloc-annotate input.xml output.xml -- Core:all PU:all -- info infoname infovalue
  200. Only add to all Core objects:
  201. $ hwloc-annotate input.xml output.xml Core:all info infoname infovalue
  202. Add a Misc object named "foobar" under the root object of the topology
  203. and modify the input XML directly:
  204. $ hwloc-annotate file.xml file.xml root misc foobar
  205. Add an info attribute to OS device #2 and #3:
  206. $ hwloc-annotate input.xml output.xml os:2-3 info infoname infovalue
  207. Change package objects to green with red text in the lstopo graphical output:
  208. $ hwloc-annotate topo.xml topo.xml package:all info lstopoStyle "Background=#00ff00;Text=#ff0000"
  209. $ lstopo -i topo.xml
  210. Set the memory attribute latency to 123 nanoseconds from the PUs in the first package to the first NUMA node:
  211. $ hwloc-annotate topo.xml topo.xml numanode:0 memattr Latency $(hwloc-calc package:0) 123
  212. Register a memory attribute \fBMyApplicationPerformance\fR
  213. (with flags specifying that it requires an initiator and reports higher values first)
  214. and set its value for initiator CPU-set 0x11 to NUMA node #2 to 2345:
  215. $ hwloc-annotate topo.xml topo.xml ignored memattr MyApplicationPerformance need_init,higher
  216. $ hwloc-annotate topo.xml topo.xml numanode:2 memattr MyApplicationPerformance 0x11 2345
  217. To clarify that NUMA node #0 is DDR while NUMA node #1 is HBM:
  218. $ hwloc-annotate topo.xml topo.xml numa:0 subtype DDR
  219. $ hwloc-annotate topo.xml topo.xml numa:1 subtype HBM
  220. Specify that PU 0-3 and PU 4-7 are of different kinds, and the latter is more efficient:
  221. $ hwloc-annotate topo.xml topo.xml dummy cpukind 0x0f 0 0 CoreType Small
  222. $ hwloc-annotate topo.xml topo.xml dummy cpukind 0xf0 1 0 CoreType Big
  223. Replace NUMA nodes with Packages in the NUMALatency distances matrix,
  224. when they have the exact same locality.
  225. $ hwloc-annotate topo.xml topo.xml -- dummy -- distances-transform NUMALatency replace-objs numanode packages
  226. Remove NUMA node #3 from the NUMALatency distances matrix:
  227. $ hwloc-annotate topo.xml topo.xml -- dummy -- distances-transform NUMALatency remove-obj numa:3
  228. Merge all NVSwitch ports bandwidth information into a single port in the NVLinkBandwidth matrix:
  229. $ hwloc-annotate topo.xml topo.xml -- dummy -- distances-transform NVLinkBandwidth merge-switch-ports
  230. Apply a transitive closure to get inter-GPU bandwidth across NVSwitches in the NVLinkBandwidth matrix:
  231. $ hwloc-annotate topo.xml topo.xml -- dummy -- distances-transform NVLinkBandwidth transitive-closure
  232. .
  233. .\" **************************
  234. .\" Return value section
  235. .\" **************************
  236. .SH RETURN VALUE
  237. Upon successful execution, hwloc-annotate generates the output topology.
  238. The return value is 0.
  239. .
  240. .PP
  241. hwloc-annotate will return nonzero if any kind of error occurs, such as
  242. (but not limited to) failure to parse the command line.
  243. .
  244. .\" **************************
  245. .\" See also section
  246. .\" **************************
  247. .SH SEE ALSO
  248. .
  249. .ft R
  250. hwloc(7), lstopo(1), hwloc-info(1)
  251. .sp