Skip to content

Commit c44c7e4

Browse files
committed
checkpoint
1 parent 416476d commit c44c7e4

File tree

11 files changed

+109
-43
lines changed

11 files changed

+109
-43
lines changed

opal/mca/btl/openib/btl_openib_component.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2331,6 +2331,7 @@ static float get_ib_dev_distance(struct ibv_device *dev)
23312331
because we have no way of measuring. */
23322332
float distance = 0;
23332333

2334+
#if HWLOC_API_VERSION < 0x20000
23342335
/* Override any distance logic so all devices are used */
23352336
if (0 != mca_btl_openib_component.ignore_locality ||
23362337
OPAL_SUCCESS != opal_hwloc_base_get_topology()) {
@@ -2475,6 +2476,9 @@ static float get_ib_dev_distance(struct ibv_device *dev)
24752476
if (NULL != my_cpuset) {
24762477
hwloc_bitmap_free(my_cpuset);
24772478
}
2479+
#else
2480+
#warning FIXME get_ib_dev_distance is not implemented with hwloc v2
2481+
#endif
24782482

24792483
return distance;
24802484
}

opal/mca/hwloc/base/base.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
#include "opal/mca/hwloc/hwloc-internal.h"
2121

22-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
22+
#if HWLOC_API_VERSION < 0x20000
2323
#define HWLOC_OBJ_L3CACHE HWLOC_OBJ_CACHE
2424
#define HWLOC_OBJ_L2CACHE HWLOC_OBJ_CACHE
2525
#define HWLOC_OBJ_L1CACHE HWLOC_OBJ_CACHE

