Skip to content

Commit 5a2c9ed

Browse files
authored
Merge pull request #8880 from rhc54/topic/hwl
Be more robust in getting hwloc topology
2 parents 976aef1 + d62f37a commit 5a2c9ed

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

opal/mca/hwloc/base/hwloc_base_util.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
2222
* Copyright (c) 2019-2021 IBM Corporation. All rights reserved.
2323
* Copyright (c) 2019-2020 Inria. All rights reserved.
24+
* Copyright (c) 2021 Nanook Consulting. All rights reserved.
2425
* $COPYRIGHT$
2526
*
2627
* Additional copyrights may follow
@@ -369,25 +370,28 @@ int opal_hwloc_base_get_topology(void)
369370
return OPAL_ERROR;
370371
}
371372
if (0 != hwloc_topology_set_xmlbuffer(opal_hwloc_topology, val, strlen(val) + 1)) {
373+
/* default to discovery */
372374
free(val);
373375
hwloc_topology_destroy(opal_hwloc_topology);
374-
return OPAL_ERROR;
376+
goto discover;
375377
}
376378
/* since we are loading this from an external source, we have to
377379
* explicitly set a flag so hwloc sets things up correctly
378380
*/
379381
if (0
380382
!= opal_hwloc_base_topology_set_flags(opal_hwloc_topology,
381383
HWLOC_TOPOLOGY_FLAG_IS_THISSYSTEM, true)) {
384+
/* default to discovery */
382385
hwloc_topology_destroy(opal_hwloc_topology);
383386
free(val);
384-
return OPAL_ERROR;
387+
goto discover;
385388
}
386389
/* now load the topology */
387390
if (0 != hwloc_topology_load(opal_hwloc_topology)) {
391+
/* default to discovery */
388392
hwloc_topology_destroy(opal_hwloc_topology);
389393
free(val);
390-
return OPAL_ERROR;
394+
goto discover;
391395
}
392396
free(val);
393397
/* filter the cpus thru any default cpu set */
@@ -396,6 +400,7 @@ int opal_hwloc_base_get_topology(void)
396400
return rc;
397401
}
398402
} else {
403+
discover:
399404
opal_output_verbose(1, opal_hwloc_base_framework.framework_output,
400405
"hwloc:base discovering topology");
401406
if (0 != hwloc_topology_init(&opal_hwloc_topology)

0 commit comments

Comments
 (0)