Skip to content

Commit 08e41ed

Browse files
committed
Raise min required HWLOC version to 2.1.0
We no longer support all the way to pre-StoneAge versions. Signed-off-by: Ralph Castain <rhc@pmix.org>
1 parent 05ffb2d commit 08e41ed

File tree

6 files changed

+8
-181
lines changed

6 files changed

+8
-181
lines changed

.github/workflows/builds.yaml

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -95,38 +95,6 @@ jobs:
9595
make install
9696
make uninstall
9797
98-
ubuntu-oldHWLOC:
99-
runs-on: ubuntu-latest
100-
steps:
101-
- name: Install dependencies
102-
run: |
103-
sudo apt-get update
104-
sudo apt-get install -y --no-install-recommends software-properties-common libevent-dev
105-
- name: Git clone HWLOC v1.x
106-
uses: actions/checkout@v4
107-
with:
108-
repository: open-mpi/hwloc
109-
ref: hwloc-1.11.13
110-
- name: Build HWLOC
111-
run: |
112-
./autogen.sh
113-
./configure --prefix=$RUNNER_TEMP/hwlocinstall
114-
make -j install
115-
- name: Git clone OpenPMIx
116-
uses: actions/checkout@v3
117-
with:
118-
submodules: recursive
119-
- name: Build OpenPMIx
120-
run: |
121-
./autogen.pl
122-
./configure --prefix=${PWD}/install --with-hwloc=$RUNNER_TEMP/hwlocinstall
123-
make -j
124-
cd test
125-
make check
126-
cd ..
127-
make install
128-
make uninstall
129-
13098
distcheck:
13199
runs-on: ubuntu-latest
132100
steps:

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ greek=a1
2929
# PMIx required dependency versions.
3030
# List in x.y.z format.
3131

32-
hwloc_min_version=1.11.0
32+
hwloc_min_version=2.1.0
3333
event_min_version=2.0.21
3434
automake_min_version=1.13.4
3535
autoconf_min_version=2.69.0

config/pmix_setup_hwloc.m4

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (c) 2009-2020 Cisco Systems, Inc. All rights reserved
44
# Copyright (c) 2013 Los Alamos National Security, LLC. All rights reserved.
55
# Copyright (c) 2013-2020 Intel, Inc. All rights reserved.
6-
# Copyright (c) 2021-2023 Nanook Consulting. All rights reserved.
6+
# Copyright (c) 2021-2024 Nanook Consulting All rights reserved.
77
# Copyright (c) 2021-2022 Amazon.com, Inc. or its affiliates.
88
# All Rights reserved.
99
# $COPYRIGHT$
@@ -80,19 +80,6 @@ AC_DEFUN([PMIX_SETUP_HWLOC],[
8080
AC_MSG_WARN([PMIx requires HWLOC v$pmix_hwloc_min_version or above.])
8181
AC_MSG_ERROR([Please select a supported version and configure again])])
8282