opal/mca/hwloc/base/hwloc_base_dt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int opal_hwloc_unpack(opal_buffer_t *buffer, void *dest,
107107
* explicitly set a flag so hwloc sets things up correctly
108108
*/
109109
if (0 != hwloc_topology_set_flags(t, (HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
110-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
110+
#if HWLOC_API_VERSION < 0x20000
111111
| HWLOC_TOPOLOGY_FLAG_IO_DEVICES
112112
#endif
113113
))) {

opal/mca/hwloc/base/hwloc_base_util.c

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ int opal_hwloc_base_get_topology(void)
189189
*/
190190
if (0 != hwloc_topology_set_flags(opal_hwloc_topology,
191191
(HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
192-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
192+
#if HWLOC_API_VERSION < 0x20000
193193
| HWLOC_TOPOLOGY_FLAG_IO_DEVICES
194194
#endif
195195
))) {
@@ -206,7 +206,7 @@ int opal_hwloc_base_get_topology(void)
206206
free(val);
207207
} else if (NULL == opal_hwloc_base_topo_file) {
208208
if (0 != hwloc_topology_init(&opal_hwloc_topology) ||
209-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
209+
#if HWLOC_API_VERSION < 0x20000
210210
0 != hwloc_topology_set_flags(opal_hwloc_topology,
211211
HWLOC_TOPOLOGY_FLAG_IO_DEVICES) ||
212212
#endif
@@ -255,7 +255,7 @@ int opal_hwloc_base_set_topology(char *topofile)
255255
*/
256256
if (0 != hwloc_topology_set_flags(opal_hwloc_topology,
257257
(HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM
258-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
258+
#if HWLOC_API_VERSION < 0x20000
259259
| HWLOC_TOPOLOGY_FLAG_IO_DEVICES
260260
#endif
261261
))) {
@@ -508,7 +508,7 @@ unsigned int opal_hwloc_base_get_obj_idx(hwloc_topology_t topo,
508508
return data->idx;
509509
}
510510

511-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
511+
#if HWLOC_API_VERSION < 0x20000
512512
/* determine the number of objects of this type */
513513
if (HWLOC_OBJ_CACHE == obj->type) {
514514
cache_level = obj->attr->cache.depth;
@@ -564,7 +564,7 @@ static hwloc_obj_t df_search(hwloc_topology_t topo,
564564
opal_hwloc_obj_data_t *data;
565565

566566
if (target == start->type) {
567-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
567+
#if HWLOC_API_VERSION < 0x20000
568568
if (HWLOC_OBJ_CACHE == start->type && cache_level != start->attr->cache.depth) {
569569
goto notfound;
570570
}
@@ -675,7 +675,7 @@ unsigned int opal_hwloc_base_get_nbobjs_by_type(hwloc_topology_t topo,
675675
* as these are treated as special cases
676676
*/
677677
if (OPAL_HWLOC_LOGICAL == rtype
678-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
678+
#if HWLOC_API_VERSION < 0x20000
679679
&& HWLOC_OBJ_CACHE != target
680680
#endif
681681
) {
@@ -747,7 +747,7 @@ static hwloc_obj_t df_search_min_bound(hwloc_topology_t topo,
747747
if (0 == (k = opal_hwloc_base_get_npus(topo, start))) {
748748
goto notfound;
749749
}
750-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
750+
#if HWLOC_API_VERSION < 0x20000
751751
if (HWLOC_OBJ_CACHE == start->type && cache_level != start->attr->cache.depth) {
752752
goto notfound;
753753
}
@@ -814,7 +814,7 @@ hwloc_obj_t opal_hwloc_base_find_min_bound_target_under_obj(hwloc_topology_t top
814814
/* again, we have to treat caches differently as
815815
* the levels distinguish them
816816
*/
817-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
817+
#if HWLOC_API_VERSION < 0x20000
818818
if (HWLOC_OBJ_CACHE == target &&
819819
cache_level < obj->attr->cache.depth) {
820820
goto moveon;
@@ -832,7 +832,7 @@ hwloc_obj_t opal_hwloc_base_find_min_bound_target_under_obj(hwloc_topology_t top
832832
loc = df_search_min_bound(topo, obj, target, cache_level, &min_bound);
833833

834834
if (NULL != loc) {
835-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
835+
#if HWLOC_API_VERSION < 0x20000
836836
if (HWLOC_OBJ_CACHE == target) {
837837
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
838838
"hwloc:base:min_bound_under_obj found min bound of %u on %s:%u:%u",
@@ -870,7 +870,7 @@ hwloc_obj_t opal_hwloc_base_get_obj_by_type(hwloc_topology_t topo,
870870
* as these are treated as special cases
871871
*/
872872
if (OPAL_HWLOC_LOGICAL == rtype
873-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
873+
#if HWLOC_API_VERSION < 0x20000
874874
&& HWLOC_OBJ_CACHE != target
875875
#endif
876876
) {
@@ -1258,7 +1258,7 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
12581258
/* if it isn't one of interest, then ignore it */
12591259
if (HWLOC_OBJ_NODE != type &&
12601260
HWLOC_OBJ_SOCKET != type &&
1261-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
1261+
#if HWLOC_API_VERSION < 0x20000
12621262
HWLOC_OBJ_CACHE != type &&
12631263
#else
12641264
HWLOC_OBJ_L3CACHE != type &&
@@ -1291,7 +1291,7 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
12911291
case HWLOC_OBJ_SOCKET:
12921292
locality |= OPAL_PROC_ON_SOCKET;
12931293
break;
1294-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
1294+
#if HWLOC_API_VERSION < 0x20000
12951295
case HWLOC_OBJ_CACHE:
12961296
if (3 == obj->attr->cache.depth) {
12971297
locality |= OPAL_PROC_ON_L3CACHE;
@@ -1847,13 +1847,14 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
18471847
{
18481848
hwloc_obj_t device_obj = NULL;
18491849
hwloc_obj_t obj = NULL, root = NULL;
1850-
const struct hwloc_distances_s* distances;
1850+
struct hwloc_distances_s* distances;
18511851
opal_rmaps_numa_node_t *numa_node;
18521852
int close_node_index;
18531853
float latency;
18541854
unsigned int j;
18551855
int depth;
18561856
unsigned i;
1857+
unsigned distances_nr = 0;
18571858

18581859
for (device_obj = hwloc_get_obj_by_type(topo, HWLOC_OBJ_OS_DEVICE, 0); device_obj; device_obj = hwloc_get_next_osdev(topo, device_obj)) {
18591860
if (device_obj->attr->osdev.type == HWLOC_OBJ_OSDEV_OPENFABRICS
@@ -1874,6 +1875,7 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
18741875
}
18751876

18761877
/* find distance matrix for all numa nodes */
1878+
#if HWLOC_API_VERSION < 0x20000
18771879
distances = hwloc_get_whole_distance_matrix_by_type(topo, HWLOC_OBJ_NODE);
18781880
if (NULL == distances) {
18791881
/* we can try to find distances under group object. This info can be there. */
@@ -1910,6 +1912,22 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
19101912
numa_node->dist_from_closed = latency;
19111913
opal_list_append(sorted_list, &numa_node->super);
19121914
}
1915+
#else
1916+
if (0 != hwloc_distances_get_by_type(topo, HWLOC_OBJ_NODE, &distances_nr, &distances, 0, 0) || 0 == distances_nr) {
1917+
opal_output_verbose(5, opal_hwloc_base_framework.framework_output,
1918+
"hwloc:base:get_sorted_numa_list: There is no information about distances on the node.");
1919+
return;
1920+
}
1921+
/* fill list of numa nodes */
1922+
for (j = 0; j < distances->nbobjs; j++) {
1923+
latency = distances->values[close_node_index + distances->nbobjs * j];
1924+
numa_node = OBJ_NEW(opal_rmaps_numa_node_t);
1925+
numa_node->index = j;
1926+
numa_node->dist_from_closed = latency;
1927+
opal_list_append(sorted_list, &numa_node->super);
1928+
}
1929+
hwloc_distances_release(topo, distances);
1930+
#endif
19131931
/* sort numa nodes by distance from the closest one to PCI */
19141932
opal_list_sort(sorted_list, dist_cmp_fn);
19151933
return;
@@ -2067,7 +2085,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
20672085
/* if it isn't one of interest, then ignore it */
20682086
if (HWLOC_OBJ_NODE != type &&
20692087
HWLOC_OBJ_SOCKET != type &&
2070-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
2088+
#if HWLOC_API_VERSION < 0x20000
20712089
HWLOC_OBJ_CACHE != type &&
20722090
#else
20732091
HWLOC_OBJ_L1CACHE != type &&
@@ -2115,7 +2133,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
21152133
}
21162134
locality = t2;
21172135
break;
2118-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
2136+
#if HWLOC_API_VERSION < 0x20000
21192137
case HWLOC_OBJ_CACHE:
21202138
if (3 == obj->attr->cache.depth) {
21212139
asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp);
@@ -2213,7 +2231,7 @@ char* opal_hwloc_base_get_location(char *locality,
22132231
case HWLOC_OBJ_SOCKET:
22142232
srch = "SK";
22152233
break;
2216-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
2234+
#if HWLOC_API_VERSION < 0x20000
22172235
case HWLOC_OBJ_CACHE:
22182236
if (3 == index) {
22192237
srch = "L3";
@@ -2321,7 +2339,7 @@ opal_hwloc_locality_t opal_hwloc_compute_relative_locality(char *loc1, char *loc
23212339
}
23222340

23232341
int opal_hwloc_base_topology_export_xmlbuffer(hwloc_topology_t topology, char **xmlpath, int *buflen) {
2324-
#if OPAL_HAVE_HWLOC_OBJ_CACHE
2342+
#if HWLOC_API_VERSION < 0x20000
23252343
return hwloc_topology_export_xmlbuffer(topology, xmlpath, buflen);
23262344
#else
23272345
return hwloc_topology_export_xmlbuffer(topology, xmlpath, buflen, 0);

opal/mca/hwloc/configure.m4

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
dnl -*- shell-script -*-
22
dnl
33
dnl Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved
4-
dnl Copyright (c) 2017 Research Organization for Information Science
5-
dnl and Technology (RIST). All rights reserved.
64
dnl $COPYRIGHT$
75
dnl
86
dnl Additional copyrights may follow

opal/mca/hwloc/external/configure.m4

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,17 +183,6 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
183183
[AC_MSG_RESULT([yes])],
184184
[AC_MSG_RESULT([no])
185185
AC_MSG_ERROR([Cannot continue])])
186-
AC_MSG_CHECKING([whether HWLOC_OBJ_CACHE is defined])
187-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <hwloc.h>
188-
189-
hwloc_obj_type_t type = HWLOC_OBJ_CACHE;])],
190-
[opal_hwloc_have_obj_cache=1
191-
AC_MSG_RESULT([yes])],
192-
[opal_hwloc_have_obj_cache=0
193-
AC_MSG_RESULT([no])])
194-
AC_DEFINE_UNQUOTED([OPAL_HAVE_HWLOC_OBJ_CACHE],
195-
[$opal_hwloc_have_obj_cache],
196-
[HWLOC_OBJ_CACHE is defined in hwloc < v2])
197186

198187
AS_IF([test "$opal_hwloc_dir" != ""],
199188
[CFLAGS=$opal_hwloc_external_CFLAGS_save])

opal/mca/hwloc/hwloc1116/configure.m4

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ AC_DEFUN([MCA_opal_hwloc_hwloc1116_POST_CONFIG],[
5555
CPPFLAGS="-I$OPAL_TOP_SRCDIR/$file/include $CPPFLAGS"
5656
AS_IF([test "$OPAL_TOP_BUILDDIR" != "$OPAL_TOP_SRCDIR"],
5757
[CPPFLAGS="-I$OPAL_TOP_BUILDDIR/$file/include $CPPFLAGS"])
58-
AC_DEFINE_UNQUOTED([OPAL_HAVE_HWLOC_OBJ_CACHE],
59-
[1],
60-
[HWLOC_OBJ_CACHE is defined in hwloc 1.11.6])
6158
unset file
6259
])
6360
OPAL_VAR_SCOPE_POP

orte/mca/ess/base/ess_base_fns.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,26 @@ int orte_ess_base_proc_binding(void)
232232
goto error;
233233
}
234234
if (OPAL_BIND_TO_L1CACHE == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
235+
#if HWLOC_API_VERSION < 0x20000
235236
target = HWLOC_OBJ_CACHE;
236237
cache_level = 1;
238+
#else
239+
target = HWLOC_OBJ_L1CACHE;
240+
#endif
237241
} else if (OPAL_BIND_TO_L2CACHE == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
242+
#if HWLOC_API_VERSION < 0x20000
238243
target = HWLOC_OBJ_CACHE;
239244
cache_level = 2;
245+
#else
246+
target = HWLOC_OBJ_L2CACHE;
247+
#endif
240248
} else if (OPAL_BIND_TO_L3CACHE == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
249+
#if HWLOC_API_VERSION < 0x20000
241250
target = HWLOC_OBJ_CACHE;
242251
cache_level = 3;
252+
#else
253+
target = HWLOC_OBJ_L3CACHE;
254+
#endif
243255
} else if (OPAL_BIND_TO_SOCKET == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
244256
target = HWLOC_OBJ_SOCKET;
245257
} else if (OPAL_BIND_TO_NUMA == OPAL_GET_BINDING_POLICY(opal_hwloc_binding_policy)) {
@@ -251,9 +263,11 @@ int orte_ess_base_proc_binding(void)
251263
}
252264
for (obj = obj->parent; NULL != obj; obj = obj->parent) {
253265
if (target == obj->type) {
266+
#if HWLOC_API_VERSION < 0x20000
254267
if (HWLOC_OBJ_CACHE == target && cache_level != obj->attr->cache.depth) {
255268
continue;
256269
}
270+
#endif
257271
/* this is the place! */
258272
cpus = obj->cpuset;
259273
if (0 > hwloc_set_cpubind(opal_hwloc_topology, cpus, 0)) {

0 commit comments

Comments
 (0)