Skip to content

Commit 5935928

Browse files
authored
Merge pull request #669 from bgoglin/distances
Distances changes for 3.0
2 parents 15f5aaf + a931fa6 commit 5935928

20 files changed

+128
-83
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ Version 3.0.0
5151
See "Custom string infos" in the documentation for details.
5252
- hwloc_cpukinds_get_info() and hwloc_cpukinds_register() now manipulate
5353
infos as such a structure.
54+
+ Distances structure "MEANS" kinds are renamed to "VALUE", and the new
55+
"HOPS" kind is used for the XGMIHops matrix instead of "LATENCY.
5456
* Tools
5557
+ lstopo has a new --osf option to tune the displaying of object
5658
attributes and units.

doc/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,8 +647,9 @@ man3_distances_DATA = \
647647
$(DOX_MAN_DIR)/man3/hwloc_distances_kind_e.3 \
648648
$(DOX_MAN_DIR)/man3/HWLOC_DISTANCES_KIND_FROM_OS.3 \
649649
$(DOX_MAN_DIR)/man3/HWLOC_DISTANCES_KIND_FROM_USER.3 \
650-
$(DOX_MAN_DIR)/man3/HWLOC_DISTANCES_KIND_MEANS_LATENCY.3 \
651-
$(DOX_MAN_DIR)/man3/HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH.3 \
650+
$(DOX_MAN_DIR)/man3/HWLOC_DISTANCES_KIND_VALUE_LATENCY.3 \
651+
$(DOX_MAN_DIR)/man3/HWLOC_DISTANCES_KIND_VALUE_BANDWIDTH.3 \
652+
$(DOX_MAN_DIR)/man3/HWLOC_DISTANCES_KIND_VALUE_HOPS.3 \
652653
$(DOX_MAN_DIR)/man3/hwloc_distances_get.3 \
653654
$(DOX_MAN_DIR)/man3/hwloc_distances_get_by_depth.3 \
654655
$(DOX_MAN_DIR)/man3/hwloc_distances_get_by_type.3 \

doc/hwloc.doxy

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4779,6 +4779,16 @@ in the topology root object together with other backends instead
47794779
of in each object.
47804780

47814781

4782+
\section upgrade_to_api_3x_distances Distances structure kinds
4783+
4784+
HWLOC_DISTANCES_KIND_MEANS_LATENCY and HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH
4785+
are renamed to ::HWLOC_DISTANCES_KIND_VALUE_LATENCY and ::HWLOC_DISTANCES_KIND_VALUE_BANDWIDTH.
4786+
<br/>
4787+
4788+
The XGMIHops distance matrix is now of the new kind
4789+
::HWLOC_DISTANCES_KIND_VALUE_HOPS instead of latency.
4790+
4791+
47824792
\section upgrade_to_api_3x_xml XML changes
47834793

47844794
hwloc 3.x can load XML topology files exported by hwloc 2.x.

