From f9ed7acde206980f758e2ec6ba045bcfd453e339 Mon Sep 17 00:00:00 2001 From: Ian Henriksen Date: Thu, 13 Mar 2025 10:57:16 -0600 Subject: [PATCH] Fix a bug where the value of HWLOC_GET_TOPOLOGY_FUNCTION wasn't getting properly routed through our CMake config back into the relevant places in the source files. --- src/affinity/binders.c | 4 ++++ src/affinity/hwloc.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/affinity/binders.c b/src/affinity/binders.c index 87d7a8f17..b2444c94e 100644 --- a/src/affinity/binders.c +++ b/src/affinity/binders.c @@ -87,6 +87,10 @@ static int qt_affinity_compact(int num_workers, hwloc_obj_t obj) { void INTERNAL qt_affinity_init(qthread_shepherd_id_t *nbshepherds, qthread_worker_id_t *nbworkers, size_t *hw_par) { +#ifdef HWLOC_GET_TOPOLOGY_FUNCTION + extern void *HWLOC_GET_TOPOLOGY_FUNCTION; + topology = (hwloc_topology_t)HWLOC_GET_TOPOLOGY_FUNCTION; +#endif // Note: the lack of a teardown routine will cause topology initialization // to be skipped if qthreads is re-initialized if (topology == NULL) { diff --git a/src/affinity/hwloc.c b/src/affinity/hwloc.c index eb8ac5b1f..ea03ed6d6 100644 --- a/src/affinity/hwloc.c +++ b/src/affinity/hwloc.c @@ -86,6 +86,10 @@ void INTERNAL qt_affinity_init(qthread_shepherd_id_t *nbshepherds, qthread_worker_id_t *nbworkers, size_t *hw_par) { if (qthread_cas(&initialized, 0, 1) == 0) { +#ifdef HWLOC_GET_TOPOLOGY_FUNCTION + extern void *HWLOC_GET_TOPOLOGY_FUNCTION; + topology = (hwloc_topology_t)HWLOC_GET_TOPOLOGY_FUNCTION; +#endif if (topology == NULL) { qassert(hwloc_topology_init(&topology), 0); qassert(hwloc_topology_load(topology), 0);