83-
AC_MSG_CHECKING([if hwloc version is at least 2.0])
84-
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
85-
#include <hwloc.h>
86-
#if HWLOC_VERSION_MAJOR < 2
87-
#error "hwloc version is less than 2.0"
88-
#endif
89-
], [])],
90-
[AC_MSG_RESULT([yes])
91-
pmix_version_high=1],
92-
[AC_MSG_RESULT([no])
93-
pmix_version_high=0])
94-
AM_CONDITIONAL([PMIX_HWLOC_VERSION_HIGH], [test $pmix_version_high -eq 1])
95-
9683
AC_MSG_CHECKING([if hwloc version is greater than 2.x])
9784
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([
9885
#include <hwloc.h>

src/hwloc/pmix_hwloc.c

Lines changed: 3 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@
6060
#include "pmix_common.h"
6161

6262
#include "pmix_hwloc.h"
63-
#if HWLOC_API_VERSION >= 0x20000
64-
# include <hwloc/shmem.h>
65-
#endif
63+
#include <hwloc/shmem.h>
6664

6765
static bool topo_in_shmem = false;
6866
static bool passed_thru = false;
@@ -73,7 +71,6 @@ static char *testcpuset = NULL;
7371
static int pmix_hwloc_output = -1;
7472
static int pmix_hwloc_verbose = 0;
7573

76-
#if HWLOC_API_VERSION >= 0x20000
7774
static size_t shmemsize = 0;
7875
static size_t shmemaddr;
7976
static char *shmemfile = NULL;
@@ -83,13 +80,10 @@ static uint64_t amount_space_avail = 0;
8380

8481
static int enough_space(const char *filename, size_t space_req, uint64_t *space_avail,
8582
bool *result);
86-
#endif
8783
static pmix_status_t load_xml(char *xml);
8884
static char *popstr(pmix_cb_t *cb);
89-
#if HWLOC_API_VERSION >= 0x20000
9085
static size_t popsize(pmix_cb_t *cb);
9186
static void print_maps(void);
92-
#endif
9387
static pmix_topology_t *popptr(pmix_cb_t *cb);
9488
static int get_locality_string_by_depth(int d, hwloc_cpuset_t cpuset, hwloc_cpuset_t result);
9589
static int set_flags(hwloc_topology_t topo, unsigned int flags);
@@ -141,15 +135,13 @@ pmix_status_t pmix_hwloc_register(void)
141135

142136
void pmix_hwloc_finalize(void)
143137
{
144-
#if HWLOC_API_VERSION >= 0x20000
145138
if (NULL != shmemfile) {
146139
unlink(shmemfile);
147140
free(shmemfile);
148141
}
149142
if (0 <= shmemfd) {
150143
close(shmemfd);
151144
}
152-
#endif
153145
if (NULL != pmix_globals.topology.topology && !pmix_globals.external_topology
154146
&& !topo_in_shmem) {
155147
hwloc_topology_destroy(pmix_globals.topology.topology);
@@ -229,7 +221,6 @@ pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo)
229221
PMIX_LOAD_PROCID(&wildcard, pmix_globals.myid.nspace, PMIX_RANK_WILDCARD);
230222

231223
/* try to get it ourselves */
232-
#if HWLOC_API_VERSION >= 0x20000
233224
int fd;
234225
uint64_t addr, size;
235226

@@ -285,11 +276,7 @@ pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo)
285276
pmix_output_verbose(2, pmix_hwloc_output, "%s:%s shmem adopted",
286277
__FILE__, __func__);
287278
/* got it - we are done */
288-
# ifdef HWLOC_VERSION
289279
pmix_asprintf(&pmix_globals.topology.source, "hwloc:%s", HWLOC_VERSION);
290-
# else
291-
pmix_globals.topology.source = strdup("hwloc");
292-
# endif
293280
/* record locally in case someone does a PMIx_Get to retrieve it */
294281
kv.key = PMIX_TOPOLOGY2;
295282
kv.value = &val;
@@ -351,7 +338,6 @@ pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo)
351338
}
352339

353340
tryv1:
354-
#endif
355341

356342
/* try to get the v1 XML string */
357343
pmix_output_verbose(2, pmix_hwloc_output,
@@ -439,11 +425,7 @@ pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo)
439425
hwloc_topology_destroy(pmix_globals.topology.topology);
440426
return PMIX_ERR_NOT_SUPPORTED;
441427
}
442-
#ifdef HWLOC_VERSION
443428
pmix_asprintf(&pmix_globals.topology.source, "hwloc:%s", HWLOC_VERSION);
444-
#else
445-
pmix_globals.topology.source = strdup("hwloc");
446-
#endif
447429
pmix_output_verbose(2, pmix_hwloc_output,
448430
"%s:%s discovery complete - source %s", __FILE__, __func__,
449431
pmix_globals.topology.source);
@@ -469,33 +451,6 @@ pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo)
469451
"%s:%s sharing topology",
470452
__FILE__, __func__);
471453

