Skip to content

Commit 1d30edf

Browse files
committed
utils/calc: switch to intersecting local NUMA nodes by default
Thanks to Antoine Morvan for the report Refs open-mpi#716 Signed-off-by: Brice Goglin <[email protected]>
1 parent f42406e commit 1d30edf

File tree

4 files changed

+39
-4
lines changed

4 files changed

+39
-4
lines changed

utils/hwloc/hwloc-calc.1in

+3-3
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ Change the flags used to select local NUMA nodes.
222222
Flags may be given as numeric values or as a comma-separated list of flag names
223223
that are passed to \fIhwloc_get_local_numanode_objs()\fR.
224224
Those names may be substrings of actual flag names as long as a single one matches.
225-
The default is \fB3\fR (or \fBsmaller,larger\fR)
225+
The default is \f0xb\fR (or \fBsmaller,larger,intersects\fR)
226226
which means NUMA nodes are displayed
227-
if their locality either contains or is contained
228-
in the locality of the given object.
227+
if their locality either contains, is contained, or intersects
228+
the locality of the given object.
229229

230230
This option enables \fB\-\-local\-memory\fR.
231231
.TP

utils/hwloc/hwloc-calc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ static struct hwloc_calc_level intersect;
8585
static int hiernblevels;
8686
static struct hwloc_calc_level *hierlevels;
8787
static int local_numanodes = 0;
88-
static unsigned long local_numanode_flags = HWLOC_LOCAL_NUMANODE_FLAG_SMALLER_LOCALITY | HWLOC_LOCAL_NUMANODE_FLAG_LARGER_LOCALITY;
88+
static unsigned long local_numanode_flags = HWLOC_LOCAL_NUMANODE_FLAG_SMALLER_LOCALITY | HWLOC_LOCAL_NUMANODE_FLAG_LARGER_LOCALITY | HWLOC_LOCAL_NUMANODE_FLAG_INTERSECT_LOCALITY;
8989
static hwloc_memattr_id_t best_memattr_id = (hwloc_memattr_id_t) -1;
9090
static unsigned long best_node_flags = 0;
9191
static int showlargestobjs = 0;

utils/hwloc/test-hwloc-calc.output

+17
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,23 @@ NUMANode:1
181181
# Best-capacity local node near a PU (node:6@Machine)
182182
6
183183

184+
185+
# no node is local to one pu of each package
186+
187+
188+
# 1 node is local to one package and one pu of the other
189+
0
190+
191+
# both nodes are local to one pu of each package, if intersecting
192+
NUMANode:0,NUMANode:1
193+
194+
# both nodes are local to one package and one pu of the other, if intersecting
195+
0,1
196+
197+
# all local nodes
198+
0%1
199+
200+
184201
# CPU kind by index
185202
0x000000ff
186203

utils/hwloc/test-hwloc-calc.sh.in

+18
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,24 @@ set -e
235235
$calc --if synthetic --input "[numa(memory=1000000)] pack:2 [numa(memory=100000)] die:2 [numa(memory=1000)] pu:2" --best-memattr capacity pu:4
236236
echo
237237

238+
echo
239+
echo "# no node is local to one pu of each package"
240+
$calc --if synthetic --input "pack:2 [numa] pu:2" --local-memory-flags small,large pack:all.pu:0
241+
echo
242+
echo "# 1 node is local to one package and one pu of the other"
243+
$calc --if synthetic --input "pack:2 [numa] pu:2" --local-memory-flags small,large pack:0 pack:1.pu:0
244+
echo
245+
echo "# both nodes are local to one pu of each package, if intersecting"
246+
$calc --if synthetic --input "pack:2 [numa] pu:2" --local-memory-flags intersect pack:all.pu:0 --oo
247+
echo
248+
echo "# both nodes are local to one package and one pu of the other, if intersecting"
249+
$calc --if synthetic --input "pack:2 [numa] pu:2" --local-memory-flags intersect pack:0 pack:1.pu:0
250+
echo
251+
echo "# all local nodes"
252+
$calc --if synthetic --input "pack:2 [numa] pu:2" --local-memory-flags _all pu:0 --sep "%"
253+
echo
254+
255+
echo
238256
echo "# CPU kind by index"
239257
$calc --if xml --input $linuxdir/fakeheterocpunuma.xml --cpukind 1 all
240258
echo

0 commit comments

Comments
 (0)