20
20
* All rights reserved.
21
21
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
22
22
* 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.
24
24
* $COPYRIGHT$
25
25
*
26
26
* Additional copyrights may follow
@@ -1388,9 +1388,10 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
1388
1388
*/
1389
1389
char * opal_hwloc_base_find_coprocessors (hwloc_topology_t topo )
1390
1390
{
1391
+ #if HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC
1391
1392
hwloc_obj_t osdev ;
1392
- unsigned i ;
1393
1393
char * * cps = NULL ;
1394
+ #endif
1394
1395
char * cpstring = NULL ;
1395
1396
int depth ;
1396
1397
@@ -1408,6 +1409,7 @@ char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo)
1408
1409
while (NULL != osdev ) {
1409
1410
if (HWLOC_OBJ_OSDEV_COPROC == osdev -> attr -> osdev .type ) {
1410
1411
/* got one! find and save its serial number */
1412
+ unsigned i ;
1411
1413
for (i = 0 ; i < osdev -> infos_count ; i ++ ) {
1412
1414
if (0 == strncmp (osdev -> infos [i ].name , "MICSerialNumber" , strlen ("MICSerialNumber" ))) {
1413
1415
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,
2203
2205
locality = t2 ;
2204
2206
break ;
2205
2207
#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 ) {
2208
2211
opal_asprintf (& t2 , "%sL3%s:" , (NULL == locality ) ? "" : locality , tmp );
2209
2212
if (NULL != locality ) {
2210
2213
free (locality );
2211
2214
}
2212
2215
locality = t2 ;
2213
2216
break ;
2214
- } else if (2 == obj -> attr -> cache . depth ) {
2217
+ } else if (2 == cachedepth ) {
2215
2218
opal_asprintf (& t2 , "%sL2%s:" , (NULL == locality ) ? "" : locality , tmp );
2216
2219
if (NULL != locality ) {
2217
2220
free (locality );
@@ -2227,6 +2230,7 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
2227
2230
break ;
2228
2231
}
2229
2232
break ;
2233
+ }
2230
2234
#else
2231
2235
case HWLOC_OBJ_L3CACHE :
2232
2236
opal_asprintf (& t2 , "%sL3%s:" , (NULL == locality ) ? "" : locality , tmp );
0 commit comments