472-
#if HWLOC_API_VERSION < 0x20000
473-
/* pass the topology string as we don't
474-
* have HWLOC shared memory available - we do
475-
* this so the procs won't read the topology
476-
* themselves as this could overwhelm the local
477-
* system on large-scale SMPs */
478-
if (0 == hwloc_topology_export_xmlbuffer(pmix_globals.topology.topology, &xmlbuffer, &len)) {
479-
pmix_output_verbose(2, pmix_hwloc_output,
480-
"%s:%s export v1 xml",
481-
__FILE__, __func__);
482-
kptr = PMIX_NEW(pmix_kval_t);
483-
kptr->key = strdup(PMIX_HWLOC_XML_V1);
484-
kptr->value = (pmix_value_t *) malloc(sizeof(pmix_value_t));
485-
PMIX_VALUE_LOAD(kptr->value, xmlbuffer, PMIX_STRING);
486-
pmix_list_append(&pmix_server_globals.gdata, &kptr->super);
487-
/* save it with the deprecated key for older RMs */
488-
kptr = PMIX_NEW(pmix_kval_t);
489-
kptr->key = strdup(PMIX_LOCAL_TOPO);
490-
kptr->value = (pmix_value_t *) malloc(sizeof(pmix_value_t));
491-
PMIX_VALUE_LOAD(kptr->value, xmlbuffer, PMIX_STRING);
492-
pmix_list_append(&pmix_server_globals.gdata, &kptr->super);
493-
/* done with the buffer */
494-
hwloc_free_xmlbuffer(pmix_globals.topology.topology, xmlbuffer);
495-
}
496-
/* we don't have the ability to do shared memory, so we are done */
497-
return PMIX_SUCCESS;
498-
#else
499454
/* pass the topology as a v2 xml string */
500455
if (0 == hwloc_topology_export_xmlbuffer(pmix_globals.topology.topology, &xmlbuffer, &len, 0)) {
501456
pmix_output_verbose(2, pmix_hwloc_output, "%s:%s export v2 xml",
@@ -624,8 +579,6 @@ pmix_status_t pmix_hwloc_setup_topology(pmix_info_t *info, size_t ninfo)
624579
PMIX_VALUE_LOAD(kptr->value, &shmemsize, PMIX_SIZE);
625580
pmix_list_append(&pmix_server_globals.gdata, &kptr->super);
626581

627-
#endif
628-
629582
return PMIX_SUCCESS;
630583
}
631584

@@ -790,11 +743,7 @@ pmix_status_t pmix_hwloc_generate_locality_string(const pmix_cpuset_t *cpuset, c
790743
type = hwloc_get_depth_type(pmix_globals.topology.topology, d);
791744
/* if it isn't one of interest, then ignore it */
792745
if (HWLOC_OBJ_NUMANODE != type && HWLOC_OBJ_PACKAGE != type &&
793-
#if HWLOC_API_VERSION < 0x20000
794-
HWLOC_OBJ_CACHE != type &&
795-
#else
796746
HWLOC_OBJ_L1CACHE != type && HWLOC_OBJ_L2CACHE != type && HWLOC_OBJ_L3CACHE != type &&
797-
#endif
798747
HWLOC_OBJ_CORE != type && HWLOC_OBJ_PU != type) {
799748
continue;
800749
}
@@ -822,34 +771,6 @@ pmix_status_t pmix_hwloc_generate_locality_string(const pmix_cpuset_t *cpuset, c
822771
}
823772
locality = t2;
824773
break;
825-
#if HWLOC_API_VERSION < 0x20000
826-
case HWLOC_OBJ_CACHE: {
827-
unsigned cachedepth = hwloc_get_obj_by_depth(pmix_globals.topology.topology, d, 0)
828-
->attr->cache.depth;
829-
if (3 == cachedepth) {
830-
pmix_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp);
831-
if (NULL != locality) {
832-
free(locality);
833-
}
834-
locality = t2;
835-
break;
836-
} else if (2 == cachedepth) {
837-
pmix_asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp);
838-
if (NULL != locality) {
839-
free(locality);
840-
}
841-
locality = t2;
842-
break;
843-
} else {
844-
pmix_asprintf(&t2, "%sL1%s:", (NULL == locality) ? "" : locality, tmp);
845-
if (NULL != locality) {
846-
free(locality);
847-
}
848-
locality = t2;
849-
break;
850-
}
851-
} break;
852-
#else
853774
case HWLOC_OBJ_L3CACHE:
854775
pmix_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp);
855776
if (NULL != locality) {
@@ -871,7 +792,6 @@ pmix_status_t pmix_hwloc_generate_locality_string(const pmix_cpuset_t *cpuset, c
871792
}
872793
locality = t2;
873794
break;
874-
#endif
875795
case HWLOC_OBJ_CORE:
876796
pmix_asprintf(&t2, "%sCR%s:", (NULL == locality) ? "" : locality, tmp);
877797
if (NULL != locality) {
@@ -895,7 +815,6 @@ pmix_status_t pmix_hwloc_generate_locality_string(const pmix_cpuset_t *cpuset, c
895815
hwloc_bitmap_zero(result);
896816
}
897817

898-
#if HWLOC_API_VERSION >= 0x20000
899818
if (get_locality_string_by_depth(HWLOC_TYPE_DEPTH_NUMANODE, cpuset->bitmap, result) == 0) {
900819
/* it should be impossible, but allow for the possibility
901820
* that we came up empty at this depth */
@@ -910,7 +829,6 @@ pmix_status_t pmix_hwloc_generate_locality_string(const pmix_cpuset_t *cpuset, c
910829
}
911830
hwloc_bitmap_zero(result);
912831
}
913-
#endif
914832

915833
hwloc_bitmap_free(result);
916834

@@ -1082,9 +1000,7 @@ static pmix_type_conversion_t table[] = {
10821000
{.hwtype = HWLOC_OBJ_OSDEV_NETWORK, .pxtype = PMIX_DEVTYPE_NETWORK, .name = "NETWORK"},
10831001
{.hwtype = HWLOC_OBJ_OSDEV_OPENFABRICS, .pxtype = PMIX_DEVTYPE_OPENFABRICS, .name = "OPENFABRICS"},
10841002
{.hwtype = HWLOC_OBJ_OSDEV_DMA, .pxtype = PMIX_DEVTYPE_DMA, .name = "DMA"},
1085-
#if HWLOC_API_VERSION >= 0x00010800
10861003
{.hwtype = HWLOC_OBJ_OSDEV_COPROC, .pxtype = PMIX_DEVTYPE_COPROC, .name = "COPROCESSOR"},
1087-
#endif
10881004
};
10891005

10901006
static int countcolons(char *str)
@@ -1189,9 +1105,7 @@ pmix_status_t pmix_hwloc_compute_distances(pmix_topology_t *topo, pmix_cpuset_t
11891105
continue;
11901106
}
11911107
if (HWLOC_OBJ_OSDEV_BLOCK == table[n].hwtype || HWLOC_OBJ_OSDEV_DMA == table[n].hwtype
1192-
#if HWLOC_API_VERSION >= 0x00010800
11931108
|| HWLOC_OBJ_OSDEV_COPROC == table[n].hwtype
1194-
#endif
11951109
) {
11961110
continue;
11971111
}
@@ -1394,29 +1308,20 @@ pmix_status_t pmix_hwloc_check_vendor(pmix_topology_t *topo,
13941308

13951309
static int set_flags(hwloc_topology_t topo, unsigned int flags)
13961310
{
1397-
#if HWLOC_API_VERSION < 0x20000
1398-
flags = HWLOC_TOPOLOGY_FLAG_IO_DEVICES;
1399-
#else
14001311
int ret = hwloc_topology_set_io_types_filter(topo, HWLOC_TYPE_FILTER_KEEP_IMPORTANT);
1401-
if (0 != ret)
1312+
if (0 != ret) {
14021313
return ret;
1403-
#endif
1314+
}
14041315
if (0 != hwloc_topology_set_flags(topo, flags)) {
14051316
return PMIX_ERR_INIT;
14061317
}
1407-
#ifdef HWLOC_VERSION_MAJOR
14081318
// Blacklist the "gl" component due to potential conflicts.
14091319
// See "https://github.com/open-mpi/ompi/issues/10025" for
14101320
// an explanation. Sadly, HWLOC doesn't define version numbers
14111321
// until v2.0, so we cannot check versions here. Fortunately,
14121322
// the blacklist ability was added in HWLOC v2.1, so we can't
14131323
// do it for earlier versions anyway.
1414-
#if HWLOC_VERSION_MAJOR > 2
1415-
hwloc_topology_set_components(topo, HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST, "gl");
1416-
#elif HWLOC_VERSION_MAJOR == 2 && HWLOC_VERSION_MINOR >= 1
14171324
hwloc_topology_set_components(topo, HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST, "gl");
1418-
#endif
1419-
#endif
14201325

14211326
return PMIX_SUCCESS;
14221327
}
@@ -1444,7 +1349,6 @@ static char *popstr(pmix_cb_t *cb)
14441349
return str;
14451350
}
14461351

1447-
#if HWLOC_API_VERSION >= 0x20000
14481352
static size_t popsize(pmix_cb_t *cb)
14491353
{
14501354
pmix_list_t *kvs = &cb->kvs;
@@ -1466,7 +1370,6 @@ static size_t popsize(pmix_cb_t *cb)
14661370
}
14671371
return sz;
14681372
}
1469-
#endif
14701373

14711374
static pmix_topology_t *popptr(pmix_cb_t *cb)
14721375
{
@@ -1517,7 +1420,6 @@ static pmix_status_t load_xml(char *xml)
15171420
return PMIX_SUCCESS;
15181421
}
15191422

1520-
#if HWLOC_API_VERSION >= 0x20000
15211423
static void print_maps(void)
15221424
{
15231425

@@ -1535,7 +1437,6 @@ static void print_maps(void)
15351437
fclose(maps_file);
15361438
}
15371439
}
1538-
#endif
15391440

15401441
static int get_locality_string_by_depth(int d, hwloc_cpuset_t cpuset, hwloc_cpuset_t result)
15411442
{
@@ -1563,7 +1464,6 @@ static int get_locality_string_by_depth(int d, hwloc_cpuset_t cpuset, hwloc_cpus
15631464
return 0;
15641465
}
15651466

1566-
#if HWLOC_API_VERSION >= 0x20000
15671467
static int enough_space(const char *filename, size_t space_req, uint64_t *space_avail, bool *result)
15681468
{
15691469
uint64_t avail = 0;
@@ -1599,4 +1499,3 @@ static int enough_space(const char *filename, size_t space_req, uint64_t *space_
15991499
*space_avail = avail;
16001500
return rc;
16011501
}
1602-
#endif

0 commit comments

Comments
 (0)