44.\" See COPYING in top-level directory.
55.TH HWLOC-DISTRIB "1" "%HWLOC_DATE%" "%PACKAGE_VERSION%" "%PACKAGE_NAME%"
66.SH NAME
7- hwloc-distrib \- Build a number of cpu masks distributed on the system
7+ hwloc-distrib \- Build a number of cpu masks for a type of object, distributed on the system with a policy.
88.
99.\" **************************
1010.\" Synopsis Section
1111.\" **************************
1212.SH SYNOPSIS
13- .B hwloc-distrib
14- [\fI options \fR ] \fI <integer> \fR
15- .
13+ .B hwloc-distrib \fI round-robin \fR \fI <type> \fR [\fI options \fR ]
14+
15+ .B hwloc-distrib \fI scatter \fR \fI <type> \fR [\fI options \fR ]
16+
17+ .B hwloc-distrib \fI <type>:...:<type> \fR [\fI options \fR ]
1618.\" **************************
1719.\" Options Section
1820.\" **************************
@@ -25,6 +27,12 @@ Singlify each output to a single CPU.
2527Show CPU set strings in the format recognized by the taskset command-line
2628program instead of hwloc-specific CPU set string format.
2729.TP
30+ \fB \-\- logical-index \fR
31+ Show logical index of distributed objects instead of CPU set format.
32+ .TP
33+ \fB \-\- physical-index \fR
34+ Show OS index of distributed objects instead of CPU set format.
35+ .TP
2836\fB \- v \fR \fB \-\- verbose \fR
2937Verbose messages.
3038.TP
@@ -55,29 +63,21 @@ Enforce the input in the given format, among \fBxml\fR, \fBfsroot\fR,
5563\fB \-\- ignore \fR <type>
5664Ignore all objects of type <type> in the topology.
5765.TP
58- \fB \-\- from \fR <type>
59- Distribute starting from objects of the given type instead of from
60- the top of the topology hierarchy, i.e. ignoring the structure given by objects
61- above.
62-
63- <type> cannot be among NUMANode, I/O or Misc types.
64- .TP
65- \fB \-\- to \fR <type>
66- Distribute down to objects of the given type instead of down to the bottom of
67- the topology hierarchy, i.e. ignoring the structure given by objects below.
68- This may be useful if some latitude is desired for the binding, e.g. just bind
69- several processes to each package without specifying a single core for each
70- of them.
71-
72- <type> cannot be among NUMANode, I/O or Misc types.
66+ \fB \-\- from \fR <integer>
67+ Distribute starting from objects with this logical index.
7368.TP
74- \fB \-\- at \ fR <type >
75- Distribute among objects of the given type. This is equivalent to specifying
76- both \fB \-\- from \fR and \fB \-\- to \fR at the same time .
69+ \fB \- n \ fR <integer >
70+ Distribute this amount of objects. If integer is larger than the
71+ number of objects to distribute, the distribution will cycle .
7772.TP
7873\fB \-\- reverse \fR
79- Distribute by starting with the last objects first,
80- and singlify CPU sets by keeping the last bit (instead of the first bit).
74+ Reverse distribution order provided by the policy.
75+ .TP
76+ \fB \-\- shuffle \fR
77+ Randomize distribution.
78+ With round-robin policy, the whole distribution is randomized.
79+ With scatter and custom policies, the policy is preserved but the index
80+ inside levels is shuffled.
8181.TP
8282\fB \-\- restrict \fR <cpuset>
8383Restrict the topology to the given cpuset.
@@ -98,11 +98,13 @@ Display help message and exit.
9898.
9999hwloc-distrib generates a series of CPU masks corresponding to a distribution of
100100a given number of elements over the topology of the machine. The distribution
101- is done recursively from the top of the hierarchy (or from the level specified
102- by option \fB \-\- from \fR ) down to the bottom of the hierarchy (or down to the
103- level specified by option \fB \-\- to \fR , or until only one element remains),
104- splitting the number of elements at each encountered hierarchy level not ignored
105- by options \fB \-\- ignore \fR .
101+ is done recursively from the last level argument to the first level argument.
102+ Round-robin policy is equivalent to distribute from the leaves to the root.
103+ Scatter policy is equivalent to distribute from the root to the leaves.
104+ Leaves are the type of object output by hwloc-distrib.
105+ Leaves of round-robin and scatter policies are set in <type> argument.
106+ Leaves are the deepest objects in the list of provided levels <type>:...:<type>
107+ when using a custom policy.
106108.
107109.PP
108110This can e.g. be used to distribute a set of processes hierarchically according
@@ -122,45 +124,45 @@ hwloc(7) directly apply to the hwloc-bind utility.
122124hwloc-distrib's operation is best described through several examples.
123125.
124126.PP
125- If 4 processes have to be distributed across a machine, their CPU masks
126- may be obtained with:
127-
128- $ hwloc-distrib 4
129- 0x0000000f
130- 0x00000f00
131- 0x000000f0
132- 0x0000f000
127+ If 4 processes have to be distributed across a machine and bound to a single
128+ package each, their CPU masks may be obtained with:
133129
130+ $ hwloc-distrib scatter package -n 4
131+ 0x00ff00ff
132+ 0xff00ff00
133+ 0x00ff00ff
134+ 0xff00ff00
135+
134136To distribute only among the second package, the topology should be restricted:
135137
136- $ hwloc-distrib -- restrict $(hwloc-calc package:1) 4
137- 0x00000010
138- 0x00000020
139- 0x00000040
140- 0x00000080
138+ $ hwloc-distrib scatter pu -n 4 -- restrict $(hwloc-calc package:1)
139+ 0xff00ff00
140+ 0xff00ff00
141+ 0xff00ff00
142+ 0xff00ff00
141143
142144To get a single processor of each CPU masks (prevent migration in case
143145of binding)
144146
145- $ hwloc-distrib 4 --single
147+ $ hwloc-distrib scatter pu -n 4
146148 0x00000001
147149 0x00000100
148- 0x00000010
149- 0x00001000
150+ 0x00000002
151+ 0x00000200
150152
151153Each output line may be converted independently with hwloc-calc:
152154
153- $ hwloc-distrib 4 --single | hwloc-calc --taskset
155+ $ hwloc-distrib scatter pu -n 4 | hwloc-calc --taskset
154156 0x1
155157 0x100
156- 0x10
157- 0x1000
158+ 0x2
159+ 0x200
158160
159161To convert the output into a list of processors that may be passed to
160162dplace -c inside a mpirun command line:
161163
162- $ hwloc-distrib 4 --single | xargs hwloc-calc --pulist
163- 0,8,4,16
164+ $ hwloc-distrib scatter pu -n 4 | xargs hwloc-calc --pulist
165+ 0,2,16,18
164166.
165167.
166168.\" **************************
0 commit comments