4
4
.\" See COPYING in top-level directory.
5
5
.TH HWLOC-DISTRIB "1" "%HWLOC_DATE%" "%PACKAGE_VERSION%" "%PACKAGE_NAME%"
6
6
.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.
8
8
.
9
9
.\" **************************
10
10
.\" Synopsis Section
11
11
.\" **************************
12
12
.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 ]
16
18
.\" **************************
17
19
.\" Options Section
18
20
.\" **************************
@@ -25,6 +27,12 @@ Singlify each output to a single CPU.
25
27
Show CPU set strings in the format recognized by the taskset command-line
26
28
program instead of hwloc-specific CPU set string format.
27
29
.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
28
36
\fB \- v \fR \fB \-\- verbose \fR
29
37
Verbose messages.
30
38
.TP
@@ -55,29 +63,21 @@ Enforce the input in the given format, among \fBxml\fR, \fBfsroot\fR,
55
63
\fB \-\- ignore \fR <type>
56
64
Ignore all objects of type <type> in the topology.
57
65
.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.
73
68
.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 .
77
72
.TP
78
73
\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.
81
81
.TP
82
82
\fB \-\- restrict \fR <cpuset>
83
83
Restrict the topology to the given cpuset.
@@ -98,11 +98,13 @@ Display help message and exit.
98
98
.
99
99
hwloc-distrib generates a series of CPU masks corresponding to a distribution of
100
100
a 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.
106
108
.
107
109
.PP
108
110
This 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.
122
124
hwloc-distrib's operation is best described through several examples.
123
125
.
124
126
.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:
133
129
130
+ $ hwloc-distrib scatter package -n 4
131
+ 0x00ff00ff
132
+ 0xff00ff00
133
+ 0x00ff00ff
134
+ 0xff00ff00
135
+
134
136
To distribute only among the second package, the topology should be restricted:
135
137
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
141
143
142
144
To get a single processor of each CPU masks (prevent migration in case
143
145
of binding)
144
146
145
- $ hwloc-distrib 4 --single
147
+ $ hwloc-distrib scatter pu -n 4
146
148
0x00000001
147
149
0x00000100
148
- 0x00000010
149
- 0x00001000
150
+ 0x00000002
151
+ 0x00000200
150
152
151
153
Each output line may be converted independently with hwloc-calc:
152
154
153
- $ hwloc-distrib 4 --single | hwloc-calc --taskset
155
+ $ hwloc-distrib scatter pu -n 4 | hwloc-calc --taskset
154
156
0x1
155
157
0x100
156
- 0x10
157
- 0x1000
158
+ 0x2
159
+ 0x200
158
160
159
161
To convert the output into a list of processors that may be passed to
160
162
dplace -c inside a mpirun command line:
161
163
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
164
166
.
165
167
.
166
168
.\" **************************
0 commit comments