hwloc/distances.c

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2010-2022 Inria. All rights reserved.
2+
* Copyright © 2010-2024 Inria. All rights reserved.
33
* Copyright © 2011-2012 Université Bordeaux
44
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
55
* See COPYING in top-level directory.
@@ -607,8 +607,8 @@ int hwloc_internal_distances_add(hwloc_topology_t topology, const char *name,
607607
*/
608608

609609
#define HWLOC_DISTANCES_KIND_FROM_ALL (HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_FROM_USER)
610-
#define HWLOC_DISTANCES_KIND_MEANS_ALL (HWLOC_DISTANCES_KIND_MEANS_LATENCY|HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH)
611-
#define HWLOC_DISTANCES_KIND_ALL (HWLOC_DISTANCES_KIND_FROM_ALL|HWLOC_DISTANCES_KIND_MEANS_ALL|HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES)
610+
#define HWLOC_DISTANCES_KIND_VALUE_ALL (HWLOC_DISTANCES_KIND_VALUE_LATENCY|HWLOC_DISTANCES_KIND_VALUE_BANDWIDTH|HWLOC_DISTANCES_KIND_VALUE_HOPS)
611+
#define HWLOC_DISTANCES_KIND_ALL (HWLOC_DISTANCES_KIND_FROM_ALL|HWLOC_DISTANCES_KIND_VALUE_ALL|HWLOC_DISTANCES_KIND_HETEROGENEOUS_TYPES)
612612
#define HWLOC_DISTANCES_ADD_FLAG_ALL (HWLOC_DISTANCES_ADD_FLAG_GROUP|HWLOC_DISTANCES_ADD_FLAG_GROUP_INACCURATE)
613613

614614
void * hwloc_distances_add_create(hwloc_topology_t topology,
@@ -624,8 +624,8 @@ void * hwloc_distances_add_create(hwloc_topology_t topology,
624624
return NULL;
625625
}
626626
if ((kind & ~HWLOC_DISTANCES_KIND_ALL)
627-
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_FROM_ALL) != 1
628-
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_MEANS_ALL) != 1) {
627+
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_FROM_ALL) > 1
628+
|| hwloc_weight_long(kind & HWLOC_DISTANCES_KIND_VALUE_ALL) > 1) {
629629
errno = EINVAL;
630630
return NULL;
631631
}
@@ -959,7 +959,7 @@ hwloc__distances_get(hwloc_topology_t topology,
959959

960960
for(dist = topology->first_dist; dist; dist = dist->next) {
961961
unsigned long kind_from = kind & HWLOC_DISTANCES_KIND_FROM_ALL;
962-
unsigned long kind_means = kind & HWLOC_DISTANCES_KIND_MEANS_ALL;
962+
unsigned long kind_means = kind & HWLOC_DISTANCES_KIND_VALUE_ALL;
963963

964964
if (name && (!dist->name || strcmp(name, dist->name)))
965965
continue;
@@ -1203,8 +1203,7 @@ hwloc__groups_by_distances(struct hwloc_topology *topology,
12031203
if (nbobjs <= 2)
12041204
return;
12051205

1206-
if (!(kind & HWLOC_DISTANCES_KIND_MEANS_LATENCY))
1207-
/* don't know use to use those for grouping */
1206+
if (!(kind & (HWLOC_DISTANCES_KIND_VALUE_LATENCY|HWLOC_DISTANCES_KIND_VALUE_HOPS)))
12081207
/* TODO hwloc__find_groups_by_max_distance() for bandwidth */
12091208
return;
12101209

@@ -1349,7 +1348,7 @@ hwloc__distances_transform_links(struct hwloc_distances_s *distances)
13491348
hwloc_uint64_t divider, *values = distances->values;
13501349
unsigned i, nbobjs = distances->nbobjs;
13511350

1352-
if (!(distances->kind & HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH)) {
1351+
if (!(distances->kind & HWLOC_DISTANCES_KIND_VALUE_BANDWIDTH)) {
13531352
errno = EINVAL;
13541353
return -1;
13551354
}

hwloc/topology-freebsd.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright © 2009 CNRS
3-
* Copyright © 2009-2023 Inria. All rights reserved.
3+
* Copyright © 2009-2024 Inria. All rights reserved.
44
* Copyright © 2009-2010, 2012, 2020 Université Bordeaux
55
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
66
* See COPYING in top-level directory.
@@ -416,7 +416,7 @@ set_locality_info(hwloc_topology_t topology, int ndomains, hwloc_obj_t *nodes){
416416
free(nodes);
417417
free(distances);
418418
} else
419-
hwloc_internal_distances_add(topology, "NUMALatency", ndomains, nodes, distances, HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_LATENCY, HWLOC_DISTANCES_ADD_FLAG_GROUP);
419+
hwloc_internal_distances_add(topology, "NUMALatency", ndomains, nodes, distances, HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_LATENCY, HWLOC_DISTANCES_ADD_FLAG_GROUP);
420420
return 0;
421421
}
422422

hwloc/topology-levelzero.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2020-2023 Inria. All rights reserved.
2+
* Copyright © 2020-2024 Inria. All rights reserved.
33
* See COPYING in top-level directory.
44
*/
55

@@ -489,7 +489,7 @@ hwloc__levelzero_ports_add_xelink_bandwidth(struct hwloc_topology *topology,
489489
int err;
490490

491491
handle = hwloc_backend_distances_add_create(topology, "XeLinkBandwidth",
492-
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH,
492+
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_BANDWIDTH,
493493
0);
494494
if (!handle)
495495
goto out;

hwloc/topology-linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4175,7 +4175,7 @@ annotate_sysfsnode(struct hwloc_topology *topology,
41754175
&& !hwloc_parse_nodes_distances(nbnodes, indexes, distances, data->root_fd)
41764176
&& !(topology->flags & HWLOC_TOPOLOGY_FLAG_NO_DISTANCES)) {
41774177
hwloc_internal_distances_add(topology, "NUMALatency", nbnodes, nodes, distances,
4178-
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_LATENCY,
4178+
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_LATENCY,
41794179
HWLOC_DISTANCES_ADD_FLAG_GROUP);
41804180
} else {
41814181
free(nodes);
@@ -4463,7 +4463,7 @@ look_sysfsnode(struct hwloc_topology *topology,
44634463
/* Inserted distances now that nodes are properly inserted */
44644464
if (distances)
44654465
hwloc_internal_distances_add(topology, "NUMALatency", nbnodes, nodes, distances,
4466-
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_LATENCY,
4466+
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_LATENCY,
44674467
HWLOC_DISTANCES_ADD_FLAG_GROUP);
44684468
else
44694469
free(nodes);

hwloc/topology-nvml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ hwloc__nvml_add_nvlink_bandwidth(hwloc_topology_t topology,
137137
int err;
138138

139139
handle = hwloc_backend_distances_add_create(topology, "NVLinkBandwidth",
140-
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH,
140+
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_BANDWIDTH,
141141
0);
142142
if (!handle)
143143
goto out;

hwloc/topology-rsmi.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2012-2023 Inria. All rights reserved.
2+
* Copyright © 2012-2024 Inria. All rights reserved.
33
* Copyright (c) 2020, Advanced Micro Devices, Inc. All rights reserved.
44
* Written by Advanced Micro Devices,
55
* See COPYING in top-level directory.
@@ -23,7 +23,7 @@ hwloc__rsmi_add_xgmi_bandwidth(hwloc_topology_t topology,
2323
int err;
2424

2525
handle = hwloc_backend_distances_add_create(topology, "XGMIBandwidth",
26-
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_BANDWIDTH,
26+
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_BANDWIDTH,
2727
0);
2828
if (!handle)
2929
goto out;
@@ -55,7 +55,7 @@ hwloc__rsmi_add_xgmi_hops(hwloc_topology_t topology,
5555
int err;
5656

5757
handle = hwloc_backend_distances_add_create(topology, "XGMIHops",
58-
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_LATENCY,
58+
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_HOPS,
5959
0);
6060
if (!handle)
6161
goto out;

hwloc/topology-solaris.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright © 2009 CNRS
3-
* Copyright © 2009-2023 Inria. All rights reserved.
3+
* Copyright © 2009-2024 Inria. All rights reserved.
44
* Copyright © 2009-2011 Université Bordeaux
55
* Copyright © 2011 Cisco Systems, Inc. All rights reserved.
66
* Copyright © 2011 Oracle and/or its affiliates. All rights reserved.
@@ -525,7 +525,7 @@ hwloc_look_lgrp(struct hwloc_topology *topology, struct hwloc_disc_status *dstat
525525
distances[i*curlgrp+j] = (uint64_t) latency;
526526
}
527527
hwloc_internal_distances_add(topology, "NUMALatency", curlgrp, glob_lgrps, distances,
528-
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_MEANS_LATENCY,
528+
HWLOC_DISTANCES_KIND_FROM_OS|HWLOC_DISTANCES_KIND_VALUE_LATENCY,
529529
HWLOC_DISTANCES_ADD_FLAG_GROUP);
530530
glob_lgrps = NULL; /* dont free it below */
531531
}

0 commit comments

Comments
 (0)