1HWLOC-DISTRIB(1) hwloc HWLOC-DISTRIB(1)
2
3
4
6 hwloc-distrib - Build a number of cpu masks distributed on the system
7
9 hwloc-distrib [options] <integer>
10
12 --single
13 Singlify each output to a single CPU.
14
15 --taskset
16 Show CPU set strings in the format recognized by the taskset
17 command-line program instead of hwloc-specific CPU set string
18 format.
19
20 -v --verbose
21 Verbose messages.
22
23 -i <file>, --input <file>
24 Read topology from XML file <file> (instead of discovering the
25 topology on the local machine). If <file> is "-", the standard
26 input is used. XML support must have been compiled in to hwloc
27 for this option to be usable.
28
29 -i <directory>, --input <directory>
30 Read topology from <directory> instead of discovering the topol‐
31 ogy of the local machine. On Linux, the directory may contain
32 the topology files gathered from another machine topology with
33 hwloc-gather-topology. On x86, the directory may contain a
34 cpuid dump gathered with hwloc-gather-cpuid.
35
36 -i <specification>, --input <specification>
37 Simulate a fake hierarchy (instead of discovering the topology
38 on the local machine). If <specification> is "node:2 pu:3", the
39 topology will contain two NUMA nodes with 3 processing units in
40 each of them. The <specification> string must end with a number
41 of PUs.
42
43 --if <format>, --input-format <format>
44 Enforce the input in the given format, among xml, fsroot, cpuid
45 and synthetic.
46
47 --ignore <type>
48 Ignore all objects of type <type> in the topology.
49
50 --from <type>
51 Distribute starting from objects of the given type instead of
52 from the top of the topology hierarchy, i.e. ignoring the struc‐
53 ture given by objects above.
54
55 <type> cannot be among NUMANode, I/O or Misc types.
56
57 --to <type>
58 Distribute down to objects of the given type instead of down to
59 the bottom of the topology hierarchy, i.e. ignoring the struc‐
60 ture given by objects below. This may be useful if some lati‐
61 tude is desired for the binding, e.g. just bind several pro‐
62 cesses to each package without specifying a single core for each
63 of them.
64
65 <type> cannot be among NUMANode, I/O or Misc types.
66
67 --at <type>
68 Distribute among objects of the given type. This is equivalent
69 to specifying both --from and --to at the same time.
70
71 --reverse
72 Distribute by starting with the last objects first, and singlify
73 CPU sets by keeping the last bit (instead of the first bit).
74
75 --restrict <cpuset>
76 Restrict the topology to the given cpuset.
77
78 --whole-system
79 Do not consider administration limitations.
80
81 --version
82 Report version and exit.
83
85 hwloc-distrib generates a series of CPU masks corresponding to a dis‐
86 tribution of a given number of elements over the topology of the
87 machine. The distribution is done recursively from the top of the hier‐
88 archy (or from the level specified by option --from) down to the bottom
89 of the hierarchy (or down to the level specified by option --to, or
90 until only one element remains), splitting the number of elements at
91 each encountered hierarchy level not ignored by options --ignore.
92
93 This can e.g. be used to distribute a set of processes hierarchically
94 according to the topology of a machine. These masks can be used with
95 hwloc-bind(1).
96
97 NOTE: It is highly recommended that you read the hwloc(7) overview page
98 before reading this man page. Most of the concepts described in
99 hwloc(7) directly apply to the hwloc-bind utility.
100
102 hwloc-distrib's operation is best described through several examples.
103
104 If 4 processes have to be distributed across a machine, their CPU masks
105 may be obtained with:
106
107 $ hwloc-distrib 4
108 0x0000000f
109 0x00000f00
110 0x000000f0
111 0x0000f000
112
113 To distribute only among the second package, the topology should be
114 restricted:
115
116 $ hwloc-distrib --restrict $(hwloc-calc package:1) 4
117 0x00000010
118 0x00000020
119 0x00000040
120 0x00000080
121
122 To get a single processor of each CPU masks (prevent migration in case
123 of binding)
124
125 $ hwloc-distrib 4 --single
126 0x00000001
127 0x00000100
128 0x00000010
129 0x00001000
130
131 Each output line may be converted independently with hwloc-calc:
132
133 $ hwloc-distrib 4 --single | hwloc-calc --taskset
134 0x1
135 0x100
136 0x10
137 0x1000
138
139 To convert the output into a list of processors that may be passed to
140 dplace -c inside a mpirun command line:
141
142 $ hwloc-distrib 4 --single | xargs hwloc-calc --pulist
143 0,8,4,16
144
146 Upon successful execution, hwloc-distrib displays one or more CPU mask
147 strings. The return value is 0.
148
149 hwloc-distrib will return nonzero if any kind of error occurs, such as
150 (but not limited to) failure to parse the command line.
151
153 hwloc(7)
154
155
156
157
1582.0.4 Jun 03, 2019 HWLOC-DISTRIB(1)