Skip to content

Commit dc0d6a5

Browse files
authored
Merge pull request #7366 from bgoglin/master
Fix hwloc <v2.0 compilation issue
2 parents 395e2c9 + 329d445 commit dc0d6a5

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

opal/mca/hwloc/base/hwloc_base_util.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
* All rights reserved.
2121
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
2222
* Copyright (c) 2019 IBM Corporation. All rights reserved.
23-
* Copyright (c) 2019 Inria. All rights reserved.
23+
* Copyright (c) 2019-2020 Inria. All rights reserved.
2424
* $COPYRIGHT$
2525
*
2626
* Additional copyrights may follow
@@ -1388,9 +1388,10 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
13881388
*/
13891389
char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo)
13901390
{
1391+
#if HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC
13911392
hwloc_obj_t osdev;
1392-
unsigned i;
13931393
char **cps = NULL;
1394+
#endif
13941395
char *cpstring = NULL;
13951396
int depth;
13961397

@@ -1408,6 +1409,7 @@ char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo)
14081409
while (NULL != osdev) {
14091410
if (HWLOC_OBJ_OSDEV_COPROC == osdev->attr->osdev.type) {
14101411
/* got one! find and save its serial number */
1412+
unsigned i;
14111413
for (i=0; i < osdev->infos_count; i++) {
14121414
if (0 == strncmp(osdev->infos[i].name, "MICSerialNumber", strlen("MICSerialNumber"))) {
14131415
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
@@ -2203,15 +2205,16 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
22032205
locality = t2;
22042206
break;
22052207
#if HWLOC_API_VERSION < 0x20000
2206-
case HWLOC_OBJ_CACHE:
2207-
if (3 == obj->attr->cache.depth) {
2208+
case HWLOC_OBJ_CACHE: {
2209+
unsigned cachedepth = hwloc_get_obj_by_depth(topo, d, 0)->attr->cache.depth;
2210+
if (3 == cachedepth) {
22082211
opal_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp);
22092212
if (NULL != locality) {
22102213
free(locality);
22112214
}
22122215
locality = t2;
22132216
break;
2214-
} else if (2 == obj->attr->cache.depth) {
2217+
} else if (2 == cachedepth) {
22152218
opal_asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp);
22162219
if (NULL != locality) {
22172220
free(locality);
@@ -2227,6 +2230,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
22272230
break;
22282231
}
22292232
break;
2233+
}
22302234
#else
22312235
case HWLOC_OBJ_L3CACHE:
22322236
opal_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp);

0 commit comments

Comments
 (0)