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

NAME

6       hwloc-distrib - Build a number of cpu masks distributed on the system
7

SYNOPSIS

9       hwloc-distrib [options] <integer>
10

OPTIONS

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       --disallowed
79              Include objects disallowed by administrative limitations.
80
81       --version
82              Report version and exit.
83
84       -h --help
85              Display help message and exit.
86

DESCRIPTION

88       hwloc-distrib generates a series of CPU masks corresponding to  a  dis‐
89       tribution  of  a  given  number  of  elements  over the topology of the
90       machine. The distribution is done recursively from the top of the hier‐
91       archy (or from the level specified by option --from) down to the bottom
92       of the hierarchy (or down to the level specified  by  option  --to,  or
93       until  only  one  element remains), splitting the number of elements at
94       each encountered hierarchy level not ignored by options --ignore.
95
96       This can e.g. be used to distribute a set of  processes  hierarchically
97       according  to  the  topology of a machine. These masks can be used with
98       hwloc-bind(1).
99
100       NOTE: It is highly recommended that you read the hwloc(7) overview page
101       before  reading  this  man  page.   Most  of  the concepts described in
102       hwloc(7) directly apply to the hwloc-bind utility.
103

EXAMPLES

105       hwloc-distrib's operation is best described through several examples.
106
107       If 4 processes have to be distributed across a machine, their CPU masks
108       may be obtained with:
109
110           $ hwloc-distrib 4
111           0x0000000f
112           0x00000f00
113           0x000000f0
114           0x0000f000
115
116       To  distribute  only  among  the second package, the topology should be
117       restricted:
118
119           $ hwloc-distrib --restrict $(hwloc-calc package:1) 4
120           0x00000010
121           0x00000020
122           0x00000040
123           0x00000080
124
125       To get a single processor of each CPU masks (prevent migration in  case
126       of binding)
127
128           $ hwloc-distrib 4 --single
129           0x00000001
130           0x00000100
131           0x00000010
132           0x00001000
133
134       Each output line may be converted independently with hwloc-calc:
135
136           $ hwloc-distrib 4 --single | hwloc-calc --taskset
137           0x1
138           0x100
139           0x10
140           0x1000
141
142       To  convert  the output into a list of processors that may be passed to
143       dplace -c inside a mpirun command line:
144
145           $ hwloc-distrib 4 --single | xargs hwloc-calc --pulist
146           0,8,4,16
147

RETURN VALUE

149       Upon successful execution, hwloc-distrib displays one or more CPU  mask
150       strings.  The return value is 0.
151
152       hwloc-distrib  will return nonzero if any kind of error occurs, such as
153       (but not limited to) failure to parse the command line.
154

SEE ALSO

156       hwloc(7)
157
158
159
160
1612.2.0                            Mar 30, 2020                 HWLOC-DISTRIB(1)
Impressum