From 87620c233206556dc756876825213a572cac2025 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 15 Oct 2024 15:35:02 -0600 Subject: [PATCH] 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 --- VERSION | 2 +- .../show-help-files/help-prte-hwloc-base.txt | 1 - src/hwloc/hwloc-internal.h | 62 +--- src/hwloc/hwloc.c | 11 - src/hwloc/hwloc_base_util.c | 283 ++---------------- src/mca/odls/base/odls_base_bind.c | 4 - src/mca/plm/base/plm_base_launch_support.c | 20 +- src/mca/rmaps/base/rmaps_base_binding.c | 57 +--- src/mca/rmaps/base/rmaps_base_map_job.c | 47 ++- src/mca/rmaps/base/rmaps_base_ranking.c | 18 +- src/mca/rmaps/base/rmaps_base_support_fns.c | 4 - src/mca/rmaps/ppr/rmaps_ppr.c | 19 +- src/mca/rmaps/rank_file/rmaps_rank_file.c | 4 - src/mca/rmaps/rmaps_types.h | 2 - src/mca/rmaps/round_robin/rmaps_rr_mappers.c | 8 +- src/mca/state/dvm/state_dvm.c | 4 - src/prted/pmix/pmix_server_queries.c | 19 -- src/prted/pmix/pmix_server_register_fns.c | 4 - 18 files changed, 70 insertions(+), 499 deletions(-) diff --git a/VERSION b/VERSION index 1c39e5efaf..4b740ad379 100644 --- a/VERSION +++ b/VERSION @@ -23,7 +23,7 @@ release=0 # List in x.y.z format. pmix_min_version=4.2.4 -hwloc_min_version=1.11.0 +hwloc_min_version=2.1.0 event_min_version=2.0.21 automake_min_version=1.13.4 autoconf_min_version=2.69.0 diff --git a/src/docs/show-help-files/help-prte-hwloc-base.txt b/src/docs/show-help-files/help-prte-hwloc-base.txt index 21f182c249..8a1bc4e605 100644 --- a/src/docs/show-help-files/help-prte-hwloc-base.txt +++ b/src/docs/show-help-files/help-prte-hwloc-base.txt @@ -50,7 +50,6 @@ unusual error; it may indicate a system configuration error. This additional information may be of help: Message: %s - Cache level: %d [missing-cpulist] diff --git a/src/hwloc/hwloc-internal.h b/src/hwloc/hwloc-internal.h index 8337274a47..46fcb7deec 100644 --- a/src/hwloc/hwloc-internal.h +++ b/src/hwloc/hwloc-internal.h @@ -7,7 +7,7 @@ * Copyright (c) 2018 Research Organization for Information Science * and Technology (RIST). All rights reserved. * - * Copyright (c) 2021-2023 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2024 Nanook Consulting All rights reserved. * Copyright (c) 2023 Advanced Micro Devices, Inc. All rights reserved. * $COPYRIGHT$ * @@ -28,24 +28,7 @@ #include #include #include -#if HWLOC_API_VERSION >= 0x20000 -# include -#endif - -#if HWLOC_API_VERSION < 0x10b00 -#define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE -#define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET -#endif -#if HWLOC_API_VERSION < 0x10a00 -static inline hwloc_obj_t hwloc_get_numanode_obj_by_os_index(hwloc_topology_t topology, unsigned os_index) -{ - hwloc_obj_t obj = NULL; - while ((obj = hwloc_get_next_obj_by_type(topology, HWLOC_OBJ_NUMANODE, obj)) != NULL) - if (obj->os_index == os_index) - return obj; - return NULL; -} -#endif +#include #include "src/class/pmix_list.h" #include "src/class/pmix_value_array.h" @@ -161,20 +144,6 @@ PRTE_EXPORT extern hwloc_obj_type_t prte_hwloc_levels[]; PRTE_EXPORT extern char *prte_hwloc_default_cpu_list; PRTE_EXPORT extern bool prte_hwloc_default_use_hwthread_cpus; -#if HWLOC_API_VERSION < 0x20000 -# define HWLOC_OBJ_L3CACHE HWLOC_OBJ_CACHE -# define HWLOC_OBJ_L2CACHE HWLOC_OBJ_CACHE -# define HWLOC_OBJ_L1CACHE HWLOC_OBJ_CACHE -# if HWLOC_API_VERSION < 0x10a00 -# define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET -# endif -# define HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC 0 -# define HAVE_HWLOC_TOPOLOGY_DUP 0 -#else -# define HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC 1 -# define HAVE_HWLOC_TOPOLOGY_DUP 1 -#endif - /** * Debugging output stream */ @@ -210,20 +179,6 @@ PRTE_EXPORT extern bool prte_hwloc_synthetic_topo; hwloc_bitmap_free(bind); \ } while (0); -#if HWLOC_API_VERSION < 0x20000 -# define PRTE_HWLOC_MAKE_OBJ_CACHE(level, obj, cache_level) \ - do { \ - obj = HWLOC_OBJ_CACHE; \ - cache_level = level; \ - } while (0) -#else -# define PRTE_HWLOC_MAKE_OBJ_CACHE(level, obj, cache_level) \ - do { \ - obj = HWLOC_OBJ_L##level##CACHE; \ - cache_level = 0; \ - } while (0) -#endif - PRTE_EXPORT prte_hwloc_locality_t prte_hwloc_base_get_relative_locality(hwloc_topology_t topo, char *cpuset1, char *cpuset2); @@ -283,17 +238,6 @@ PRTE_EXPORT hwloc_cpuset_t prte_hwloc_base_generate_cpuset(hwloc_topology_t topo PRTE_EXPORT hwloc_cpuset_t prte_hwloc_base_filter_cpus(hwloc_topology_t topo); -/** - * Free the hwloc topology. - */ -PRTE_EXPORT unsigned int prte_hwloc_base_get_nbobjs_by_type(hwloc_topology_t topo, - hwloc_obj_type_t target, - unsigned cache_level); - -PRTE_EXPORT hwloc_obj_t prte_hwloc_base_get_obj_by_type(hwloc_topology_t topo, - hwloc_obj_type_t target, - unsigned cache_level, - unsigned int instance); PRTE_EXPORT unsigned int prte_hwloc_base_get_obj_idx(hwloc_topology_t topo, hwloc_obj_t obj); /** @@ -354,7 +298,7 @@ PRTE_EXPORT char *prte_hwloc_base_cset2str(hwloc_const_cpuset_t cpuset, PRTE_EXPORT void prte_hwloc_get_binding_info(hwloc_const_cpuset_t cpuset, bool use_hwthread_cpus, - hwloc_topology_t topo, int *pkgnum, + hwloc_topology_t topo, int *pkgnum, char *cores, int sz); /* get the hwloc object that corresponds to the given processor id and type */ diff --git a/src/hwloc/hwloc.c b/src/hwloc/hwloc.c index 9cf23c9339..767a012833 100644 --- a/src/hwloc/hwloc.c +++ b/src/hwloc/hwloc.c @@ -377,23 +377,12 @@ int prte_hwloc_base_set_default_binding(void *jd, void *opt) PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_PACKAGE); } else if (HWLOC_OBJ_NUMANODE== options->maptype) { PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_NUMA); -#if HWLOC_API_VERSION < 0x20000 - } else if (HWLOC_OBJ_CACHE == options->maptype) { - if (1 == options->cmaplvl) { - PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_L1CACHE); - } else if (2 == options->cmaplvl) { - PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_L2CACHE); - } else if (3 == options->cmaplvl) { - PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_L3CACHE); - } -#else } else if (HWLOC_OBJ_L1CACHE == options->maptype) { PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_L1CACHE); } else if (HWLOC_OBJ_L2CACHE == options->maptype) { PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_L2CACHE); } else if (HWLOC_OBJ_L3CACHE == options->maptype) { PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_L3CACHE); -#endif } else if (HWLOC_OBJ_CORE == options->maptype) { PRTE_SET_DEFAULT_BINDING_POLICY(jdata->map->binding, PRTE_BIND_TO_CORE); } else if (HWLOC_OBJ_PU == options->maptype) { diff --git a/src/hwloc/hwloc_base_util.c b/src/hwloc/hwloc_base_util.c index c99b67548c..d0ab6c317e 100644 --- a/src/hwloc/hwloc_base_util.c +++ b/src/hwloc/hwloc_base_util.c @@ -145,11 +145,7 @@ hwloc_cpuset_t prte_hwloc_base_generate_cpuset(hwloc_topology_t topo, /* only one cpu given - get that object */ cpu = strtoul(range[0], NULL, 10); if (NULL != (pu = prte_hwloc_base_get_pu(topo, use_hwthread_cpus, cpu))) { -#if HWLOC_API_VERSION < 0x20000 - hwloc_bitmap_and(pucpus, pu->online_cpuset, pu->allowed_cpuset); -#else hwloc_bitmap_and(pucpus, pu->cpuset, hwloc_topology_get_allowed_cpuset(topo)); -#endif hwloc_bitmap_or(res, avail, pucpus); hwloc_bitmap_copy(avail, res); } @@ -160,11 +156,7 @@ hwloc_cpuset_t prte_hwloc_base_generate_cpuset(hwloc_topology_t topo, end = strtoul(range[1], NULL, 10); for (cpu = start; cpu <= end; cpu++) { if (NULL != (pu = prte_hwloc_base_get_pu(topo, use_hwthread_cpus, cpu))) { -#if HWLOC_API_VERSION < 0x20000 - hwloc_bitmap_and(pucpus, pu->online_cpuset, pu->allowed_cpuset); -#else hwloc_bitmap_and(pucpus, pu->cpuset, hwloc_topology_get_allowed_cpuset(topo)); -#endif hwloc_bitmap_or(res, avail, pucpus); hwloc_bitmap_copy(avail, res); } @@ -191,24 +183,7 @@ hwloc_cpuset_t prte_hwloc_base_setup_summary(hwloc_topology_t topo) avail = hwloc_bitmap_alloc(); /* get the root available cpuset */ -#if HWLOC_API_VERSION < 0x20000 - hwloc_obj_t root; - root = hwloc_get_root_obj(topo); - - if (NULL == root->online_cpuset && NULL == root->allowed_cpuset) { - /* we are hosed */ - return NULL; - } - if (NULL == root->online_cpuset) { - hwloc_bitmap_copy(avail, root->allowed_cpuset); - } else if (NULL == root->allowed_cpuset) { - hwloc_bitmap_copy(avail, root->online_cpuset); - } else { - hwloc_bitmap_and(avail, root->online_cpuset, root->allowed_cpuset); - } -#else hwloc_bitmap_copy(avail, hwloc_topology_get_allowed_cpuset(topo)); -#endif return avail; } @@ -245,7 +220,7 @@ static void fill_cache_line_size(void) while (cache_level > 0 && !found) { i = 0; while (1) { - obj = prte_hwloc_base_get_obj_by_type(prte_hwloc_topology, cache_object, cache_level, i); + obj = hwloc_get_obj_by_type(prte_hwloc_topology, cache_object, i); if (NULL == obj) { --cache_level; cache_object = HWLOC_OBJ_L1CACHE; @@ -473,153 +448,30 @@ unsigned int prte_hwloc_base_get_npus(hwloc_topology_t topo, bool use_hwthread_c unsigned int prte_hwloc_base_get_obj_idx(hwloc_topology_t topo, hwloc_obj_t obj) { - unsigned cache_level = 0; hwloc_obj_t ptr; unsigned int nobjs, i; PMIX_OUTPUT_VERBOSE((5, prte_hwloc_base_output, "hwloc:base:get_idx")); -#if HWLOC_API_VERSION < 0x20000 - /* determine the number of objects of this type */ - if (HWLOC_OBJ_CACHE == obj->type) { - cache_level = obj->attr->cache.depth; - } -#endif - - nobjs = prte_hwloc_base_get_nbobjs_by_type(topo, obj->type, cache_level); + nobjs = hwloc_get_nbobjs_by_type(topo, obj->type); PMIX_OUTPUT_VERBOSE((5, prte_hwloc_base_output, - "hwloc:base:get_idx found %u objects of type %s:%u", nobjs, - hwloc_obj_type_string(obj->type), cache_level)); + "hwloc:base:get_idx found %u objects of type %s", nobjs, + hwloc_obj_type_string(obj->type))); /* find this object */ for (i = 0; i < nobjs; i++) { - ptr = prte_hwloc_base_get_obj_by_type(topo, obj->type, cache_level, i); + ptr = hwloc_get_obj_by_type(topo, obj->type, i); if (ptr == obj) { return i; } } /* if we get here, it wasn't found */ pmix_show_help("help-prte-hwloc-base.txt", "obj-idx-failed", true, - hwloc_obj_type_string(obj->type), cache_level); + hwloc_obj_type_string(obj->type)); return UINT_MAX; } -#if HWLOC_API_VERSION < 0x20000 -/* hwloc treats cache objects as special - * cases. Instead of having a unique type for each cache level, - * there is a single cache object type, and the level is encoded - * in an attribute union. So looking for cache objects involves - * a multi-step test :-( - */ -static hwloc_obj_t df_search(hwloc_topology_t topo, hwloc_obj_t start, hwloc_obj_type_t target, - unsigned cache_level, unsigned int nobj, unsigned int *num_objs) -{ - int search_depth; - PRTE_HIDE_UNUSED_PARAMS(start); - - search_depth = hwloc_get_type_depth(topo, target); - if (HWLOC_TYPE_DEPTH_MULTIPLE == search_depth) { - /* either v1.x Cache, or Groups */ - if (cache_level != HWLOC_OBJ_CACHE) { - return NULL; - } - search_depth = hwloc_get_cache_type_depth(topo, cache_level, (hwloc_obj_cache_type_t) -1); - } - if (HWLOC_TYPE_DEPTH_UNKNOWN == search_depth) { - return NULL; - } - - if (num_objs) { - *num_objs = hwloc_get_nbobjs_by_depth(topo, search_depth); - } - return hwloc_get_obj_by_depth(topo, search_depth, nobj); -} -#endif - -unsigned int prte_hwloc_base_get_nbobjs_by_type(hwloc_topology_t topo, hwloc_obj_type_t target, - unsigned cache_level) -{ - int rc; -#if HWLOC_API_VERSION >= 0x20000 - PRTE_HIDE_UNUSED_PARAMS(cache_level); -#endif - - /* bozo check */ - if (NULL == topo) { - PMIX_OUTPUT_VERBOSE((5, prte_hwloc_base_output, "hwloc:base:get_nbobjs NULL topology")); - return 0; - } - -#if HWLOC_API_VERSION >= 0x20000 - if (0 > (rc = hwloc_get_nbobjs_by_type(topo, target))) { - pmix_output(0, "UNKNOWN HWLOC ERROR"); - return 0; - } - return rc; -#else - unsigned int num_objs; - hwloc_obj_t obj; - - /* we can just use the hwloc accessor to get it, - * unless it is a CACHE as these are treated as special cases - */ - if (HWLOC_OBJ_CACHE != target) { - /* we should not get an error back, but just in case... */ - if (0 > (rc = hwloc_get_nbobjs_by_type(topo, target))) { - pmix_output(0, "UNKNOWN HWLOC ERROR"); - return 0; - } - return rc; - } - - /* for everything else, we have to do some work */ - num_objs = 0; - obj = hwloc_get_root_obj(topo); - - df_search(topo, obj, target, cache_level, 0, &num_objs); - - PMIX_OUTPUT_VERBOSE((5, prte_hwloc_base_output, - "hwloc:base:get_nbojbs computed data %u of %s:%u", num_objs, - hwloc_obj_type_string(target), cache_level)); - - return num_objs; -#endif -} - -/* as above, only return the Nth instance of the specified object - * type from inside the topology - */ -hwloc_obj_t prte_hwloc_base_get_obj_by_type(hwloc_topology_t topo, hwloc_obj_type_t target, - unsigned cache_level, unsigned int instance) -{ -#if HWLOC_API_VERSION >= 0x20000 - PRTE_HIDE_UNUSED_PARAMS(cache_level); -#endif - - /* bozo check */ - if (NULL == topo) { - return NULL; - } - -#if HWLOC_API_VERSION >= 0x20000 - return hwloc_get_obj_by_type(topo, target, instance); -#else - hwloc_obj_t obj; - - /* we can just use the hwloc accessor to get it, unless it is a CACHE - * as these are treated as special cases - */ - if (HWLOC_OBJ_CACHE != target) { - return hwloc_get_obj_by_type(topo, target, instance); - } - - /* for everything else, we have to do some work */ - obj = hwloc_get_root_obj(topo); - return df_search(topo, obj, target, cache_level, instance, NULL); -#endif -} - /* The current slot_list notation only goes to the core level - i.e., the location * is specified as package:core. Thus, the code below assumes that all locations * are to be parsed under that notation. @@ -648,7 +500,7 @@ static int package_to_cpu_set(char *cpus, hwloc_topology_t topo, hwloc_bitmap_t switch (range_cnt) { case 1: /* no range was present, so just one package given */ package_id = atoi(range[0]); - obj = prte_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, 0, package_id); + obj = hwloc_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, package_id); /* get the available cpus for this package */ hwloc_bitmap_or(cpumask, cpumask, obj->cpuset); break; @@ -658,7 +510,7 @@ static int package_to_cpu_set(char *cpus, hwloc_topology_t topo, hwloc_bitmap_t upper_range = atoi(range[1]); /* cycle across the range of packages */ for (package_id = lower_range; package_id <= upper_range; package_id++) { - obj = prte_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, 0, package_id); + obj = hwloc_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, package_id); /* set the available cpus for this package bits in the bitmask */ hwloc_bitmap_or(cpumask, cpumask, obj->cpuset); } @@ -690,7 +542,7 @@ static int package_core_to_cpu_set(char *package_core_list, hwloc_topology_t top package_id = atoi(package_core[0]); /* get the object for this package id */ - package = prte_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, 0, package_id); + package = hwloc_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, package_id); if (NULL == package) { PMIX_ARGV_FREE_COMPAT(package_core); return PRTE_ERR_NOT_FOUND; @@ -730,7 +582,7 @@ static int package_core_to_cpu_set(char *package_core_list, hwloc_topology_t top /* get the indexed core from this package */ core_id = atoi(list[j]) + npus; /* get that object */ - core = prte_hwloc_base_get_obj_by_type(topo, obj_type, 0, core_id); + core = hwloc_get_obj_by_type(topo, obj_type, core_id); if (NULL == core) { rc = PRTE_ERR_NOT_FOUND; break; @@ -750,7 +602,7 @@ static int package_core_to_cpu_set(char *package_core_list, hwloc_topology_t top /* get the indexed core from this package */ core_id = j + npus; /* get that object */ - core = prte_hwloc_base_get_obj_by_type(topo, obj_type, 0, core_id); + core = hwloc_get_obj_by_type(topo, obj_type, core_id); if (NULL == core) { rc = PRTE_ERR_NOT_FOUND; break; @@ -923,17 +775,6 @@ static void prte_hwloc_base_get_relative_locality_by_depth(hwloc_topology_t topo case HWLOC_OBJ_NUMANODE: *locality |= PRTE_PROC_ON_NUMA; break; -#if HWLOC_API_VERSION < 0x20000 - case HWLOC_OBJ_CACHE: - if (3 == obj->attr->cache.depth) { - *locality |= PRTE_PROC_ON_L3CACHE; - } else if (2 == obj->attr->cache.depth) { - *locality |= PRTE_PROC_ON_L2CACHE; - } else { - *locality |= PRTE_PROC_ON_L1CACHE; - } - break; -#else case HWLOC_OBJ_L3CACHE: *locality |= PRTE_PROC_ON_L3CACHE; break; @@ -943,7 +784,6 @@ static void prte_hwloc_base_get_relative_locality_by_depth(hwloc_topology_t topo case HWLOC_OBJ_L1CACHE: *locality |= PRTE_PROC_ON_L1CACHE; break; -#endif case HWLOC_OBJ_CORE: *locality |= PRTE_PROC_ON_CORE; break; @@ -999,11 +839,7 @@ prte_hwloc_locality_t prte_hwloc_base_get_relative_locality(hwloc_topology_t top type = hwloc_get_depth_type(topo, d); /* if it isn't one of interest, then ignore it */ if (HWLOC_OBJ_NUMANODE != type && HWLOC_OBJ_PACKAGE != type && -#if HWLOC_API_VERSION < 0x20000 - HWLOC_OBJ_CACHE != type && -#else HWLOC_OBJ_L3CACHE != type && HWLOC_OBJ_L2CACHE != type && HWLOC_OBJ_L1CACHE != type && -#endif HWLOC_OBJ_CORE != type && HWLOC_OBJ_PU != type) { continue; } @@ -1018,10 +854,8 @@ prte_hwloc_locality_t prte_hwloc_base_get_relative_locality(hwloc_topology_t top } } -#if HWLOC_API_VERSION >= 0x20000 prte_hwloc_base_get_relative_locality_by_depth(topo, (unsigned) HWLOC_TYPE_DEPTH_NUMANODE, loc1, loc2, &locality, &shared); -#endif pmix_output_verbose(5, prte_hwloc_base_output, "locality: %s", prte_hwloc_base_print_locality(locality)); @@ -1037,11 +871,9 @@ prte_hwloc_locality_t prte_hwloc_base_get_relative_locality(hwloc_topology_t top */ char *prte_hwloc_base_find_coprocessors(hwloc_topology_t topo) { -#if HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC hwloc_obj_t osdev; unsigned i; char **cps = NULL; -#endif char *cpstring = NULL; int depth; @@ -1053,7 +885,7 @@ char *prte_hwloc_base_find_coprocessors(hwloc_topology_t topo) (5, prte_hwloc_base_output, "hwloc:base:find_coprocessors: NONE FOUND IN TOPO")); return NULL; } -#if HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC + /* check the device objects for coprocessors */ osdev = hwloc_get_obj_by_depth(topo, depth, 0); while (NULL != osdev) { @@ -1079,13 +911,6 @@ char *prte_hwloc_base_find_coprocessors(hwloc_topology_t topo) PMIX_OUTPUT_VERBOSE((5, prte_hwloc_base_output, "hwloc:base:find_coprocessors: hosting coprocessors %s", (NULL == cpstring) ? "NONE" : cpstring)); -#else - PMIX_OUTPUT_VERBOSE((5, prte_hwloc_base_output, - "hwloc:base:find_coprocessors: the version of hwloc that PRTE was built " - "against (v%d.%d.%d) does not support detecting coprocessors", - (HWLOC_API_VERSION >> 16) && 0xFF, (HWLOC_API_VERSION >> 8) & 0xFF, - HWLOC_API_VERSION && 0xFF)); -#endif return cpstring; } @@ -1255,7 +1080,6 @@ static int bitmap_list_snprintf_exp(char *__hwloc_restrict buf, size_t buflen, { int ret = 0; char *tmp = buf; -#if HWLOC_API_VERSION >= 0x20000 int prev = -1; ssize_t size = buflen; int res; @@ -1304,13 +1128,6 @@ static int bitmap_list_snprintf_exp(char *__hwloc_restrict buf, size_t buflen, prev = end - 1; } } -#else - PRTE_HIDE_UNUSED_PARAMS(set, type); - if (buflen > 0) { - tmp[0] = '\0'; - } - ret = PRTE_ERR_NOT_SUPPORTED; -#endif return ret; } @@ -1473,13 +1290,13 @@ char *prte_hwloc_base_get_topo_signature(hwloc_topology_t topo) unsigned i; hwloc_bitmap_t complete, allowed; - nnuma = prte_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_NUMANODE, 0); - npackage = prte_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_PACKAGE, 0); - nl3 = prte_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_L3CACHE, 3); - nl2 = prte_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_L2CACHE, 2); - nl1 = prte_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_L1CACHE, 1); - ncore = prte_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_CORE, 0); - nhwt = prte_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_PU, 0); + nnuma = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_NUMANODE); + npackage = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_PACKAGE); + nl3 = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_L3CACHE); + nl2 = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_L2CACHE); + nl1 = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_L1CACHE); + ncore = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_CORE); + nhwt = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_PU); /* get the root object so we can add the processor architecture */ obj = hwloc_get_root_obj(topo); @@ -1594,11 +1411,7 @@ char *prte_hwloc_base_get_locality_string(hwloc_topology_t topo, char *bitmap) type = hwloc_get_depth_type(topo, d); /* if it isn't one of interest, then ignore it */ if (HWLOC_OBJ_NUMANODE != type && HWLOC_OBJ_PACKAGE != type && -#if HWLOC_API_VERSION < 0x20000 - HWLOC_OBJ_CACHE != type && -#else HWLOC_OBJ_L1CACHE != type && HWLOC_OBJ_L2CACHE != type && HWLOC_OBJ_L3CACHE != type && -#endif HWLOC_OBJ_CORE != type && HWLOC_OBJ_PU != type) { continue; } @@ -1626,33 +1439,6 @@ char *prte_hwloc_base_get_locality_string(hwloc_topology_t topo, char *bitmap) } locality = t2; break; -#if HWLOC_API_VERSION < 0x20000 - case HWLOC_OBJ_CACHE: { - unsigned cachedepth = hwloc_get_obj_by_depth(topo, d, 0)->attr->cache.depth; - if (3 == cachedepth) { - pmix_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp); - if (NULL != locality) { - free(locality); - } - locality = t2; - break; - } else if (2 == cachedepth) { - pmix_asprintf(&t2, "%sL2%s:", (NULL == locality) ? "" : locality, tmp); - if (NULL != locality) { - free(locality); - } - locality = t2; - break; - } else { - pmix_asprintf(&t2, "%sL1%s:", (NULL == locality) ? "" : locality, tmp); - if (NULL != locality) { - free(locality); - } - locality = t2; - break; - } - } break; -#else case HWLOC_OBJ_L3CACHE: pmix_asprintf(&t2, "%sL3%s:", (NULL == locality) ? "" : locality, tmp); if (NULL != locality) { @@ -1674,7 +1460,6 @@ char *prte_hwloc_base_get_locality_string(hwloc_topology_t topo, char *bitmap) } locality = t2; break; -#endif case HWLOC_OBJ_CORE: pmix_asprintf(&t2, "%sCR%s:", (NULL == locality) ? "" : locality, tmp); if (NULL != locality) { @@ -1698,7 +1483,6 @@ char *prte_hwloc_base_get_locality_string(hwloc_topology_t topo, char *bitmap) hwloc_bitmap_zero(result); } -#if HWLOC_API_VERSION >= 0x20000 if (prte_hwloc_base_get_locality_string_by_depth(topo, HWLOC_TYPE_DEPTH_NUMANODE, cpuset, result) == 0) { @@ -1715,7 +1499,6 @@ char *prte_hwloc_base_get_locality_string(hwloc_topology_t topo, char *bitmap) } hwloc_bitmap_zero(result); } -#endif hwloc_bitmap_free(result); hwloc_bitmap_free(cpuset); @@ -1732,9 +1515,7 @@ char *prte_hwloc_base_get_location(char *locality, hwloc_obj_type_t type, unsign char **loc; char *srch, *ans = NULL; size_t n; -#if HWLOC_API_VERSION >= 0x20000 PRTE_HIDE_UNUSED_PARAMS(index); -#endif if (NULL == locality) { return NULL; @@ -1746,17 +1527,6 @@ char *prte_hwloc_base_get_location(char *locality, hwloc_obj_type_t type, unsign case HWLOC_OBJ_PACKAGE: srch = "SK"; break; -#if HWLOC_API_VERSION < 0x20000 - case HWLOC_OBJ_CACHE: - if (3 == index) { - srch = "L3"; - } else if (2 == index) { - srch = "L2"; - } else { - srch = "L1"; - } - break; -#else case HWLOC_OBJ_L3CACHE: srch = "L3"; break; @@ -1766,7 +1536,6 @@ char *prte_hwloc_base_get_location(char *locality, hwloc_obj_type_t type, unsign case HWLOC_OBJ_L1CACHE: srch = "L1"; break; -#endif case HWLOC_OBJ_CORE: srch = "CR"; break; @@ -1856,35 +1625,21 @@ prte_hwloc_locality_t prte_hwloc_compute_relative_locality(char *loc1, char *loc int prte_hwloc_base_topology_export_xmlbuffer(hwloc_topology_t topology, char **xmlpath, int *buflen) { -#if HWLOC_API_VERSION < 0x00020000 - return hwloc_topology_export_xmlbuffer(topology, xmlpath, buflen); -#else return hwloc_topology_export_xmlbuffer(topology, xmlpath, buflen, 0); -#endif } int prte_hwloc_base_topology_set_flags(hwloc_topology_t topology, unsigned long flags, bool io) { if (io) { -#if HWLOC_API_VERSION < 0x00020000 - flags |= HWLOC_TOPOLOGY_FLAG_IO_DEVICES; -#else int ret = hwloc_topology_set_io_types_filter(topology, HWLOC_TYPE_FILTER_KEEP_IMPORTANT); if (0 != ret) { return ret; } -#endif } // Blacklist the "gl" component due to potential conflicts. // See "https://github.com/open-mpi/ompi/issues/10025" for // an explanation -#ifdef HWLOC_VERSION_MAJOR -#if HWLOC_VERSION_MAJOR > 2 hwloc_topology_set_components(topology, HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST, "gl"); -#elif HWLOC_VERSION_MAJOR == 2 && HWLOC_VERSION_MINOR >= 1 - hwloc_topology_set_components(topology, HWLOC_TOPOLOGY_COMPONENTS_FLAG_BLACKLIST, "gl"); -#endif -#endif return hwloc_topology_set_flags(topology, flags); } diff --git a/src/mca/odls/base/odls_base_bind.c b/src/mca/odls/base/odls_base_bind.c index ad929377f8..441b77589d 100644 --- a/src/mca/odls/base/odls_base_bind.c +++ b/src/mca/odls/base/odls_base_bind.c @@ -198,11 +198,7 @@ void prte_odls_base_set(prte_odls_spawn_caddy_t *cd, int write_fd) context->app, __FILE__, __LINE__); } /* bind this proc to all available processors */ -#if HWLOC_API_VERSION < 0x20000 - cpuset = root->allowed_cpuset; -#else cpuset = (hwloc_cpuset_t)hwloc_topology_get_allowed_cpuset(prte_hwloc_topology); -#endif rc = hwloc_set_cpubind(prte_hwloc_topology, cpuset, 0); /* if we got an error and this wasn't a default binding policy, then report it */ if (rc < 0 && PRTE_BINDING_POLICY_IS_SET(jobdat->map->binding)) { diff --git a/src/mca/plm/base/plm_base_launch_support.c b/src/mca/plm/base/plm_base_launch_support.c index e863361f41..ac81bfeb19 100644 --- a/src/mca/plm/base/plm_base_launch_support.c +++ b/src/mca/plm/base/plm_base_launch_support.c @@ -83,29 +83,29 @@ void prte_plm_base_set_slots(prte_node_t *node) { if (0 == strncmp(prte_set_slots, "cores", strlen(prte_set_slots))) { if (NULL != node->topology && NULL != node->topology->topo) { - node->slots = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_CORE, 0); + node->slots = hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_CORE); } } else if (0 == strncmp(prte_set_slots, "sockets", strlen(prte_set_slots))) { if (NULL != node->topology && NULL != node->topology->topo) { - node->slots = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_SOCKET, 0); + node->slots = hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_SOCKET); if (0 == node->slots) { /* some systems don't report sockets - in this case, * use numanodes */ - node->slots = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_NUMANODE, 0); + node->slots = hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_NUMANODE); } } } else if (0 == strncmp(prte_set_slots, "numas", strlen(prte_set_slots))) { if (NULL != node->topology && NULL != node->topology->topo) { - node->slots = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_NUMANODE, 0); + node->slots = hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_NUMANODE); } } else if (0 == strncmp(prte_set_slots, "hwthreads", strlen(prte_set_slots))) { if (NULL != node->topology && NULL != node->topology->topo) { - node->slots = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_PU, 0); + node->slots = hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_PU); } } else { /* must be a number */ diff --git a/src/mca/rmaps/base/rmaps_base_binding.c b/src/mca/rmaps/base/rmaps_base_binding.c index 87525d2c5a..c39b7c8ceb 100644 --- a/src/mca/rmaps/base/rmaps_base_binding.c +++ b/src/mca/rmaps/base/rmaps_base_binding.c @@ -76,11 +76,7 @@ static int bind_generic(prte_job_t *jdata, prte_proc_t *proc, if (NULL == options->target) { return PRTE_ERROR; } -#if HWLOC_API_VERSION < 0x20000 - tgtcpus = target->allowed_cpuset; -#else tgtcpus = target->cpuset; -#endif hwloc_bitmap_and(prte_rmaps_base.baseset, options->target, tgtcpus); nobjs = hwloc_get_nbobjs_by_type(node->topology->topo, options->hwb); @@ -99,11 +95,7 @@ static int bind_generic(prte_job_t *jdata, prte_proc_t *proc, for (n=0; n < nobjs; n++) { tmp_obj = hwloc_get_obj_by_type(node->topology->topo, options->hwb, n); -#if HWLOC_API_VERSION < 0x20000 - tmpcpus = tmp_obj->allowed_cpuset; -#else tmpcpus = tmp_obj->cpuset; -#endif hwloc_bitmap_and(prte_rmaps_base.available, node->available, tmpcpus); hwloc_bitmap_and(prte_rmaps_base.available, prte_rmaps_base.available, prte_rmaps_base.baseset); @@ -136,11 +128,7 @@ static int bind_generic(prte_job_t *jdata, prte_proc_t *proc, } } -#if HWLOC_API_VERSION < 0x20000 - tgtcpus = trg_obj->allowed_cpuset; -#else tgtcpus = trg_obj->cpuset; -#endif if (NULL == tgtcpus) { return PRTE_ERROR; } @@ -170,19 +158,11 @@ static int bind_generic(prte_job_t *jdata, prte_proc_t *proc, prte_rmaps_base.available, type, 0); -#if HWLOC_API_VERSION < 0x20000 - hwloc_bitmap_andnot(node->available, node->available, tmp_obj->allowed_cpuset); - if (hwloc_bitmap_iszero(node->available) && options->overload) { - /* reset the availability */ - hwloc_bitmap_copy(node->available, node->jobcache); - } -#else hwloc_bitmap_andnot(node->available, node->available, tmp_obj->cpuset); if (hwloc_bitmap_iszero(node->available) && options->overload) { /* reset the availability */ hwloc_bitmap_copy(node->available, node->jobcache); } -#endif return PRTE_SUCCESS; } @@ -231,21 +211,13 @@ static int bind_to_cpuset(prte_job_t *jdata, * cpu in the list. Since we are assigning * procs as they are mapped, this ensures they * will be assigned in order */ -#if HWLOC_API_VERSION < 0x20000 - tset = root->allowed_cpuset; -#else tset = root->cpuset; -#endif obj = hwloc_get_obj_inside_cpuset_by_type(node->topology->topo, tset, type, idx); if (NULL == obj) { PMIX_ARGV_FREE_COMPAT(cpus); return PRTE_ERR_OUT_OF_RESOURCE; } -#if HWLOC_API_VERSION < 0x20000 - tset = obj->allowed_cpuset; -#else tset = obj->cpuset; -#endif } else { /* bind the proc to all assigned cpus */ tset = options->target; @@ -257,11 +229,7 @@ static int bind_to_cpuset(prte_job_t *jdata, included = false; for (n=0; n < npkgs; n++) { pkg = hwloc_get_obj_by_type(node->topology->topo, HWLOC_OBJ_PACKAGE, n); -#if HWLOC_API_VERSION < 0x20000 - rc = hwloc_bitmap_isincluded(tset, pkg->allowed_cpuset); -#else rc = hwloc_bitmap_isincluded(tset, pkg->cpuset); -#endif if (1 == rc) { included = true; break; @@ -292,19 +260,10 @@ static int bind_to_cpuset(prte_job_t *jdata, * the cpuset is assigned to a proc. When all the cpus in the * set have been removed, we know that the set will be overloaded * if any more procs are assigned to it. */ -#if HWLOC_API_VERSION < 0x20000 - tset = root->allowed_cpuset; -#else tset = root->cpuset; -#endif obj = hwloc_get_obj_inside_cpuset_by_type(node->topology->topo, tset, type, idx); - if (NULL == obj) { - } else { -#if HWLOC_API_VERSION < 0x20000 - hwloc_bitmap_andnot(node->available, node->available, obj->allowed_cpuset); -#else + if (NULL != obj) { hwloc_bitmap_andnot(node->available, node->available, obj->cpuset); -#endif } return PRTE_SUCCESS; } @@ -334,11 +293,7 @@ static int bind_multiple(prte_job_t *jdata, prte_proc_t *proc, } else { target = obj; } -#if HWLOC_API_VERSION < 0x20000 - tgtcpus = target->allowed_cpuset; -#else tgtcpus = target->cpuset; -#endif hwloc_bitmap_and(prte_rmaps_base.baseset, options->target, tgtcpus); if (options->use_hwthreads) { type = HWLOC_OBJ_PU; @@ -353,11 +308,7 @@ static int bind_multiple(prte_job_t *jdata, prte_proc_t *proc, npkgs = hwloc_get_nbobjs_by_type(node->topology->topo, HWLOC_OBJ_PACKAGE); for (n=0; n < npkgs; n++) { pkg = hwloc_get_obj_by_type(node->topology->topo, HWLOC_OBJ_PACKAGE, n); -#if HWLOC_API_VERSION < 0x20000 - hwloc_bitmap_and(prte_rmaps_base.available, prte_rmaps_base.baseset, pkg->allowed_cpuset); -#else hwloc_bitmap_and(prte_rmaps_base.available, prte_rmaps_base.baseset, pkg->cpuset); -#endif hwloc_bitmap_and(prte_rmaps_base.available, prte_rmaps_base.available, node->available); ncpus = hwloc_get_nbobjs_inside_cpuset_by_type(node->topology->topo, prte_rmaps_base.available, type); if (ncpus >= options->cpus_per_rank) { @@ -384,15 +335,9 @@ static int bind_multiple(prte_job_t *jdata, prte_proc_t *proc, for (n=0; n < options->cpus_per_rank; n++) { tmp_obj = hwloc_get_obj_inside_cpuset_by_type(node->topology->topo, prte_rmaps_base.available, type, n); if (NULL != tmp_obj) { -#if HWLOC_API_VERSION < 0x20000 - hwloc_bitmap_or(result, result, tmp_obj->allowed_cpuset); - hwloc_bitmap_andnot(node->available, node->available, tmp_obj->allowed_cpuset); - hwloc_bitmap_andnot(options->target, options->target, tmp_obj->allowed_cpuset); -#else hwloc_bitmap_or(result, result, tmp_obj->cpuset); hwloc_bitmap_andnot(node->available, node->available, tmp_obj->cpuset); hwloc_bitmap_andnot(options->target, options->target, tmp_obj->cpuset); -#endif } } hwloc_bitmap_list_asprintf(&proc->cpuset, result); diff --git a/src/mca/rmaps/base/rmaps_base_map_job.c b/src/mca/rmaps/base/rmaps_base_map_job.c index 9843c86c77..c273e66ca4 100644 --- a/src/mca/rmaps/base/rmaps_base_map_job.c +++ b/src/mca/rmaps/base/rmaps_base_map_job.c @@ -400,13 +400,13 @@ void prte_rmaps_base_map_job(int fd, short args, void *cbdata) options.maptype = HWLOC_OBJ_NUMANODE; options.mapdepth = PRTE_BIND_TO_NUMA; } else if (0 == strncasecmp(ck[1], "l1cache", len)) { - PRTE_HWLOC_MAKE_OBJ_CACHE(1, options.maptype, options.cmaplvl); + options.maptype = HWLOC_OBJ_L1CACHE; options.mapdepth = PRTE_BIND_TO_L1CACHE; } else if (0 == strncasecmp(ck[1], "l2cache", len)) { - PRTE_HWLOC_MAKE_OBJ_CACHE(2, options.maptype, options.cmaplvl); + options.maptype = HWLOC_OBJ_L2CACHE; options.mapdepth = PRTE_BIND_TO_L2CACHE; } else if (0 == strncasecmp(ck[1], "l3cache", len)) { - PRTE_HWLOC_MAKE_OBJ_CACHE(3, options.maptype, options.cmaplvl); + options.maptype = HWLOC_OBJ_L3CACHE; options.mapdepth = PRTE_BIND_TO_L3CACHE; } else { /* unknown spec */ @@ -452,43 +452,34 @@ void prte_rmaps_base_map_job(int fd, short args, void *cbdata) } else if (HWLOC_OBJ_PACKAGE == options.maptype) { /* add in #packages for each node */ PMIX_LIST_FOREACH (node, &nodes, prte_node_t) { - app->num_procs += options.pprn * prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_PACKAGE, 0); + app->num_procs += options.pprn * hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_PACKAGE); } } else if (HWLOC_OBJ_NUMANODE== options.maptype) { /* add in #numa for each node */ PMIX_LIST_FOREACH (node, &nodes, prte_node_t) { - app->num_procs += options.pprn * prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_NUMANODE, 0); + app->num_procs += options.pprn * hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_NUMANODE); } -#if HWLOC_API_VERSION < 0x20000 - } else if (HWLOC_OBJ_CACHE == options.maptype) { - /* add in #cache for each node */ - PMIX_LIST_FOREACH (node, &nodes, prte_node_t) { - app->num_procs += options.pprn * prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - options.maptype, options.cmaplvl); - } -#else } else if (HWLOC_OBJ_L1CACHE == options.maptype || HWLOC_OBJ_L2CACHE == options.maptype || HWLOC_OBJ_L3CACHE == options.maptype) { /* add in #cache for each node */ PMIX_LIST_FOREACH (node, &nodes, prte_node_t) { - app->num_procs += options.pprn * prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - options.maptype, options.cmaplvl); + app->num_procs += options.pprn * hwloc_get_nbobjs_by_type(node->topology->topo, + options.maptype); } -#endif } else if (HWLOC_OBJ_CORE == options.maptype) { /* add in #cores for each node */ PMIX_LIST_FOREACH (node, &nodes, prte_node_t) { - app->num_procs += options.pprn * prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_CORE, 0); + app->num_procs += options.pprn * hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_CORE); } } else if (HWLOC_OBJ_PU == options.maptype) { /* add in #hwt for each node */ PMIX_LIST_FOREACH (node, &nodes, prte_node_t) { - app->num_procs += options.pprn * prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - HWLOC_OBJ_PU, 0); + app->num_procs += options.pprn * hwloc_get_nbobjs_by_type(node->topology->topo, + HWLOC_OBJ_PU); } } } else { @@ -575,15 +566,15 @@ void prte_rmaps_base_map_job(int fd, short args, void *cbdata) break; case PRTE_MAPPING_BYL3CACHE: options.mapdepth = PRTE_BIND_TO_L3CACHE; - PRTE_HWLOC_MAKE_OBJ_CACHE(3, options.maptype, options.cmaplvl); + options.maptype = HWLOC_OBJ_L3CACHE; break; case PRTE_MAPPING_BYL2CACHE: options.mapdepth = PRTE_BIND_TO_L2CACHE; - PRTE_HWLOC_MAKE_OBJ_CACHE(2, options.maptype, options.cmaplvl); + options.maptype = HWLOC_OBJ_L2CACHE; break; case PRTE_MAPPING_BYL1CACHE: options.mapdepth = PRTE_BIND_TO_L1CACHE; - PRTE_HWLOC_MAKE_OBJ_CACHE(1, options.maptype, options.cmaplvl); + options.maptype = HWLOC_OBJ_L1CACHE; break; case PRTE_MAPPING_BYCORE: if (1 < options.cpus_per_rank && @@ -735,13 +726,13 @@ void prte_rmaps_base_map_job(int fd, short args, void *cbdata) options.hwb = HWLOC_OBJ_NUMANODE; break; case PRTE_BIND_TO_L3CACHE: - PRTE_HWLOC_MAKE_OBJ_CACHE(3, options.hwb, options.clvl); + options.hwb = HWLOC_OBJ_L3CACHE; break; case PRTE_BIND_TO_L2CACHE: - PRTE_HWLOC_MAKE_OBJ_CACHE(2, options.hwb, options.clvl); + options.hwb = HWLOC_OBJ_L2CACHE; break; case PRTE_BIND_TO_L1CACHE: - PRTE_HWLOC_MAKE_OBJ_CACHE(1, options.hwb, options.clvl); + options.hwb = HWLOC_OBJ_L1CACHE; break; case PRTE_BIND_TO_CORE: options.hwb = HWLOC_OBJ_CORE; diff --git a/src/mca/rmaps/base/rmaps_base_ranking.c b/src/mca/rmaps/base/rmaps_base_ranking.c index c53861a0e6..a1f1a23adc 100644 --- a/src/mca/rmaps/base/rmaps_base_ranking.c +++ b/src/mca/rmaps/base/rmaps_base_ranking.c @@ -14,7 +14,7 @@ * Copyright (c) 2017 Research Organization for Information Science * and Technology (RIST). All rights reserved. * Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2021-2022 Nanook Consulting. All rights reserved. + * Copyright (c) 2021-2024 Nanook Consulting All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow @@ -196,11 +196,11 @@ int prte_rmaps_base_compute_vpids(prte_job_t *jdata, continue; } lrank = 0; - nobjs = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - options->maptype, options->cmaplvl); + nobjs = hwloc_get_nbobjs_by_type(node->topology->topo, + options->maptype); for (k=0; k < nobjs; k++) { - obj = prte_hwloc_base_get_obj_by_type(node->topology->topo, - options->maptype, options->cmaplvl, k); + obj = hwloc_get_obj_by_type(node->topology->topo, + options->maptype, k); for (m=0; m < node->procs->size; m++) { proc = (prte_proc_t*)pmix_pointer_array_get_item(node->procs, m); if (NULL == proc) { @@ -247,14 +247,14 @@ int prte_rmaps_base_compute_vpids(prte_job_t *jdata, if (NULL == node) { continue; } - nobjs = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - options->maptype, options->cmaplvl); + nobjs = hwloc_get_nbobjs_by_type(node->topology->topo, + options->maptype); lrank = pass * nobjs; /* make a pass across all objects on this node */ for (k=0; k < nobjs && rank < jdata->num_procs; k++) { /* get this object */ - obj = prte_hwloc_base_get_obj_by_type(node->topology->topo, - options->maptype, options->cmaplvl, k); + obj = hwloc_get_obj_by_type(node->topology->topo, + options->maptype, k); /* find an unranked proc on this object */ for (m=0; m < node->procs->size && rank < jdata->num_procs; m++) { proc = (prte_proc_t*)pmix_pointer_array_get_item(node->procs, m); diff --git a/src/mca/rmaps/base/rmaps_base_support_fns.c b/src/mca/rmaps/base/rmaps_base_support_fns.c index 2eb02bb3af..0c090413d9 100644 --- a/src/mca/rmaps/base/rmaps_base_support_fns.c +++ b/src/mca/rmaps/base/rmaps_base_support_fns.c @@ -637,11 +637,7 @@ int prte_rmaps_base_get_ncpus(prte_node_t *node, hwloc_bitmap_and(prte_rmaps_base.available, node->available, options->job_cpuset); } if (NULL != obj) { -#if HWLOC_API_VERSION < 0x20000 - hwloc_bitmap_and(prte_rmaps_base.available, prte_rmaps_base.available, obj->allowed_cpuset); -#else hwloc_bitmap_and(prte_rmaps_base.available, prte_rmaps_base.available, obj->cpuset); -#endif } if (options->use_hwthreads) { ncpus = hwloc_bitmap_weight(prte_rmaps_base.available); diff --git a/src/mca/rmaps/ppr/rmaps_ppr.c b/src/mca/rmaps/ppr/rmaps_ppr.c index 56d1dd59ab..92c8e4c0f0 100644 --- a/src/mca/rmaps/ppr/rmaps_ppr.c +++ b/src/mca/rmaps/ppr/rmaps_ppr.c @@ -110,23 +110,12 @@ static int ppr_mapper(prte_job_t *jdata, mapping = PRTE_MAPPING_BYPACKAGE; } else if (HWLOC_OBJ_NUMANODE== options->maptype) { mapping = PRTE_MAPPING_BYNUMA; -#if HWLOC_API_VERSION < 0x20000 - } else if (HWLOC_OBJ_CACHE == options->maptype) { - if (1 == options->cmaplvl) { - mapping = PRTE_MAPPING_BYL1CACHE; - } else if (2 == options->cmaplvl) { - mapping = PRTE_MAPPING_BYL2CACHE; - } else if (3 == options->cmaplvl) { - mapping = PRTE_MAPPING_BYL3CACHE; - } -#else } else if (HWLOC_OBJ_L1CACHE == options->maptype) { mapping = PRTE_MAPPING_BYL1CACHE; } else if (HWLOC_OBJ_L2CACHE == options->maptype) { mapping = PRTE_MAPPING_BYL2CACHE; } else if (HWLOC_OBJ_L3CACHE == options->maptype) { mapping = PRTE_MAPPING_BYL3CACHE; -#endif } else if (HWLOC_OBJ_CORE == options->maptype) { mapping = PRTE_MAPPING_BYCORE; } else if (HWLOC_OBJ_PU == options->maptype) { @@ -247,8 +236,8 @@ static int ppr_mapper(prte_job_t *jdata, } } else { /* get the number of resources on this node */ - nobjs = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - options->maptype, options->cmaplvl); + nobjs = hwloc_get_nbobjs_by_type(node->topology->topo, + options->maptype); if (0 == nobjs) { continue; } @@ -267,8 +256,8 @@ static int ppr_mapper(prte_job_t *jdata, } /* map the specified number of procs to each such resource on this node */ for (i = 0; i < nobjs && nprocs_mapped < app->num_procs; i++) { - obj = prte_hwloc_base_get_obj_by_type(node->topology->topo, - options->maptype, options->cmaplvl, i); + obj = hwloc_get_obj_by_type(node->topology->topo, + options->maptype, i); if (!prte_rmaps_base_check_avail(jdata, app, node, &node_list, obj, options)) { continue; } diff --git a/src/mca/rmaps/rank_file/rmaps_rank_file.c b/src/mca/rmaps/rank_file/rmaps_rank_file.c index ece80d7062..a29ff95a11 100644 --- a/src/mca/rmaps/rank_file/rmaps_rank_file.c +++ b/src/mca/rmaps/rank_file/rmaps_rank_file.c @@ -432,11 +432,7 @@ static int prte_rmaps_rf_map(prte_job_t *jdata, } /* Mark these slots as taken on this node */ -#if HWLOC_API_VERSION < 0x20000 hwloc_bitmap_andnot(node->available, node->available, proc_bitmap); -#else - hwloc_bitmap_andnot(node->available, node->available, proc_bitmap); -#endif /* cleanup */ free(cpu_bitmap); diff --git a/src/mca/rmaps/rmaps_types.h b/src/mca/rmaps/rmaps_types.h index 56acfdf908..dc6bdb1cec 100644 --- a/src/mca/rmaps/rmaps_types.h +++ b/src/mca/rmaps/rmaps_types.h @@ -97,7 +97,6 @@ typedef struct { unsigned ncpus; int nprocs; hwloc_obj_type_t maptype; - unsigned cmaplvl; /* #procs/resource as per PPR */ int pprn; @@ -112,7 +111,6 @@ typedef struct { prte_binding_policy_t bind; bool dobind; hwloc_obj_type_t hwb; - unsigned clvl; uint16_t limit; /* usage tracking */ diff --git a/src/mca/rmaps/round_robin/rmaps_rr_mappers.c b/src/mca/rmaps/round_robin/rmaps_rr_mappers.c index 4c193f8613..dd75c04a1b 100644 --- a/src/mca/rmaps/round_robin/rmaps_rr_mappers.c +++ b/src/mca/rmaps/round_robin/rmaps_rr_mappers.c @@ -627,8 +627,8 @@ int prte_rmaps_rr_byobj(prte_job_t *jdata, prte_app_context_t *app, /* have to delay checking for availability until we have the object */ /* get the number of objects of this type on this node */ - nobjs = prte_hwloc_base_get_nbobjs_by_type(node->topology->topo, - options->maptype, options->cmaplvl); + nobjs = hwloc_get_nbobjs_by_type(node->topology->topo, + options->maptype); if (0 == nobjs) { /* this node doesn't have any objects of this type, so * we might as well drop it from consideration */ @@ -647,8 +647,8 @@ int prte_rmaps_rr_byobj(prte_job_t *jdata, prte_app_context_t *app, pmix_output_verbose(10, prte_rmaps_base_framework.framework_output, "mca:rmaps:rr: assigning proc to object %d", j); /* get the hwloc object */ - obj = prte_hwloc_base_get_obj_by_type(node->topology->topo, - options->maptype, options->cmaplvl, j); + obj = hwloc_get_obj_by_type(node->topology->topo, + options->maptype, j); if (NULL == obj) { /* out of objects on this node */ break; diff --git a/src/mca/state/dvm/state_dvm.c b/src/mca/state/dvm/state_dvm.c index 1591b9f7c7..cd4d0f8811 100644 --- a/src/mca/state/dvm/state_dvm.c +++ b/src/mca/state/dvm/state_dvm.c @@ -793,11 +793,7 @@ static void check_complete(int fd, short args, void *cbdata) pmix_output(0, "COULD NOT GET BOUND CPU FOR RESOURCE RELEASE"); continue; } -#if HWLOC_API_VERSION < 0x20000 - tgt = obj->allowed_cpuset; -#else tgt = obj->cpuset; -#endif } hwloc_bitmap_or(node->available, node->available, tgt); } diff --git a/src/prted/pmix/pmix_server_queries.c b/src/prted/pmix/pmix_server_queries.c index f15e5c4986..bbbd44ee9f 100644 --- a/src/prted/pmix/pmix_server_queries.c +++ b/src/prted/pmix/pmix_server_queries.c @@ -375,20 +375,12 @@ static void _query(int sd, short args, void *cbdata) char *xmlbuffer = NULL; int len; kv = PMIX_NEW(prte_info_item_t); -#if HWLOC_API_VERSION < 0x20000 - /* get this from the v1.x API */ - if (0 != hwloc_topology_export_xmlbuffer(prte_hwloc_topology, &xmlbuffer, &len)) { - PMIX_RELEASE(kv); - continue; - } -#else /* get it from the v2 API */ if (0 != hwloc_topology_export_xmlbuffer(prte_hwloc_topology, &xmlbuffer, &len, HWLOC_TOPOLOGY_EXPORT_XML_FLAG_V1)) { PMIX_RELEASE(kv); continue; } -#endif PMIX_INFO_LIST_ADD(rc, results, PMIX_HWLOC_XML_V1, xmlbuffer, PMIX_STRING); free(xmlbuffer); if (PMIX_SUCCESS != rc) { @@ -398,8 +390,6 @@ static void _query(int sd, short args, void *cbdata) } } else if (0 == strcmp(q->keys[n], PMIX_HWLOC_XML_V2)) { - /* we cannot provide it if we are using v1.x */ -#if HWLOC_API_VERSION >= 0x20000 if (NULL != prte_hwloc_topology) { char *xmlbuffer = NULL; int len; @@ -415,7 +405,6 @@ static void _query(int sd, short args, void *cbdata) goto done; } } -#endif } else if (0 == strcmp(q->keys[n], PMIX_PROC_URI)) { /* they want our URI */ @@ -755,18 +744,10 @@ static void _query(int sd, short args, void *cbdata) continue; } /* convert the topology to XML representation */ -#if HWLOC_API_VERSION < 0x20000 - /* get this from the v1.x API */ - if (0 != hwloc_topology_export_xmlbuffer(topo->topo, &str, &len)) { - continue; - } - PMIX_INFO_LIST_ADD(rc, nodelist, PMIX_HWLOC_XML_V1, str, PMIX_STRING); -#else if (0 != hwloc_topology_export_xmlbuffer(topo->topo, &str, &len, 0)) { continue; } PMIX_INFO_LIST_ADD(rc, nodelist, PMIX_HWLOC_XML_V2, str, PMIX_STRING); -#endif free(str); } /* convert list to array */ diff --git a/src/prted/pmix/pmix_server_register_fns.c b/src/prted/pmix/pmix_server_register_fns.c index f8aa13cca1..58b8b296e1 100644 --- a/src/prted/pmix/pmix_server_register_fns.c +++ b/src/prted/pmix/pmix_server_register_fns.c @@ -302,11 +302,7 @@ int prte_pmix_server_register_nspace(prte_job_t *jdata) /* total available physical memory */ machine = hwloc_get_next_obj_by_type(prte_hwloc_topology, HWLOC_OBJ_MACHINE, NULL); if (NULL != machine) { -#if HWLOC_API_VERSION < 0x20000 - PMIX_INFO_LIST_ADD(ret, info, PMIX_AVAIL_PHYS_MEMORY, &machine->memory.total_memory, PMIX_UINT64); -#else PMIX_INFO_LIST_ADD(ret, info, PMIX_AVAIL_PHYS_MEMORY, &machine->total_memory, PMIX_UINT64); -#endif } /* pass the mapping policy used for this job */