hwloc-distrib.1 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. .\" -*- nroff -*-
  2. .\" Copyright © 2010-2022 Inria. All rights reserved.
  3. .\" Copyright © 2009-2010 Cisco Systems, Inc. All rights reserved.
  4. .\" See COPYING in top-level directory.
  5. .TH HWLOC-DISTRIB "1" "Sep 07, 2023" "2.9.3" "hwloc"
  6. .SH NAME
  7. hwloc-distrib \- Build a number of cpu masks distributed on the system
  8. .
  9. .\" **************************
  10. .\" Synopsis Section
  11. .\" **************************
  12. .SH SYNOPSIS
  13. .B hwloc-distrib
  14. [\fIoptions\fR] \fI<integer>\fR
  15. .
  16. .\" **************************
  17. .\" Options Section
  18. .\" **************************
  19. .SH OPTIONS
  20. .TP
  21. \fB\-\-single\fR
  22. Singlify each output to a single CPU.
  23. .TP
  24. \fB\-\-taskset\fR
  25. Show CPU set strings in the format recognized by the taskset command-line
  26. program instead of hwloc-specific CPU set string format.
  27. .TP
  28. \fB\-v\fR \fB\-\-verbose\fR
  29. Verbose messages.
  30. .TP
  31. \fB\-i\fR <path>, \fB\-\-input\fR <path>
  32. Read the topology from <path> instead of discovering the topology of the local machine.
  33. If <path> is a file,
  34. it may be a XML file exported by a previous hwloc program.
  35. If <path> is "\-", the standard input may be used as a XML file.
  36. On Linux, <path> may be a directory containing the topology files
  37. gathered from another machine topology with hwloc-gather-topology.
  38. On x86, <path> may be a directory containing a cpuid dump gathered
  39. with hwloc-gather-cpuid.
  40. When the archivemount program is available, <path> may also be a tarball
  41. containing such Linux or x86 topology files.
  42. .TP
  43. \fB\-i\fR <specification>, \fB\-\-input\fR <specification>
  44. Simulate a fake hierarchy (instead of discovering the topology on the
  45. local machine). If <specification> is "node:2 pu:3", the topology will
  46. contain two NUMA nodes with 3 processing units in each of them.
  47. The <specification> string must end with a number of PUs.
  48. .TP
  49. \fB\-\-if\fR <format>, \fB\-\-input\-format\fR <format>
  50. Enforce the input in the given format, among \fBxml\fR, \fBfsroot\fR,
  51. \fBcpuid\fR and \fBsynthetic\fR.
  52. .TP
  53. \fB\-\-ignore\fR <type>
  54. Ignore all objects of type <type> in the topology.
  55. .TP
  56. \fB\-\-from\fR <type>
  57. Distribute starting from objects of the given type instead of from
  58. the top of the topology hierarchy, i.e. ignoring the structure given by objects
  59. above.
  60. <type> cannot be among NUMANode, I/O or Misc types.
  61. .TP
  62. \fB\-\-to\fR <type>
  63. Distribute down to objects of the given type instead of down to the bottom of
  64. the topology hierarchy, i.e. ignoring the structure given by objects below.
  65. This may be useful if some latitude is desired for the binding, e.g. just bind
  66. several processes to each package without specifying a single core for each
  67. of them.
  68. <type> cannot be among NUMANode, I/O or Misc types.
  69. .TP
  70. \fB\-\-at\fR <type>
  71. Distribute among objects of the given type. This is equivalent to specifying
  72. both \fB\-\-from\fR and \fB\-\-to\fR at the same time.
  73. .TP
  74. \fB\-\-reverse\fR
  75. Distribute by starting with the last objects first,
  76. and singlify CPU sets by keeping the last bit (instead of the first bit).
  77. .TP
  78. \fB\-\-restrict\fR <cpuset>
  79. Restrict the topology to the given cpuset.
  80. This removes some PUs and their now-child-less parents.
  81. Beware that restricting the PUs in a topology may change the
  82. logical indexes of many objects, including NUMA nodes.
  83. .TP
  84. \fB\-\-restrict\fR nodeset=<nodeset>
  85. Restrict the topology to the given nodeset
  86. (unless \fB\-\-restrict\-flags\fR specifies something different).
  87. This removes some NUMA nodes and their now-child-less parents.
  88. Beware that restricting the NUMA nodes in a topology may change the
  89. logical indexes of many objects, including PUs.
  90. .TP
  91. \fB\-\-restrict\-flags\fR <flags>
  92. Enforce flags when restricting the topology.
  93. Flags may be given as numeric values or as a comma-separated list of flag names
  94. that are passed to \fIhwloc_topology_restrict()\fR.
  95. Those names may be substrings of actual flag names as long as a single one matches,
  96. for instance \fBbynodeset,memless\fR.
  97. The default is \fB0\fR (or \fBnone\fR).
  98. .TP
  99. \fB\-\-disallowed\fR
  100. Include objects disallowed by administrative limitations.
  101. .TP
  102. \fB\-\-version\fR
  103. Report version and exit.
  104. .TP
  105. \fB\-h\fR \fB\-\-help\fR
  106. Display help message and exit.
  107. .
  108. .\" **************************
  109. .\" Description Section
  110. .\" **************************
  111. .SH DESCRIPTION
  112. .
  113. hwloc-distrib generates a series of CPU masks corresponding to a distribution of
  114. a given number of elements over the topology of the machine. The distribution
  115. is done recursively from the top of the hierarchy (or from the level specified
  116. by option \fB\-\-from\fR) down to the bottom of the hierarchy (or down to the
  117. level specified by option \fB\-\-to\fR, or until only one element remains),
  118. splitting the number of elements at each encountered hierarchy level not ignored
  119. by options \fB\-\-ignore\fR.
  120. .
  121. .PP
  122. This can e.g. be used to distribute a set of processes hierarchically according
  123. to the topology of a machine. These masks can be used with hwloc-bind(1).
  124. .
  125. .PP
  126. .B NOTE:
  127. It is highly recommended that you read the hwloc(7) overview page
  128. before reading this man page. Most of the concepts described in
  129. hwloc(7) directly apply to the hwloc-bind utility.
  130. .
  131. .\" **************************
  132. .\" Examples Section
  133. .\" **************************
  134. .SH EXAMPLES
  135. .PP
  136. hwloc-distrib's operation is best described through several examples.
  137. .
  138. .PP
  139. If 4 processes have to be distributed across a machine, their CPU masks
  140. may be obtained with:
  141. $ hwloc-distrib 4
  142. 0x0000000f
  143. 0x00000f00
  144. 0x000000f0
  145. 0x0000f000
  146. To distribute only among the second package, the topology should be restricted:
  147. $ hwloc-distrib --restrict $(hwloc-calc package:1) 4
  148. 0x00000010
  149. 0x00000020
  150. 0x00000040
  151. 0x00000080
  152. To get a single processor of each CPU masks (prevent migration in case
  153. of binding)
  154. $ hwloc-distrib 4 --single
  155. 0x00000001
  156. 0x00000100
  157. 0x00000010
  158. 0x00001000
  159. Each output line may be converted independently with hwloc-calc:
  160. $ hwloc-distrib 4 --single | hwloc-calc --taskset
  161. 0x1
  162. 0x100
  163. 0x10
  164. 0x1000
  165. To convert the output into a list of processors that may be passed to
  166. dplace -c inside a mpirun command line:
  167. $ hwloc-distrib 4 --single | xargs hwloc-calc --pulist
  168. 0,8,4,16
  169. .
  170. .
  171. .\" **************************
  172. .\" Return value section
  173. .\" **************************
  174. .SH RETURN VALUE
  175. Upon successful execution, hwloc-distrib displays one or more CPU mask
  176. strings. The return value is 0.
  177. .
  178. .
  179. .PP
  180. hwloc-distrib will return nonzero if any kind of error occurs, such as
  181. (but not limited to) failure to parse the command line.
  182. .
  183. .\" **************************
  184. .\" See also section
  185. .\" **************************
  186. .SH SEE ALSO
  187. .
  188. .ft R
  189. hwloc(7)
  190. .sp