Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump hwloc requirement from 1.5 to 1.11 #7367

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions opal/mca/hwloc/base/hwloc_base_dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,8 @@ int opal_hwloc_unpack(opal_buffer_t *buffer, void *dest,

int opal_hwloc_copy(hwloc_topology_t *dest, hwloc_topology_t src, opal_data_type_t type)
{
#ifdef HAVE_HWLOC_TOPOLOGY_DUP
/* use the hwloc dup function */
return hwloc_topology_dup(dest, src);
#else
/* hwloc_topology_dup() was introduced in hwloc v1.8.0.
* Note that as of March 2017, opal_hwloc_copy() is not (yet?) used in the code base anywhere. */
return OPAL_ERR_NOT_SUPPORTED;
#endif
}

int opal_hwloc_compare(const hwloc_topology_t topo1,
Expand Down
5 changes: 3 additions & 2 deletions opal/mca/hwloc/base/hwloc_base_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (c) 2016-2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
* Copyright (c) 2019 IBM Corporation. All rights reserved.
* Copyright (c) 2020 Inria. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -49,8 +50,8 @@ char *opal_hwloc_base_cpu_list=NULL;
bool opal_hwloc_report_bindings=false;
hwloc_obj_type_t opal_hwloc_levels[] = {
HWLOC_OBJ_MACHINE,
HWLOC_OBJ_NODE,
HWLOC_OBJ_SOCKET,
HWLOC_OBJ_NUMANODE,
HWLOC_OBJ_PACKAGE,
HWLOC_OBJ_L3CACHE,
HWLOC_OBJ_L2CACHE,
HWLOC_OBJ_L1CACHE,
Expand Down
54 changes: 23 additions & 31 deletions opal/mca/hwloc/base/hwloc_base_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ static int socket_to_cpu_set(char *cpus,
switch (range_cnt) {
case 1: /* no range was present, so just one socket given */
socket_id = atoi(range[0]);
obj = opal_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_SOCKET, 0, socket_id, rtype);
obj = opal_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, 0, socket_id, rtype);
/* get the available cpus for this socket */
hwloc_bitmap_or(cpumask, cpumask, obj->cpuset);
break;
Expand All @@ -987,7 +987,7 @@ static int socket_to_cpu_set(char *cpus,
upper_range = atoi(range[1]);
/* cycle across the range of sockets */
for (socket_id=lower_range; socket_id<=upper_range; socket_id++) {
obj = opal_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_SOCKET, 0, socket_id, rtype);
obj = opal_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, 0, socket_id, rtype);
/* set the available cpus for this socket bits in the bitmask */
hwloc_bitmap_or(cpumask, cpumask, obj->cpuset);
}
Expand Down Expand Up @@ -1019,7 +1019,7 @@ static int socket_core_to_cpu_set(char *socket_core_list,
socket_id = atoi(socket_core[0]);

/* get the object for this socket id */
if (NULL == (socket = opal_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_SOCKET, 0,
if (NULL == (socket = opal_hwloc_base_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, 0,
socket_id, rtype))) {
opal_argv_free(socket_core);
return OPAL_ERR_NOT_FOUND;
Expand Down Expand Up @@ -1265,10 +1265,10 @@ static void opal_hwloc_base_get_relative_locality_by_depth(hwloc_topology_t topo
if (sect1 && sect2) {
*shared = true;
switch(obj->type) {
case HWLOC_OBJ_NODE:
case HWLOC_OBJ_NUMANODE:
*locality |= OPAL_PROC_ON_NUMA;
break;
case HWLOC_OBJ_SOCKET:
case HWLOC_OBJ_PACKAGE:
*locality |= OPAL_PROC_ON_SOCKET;
break;
#if HWLOC_API_VERSION < 0x20000
Expand Down Expand Up @@ -1346,8 +1346,8 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
/* get the object type at this depth */
type = hwloc_get_depth_type(topo, d);
/* if it isn't one of interest, then ignore it */
if (HWLOC_OBJ_NODE != type &&
HWLOC_OBJ_SOCKET != type &&
if (HWLOC_OBJ_NUMANODE != type &&
HWLOC_OBJ_PACKAGE != type &&
#if HWLOC_API_VERSION < 0x20000
HWLOC_OBJ_CACHE != type &&
#else
Expand Down Expand Up @@ -1388,10 +1388,8 @@ opal_hwloc_locality_t opal_hwloc_base_get_relative_locality(hwloc_topology_t top
*/
char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo)
{
#if HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC
hwloc_obj_t osdev;
char **cps = NULL;
#endif
char *cpstring = NULL;
int depth;

Expand All @@ -1403,7 +1401,6 @@ char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo)
"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) {
Expand All @@ -1428,11 +1425,6 @@ char* opal_hwloc_base_find_coprocessors(hwloc_topology_t topo)
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
"hwloc:base:find_coprocessors: hosting coprocessors %s",
(NULL == cpstring) ? "NONE" : cpstring));
#else
OPAL_OUTPUT_VERBOSE((5, opal_hwloc_base_framework.framework_output,
"hwloc:base:find_coprocessors: the version of hwloc that Open MPI 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;
}

Expand Down Expand Up @@ -1653,7 +1645,7 @@ static int build_map(int *num_sockets_arg, int *num_cores_arg,
int **data;

/* Find out how many sockets we have */
num_sockets = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_SOCKET);
num_sockets = hwloc_get_nbobjs_by_type(topo, HWLOC_OBJ_PACKAGE);
/* some systems (like the iMac) only have one
* socket and so don't report a socket
*/
Expand Down Expand Up @@ -1703,7 +1695,7 @@ static int build_map(int *num_sockets_arg, int *num_cores_arg,

/* Go upward and find the socket this PU belongs to */
socket = pu;
while (NULL != socket && socket->type != HWLOC_OBJ_SOCKET) {
while (NULL != socket && socket->type != HWLOC_OBJ_PACKAGE) {
socket = socket->parent;
}
socket_index = 0;
Expand Down Expand Up @@ -1824,7 +1816,7 @@ int opal_hwloc_base_cset2mapstr(char *str, int len,
}

/* Iterate over all existing sockets */
for (socket = hwloc_get_obj_by_type(topo, HWLOC_OBJ_SOCKET, 0);
for (socket = hwloc_get_obj_by_type(topo, HWLOC_OBJ_PACKAGE, 0);
NULL != socket;
socket = socket->next_cousin) {
strncat(str, "[", len - strlen(str) - 1);
Expand Down Expand Up @@ -1904,7 +1896,7 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
/* find numa node containing this device */
obj = device_obj->parent;
#if HWLOC_API_VERSION < 0x20000
while ((obj != NULL) && (obj->type != HWLOC_OBJ_NODE)) {
while ((obj != NULL) && (obj->type != HWLOC_OBJ_NUMANODE)) {
obj = obj->parent;
}
#else
Expand All @@ -1926,10 +1918,10 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *

/* find distance matrix for all numa nodes */
#if HWLOC_API_VERSION < 0x20000
distances = (struct hwloc_distances_s*)hwloc_get_whole_distance_matrix_by_type(topo, HWLOC_OBJ_NODE);
distances = (struct hwloc_distances_s*)hwloc_get_whole_distance_matrix_by_type(topo, HWLOC_OBJ_NUMANODE);
if (NULL == distances) {
/* we can try to find distances under group object. This info can be there. */
depth = hwloc_get_type_depth(topo, HWLOC_OBJ_NODE);
depth = hwloc_get_type_depth(topo, HWLOC_OBJ_NUMANODE);
if (HWLOC_TYPE_DEPTH_UNKNOWN == depth) {
opal_output_verbose(5, opal_hwloc_base_framework.framework_output,
"hwloc:base:get_sorted_numa_list: There is no information about distances on the node.");
Expand Down Expand Up @@ -1964,7 +1956,7 @@ static void sort_by_dist(hwloc_topology_t topo, char* device_name, opal_list_t *
}
#else
distances_nr = 1;
if (0 != hwloc_distances_get_by_type(topo, HWLOC_OBJ_NODE, &distances_nr, &distances,
if (0 != hwloc_distances_get_by_type(topo, HWLOC_OBJ_NUMANODE, &distances_nr, &distances,
HWLOC_DISTANCES_KIND_MEANS_LATENCY, 0) || 0 == distances_nr) {
opal_output_verbose(5, opal_hwloc_base_framework.framework_output,
"hwloc:base:get_sorted_numa_list: There is no information about distances on the node.");
Expand Down Expand Up @@ -2017,7 +2009,7 @@ int opal_hwloc_get_sorted_numa_list(hwloc_topology_t topo, char* device_name, op
data = (opal_hwloc_topo_data_t*)obj->userdata;
if (NULL != data) {
OPAL_LIST_FOREACH(sum, &data->summaries, opal_hwloc_summary_t) {
if (HWLOC_OBJ_NODE == sum->type) {
if (HWLOC_OBJ_NUMANODE == sum->type) {
if (opal_list_get_size(&sum->sorted_by_dist_list) > 0) {
OPAL_LIST_FOREACH(numa, &(sum->sorted_by_dist_list), opal_rmaps_numa_node_t) {
copy_numa = OBJ_NEW(opal_rmaps_numa_node_t);
Expand Down Expand Up @@ -2070,8 +2062,8 @@ char* opal_hwloc_base_get_topo_signature(hwloc_topology_t topo)
hwloc_obj_t obj;
unsigned i;

nnuma = opal_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_NODE, 0, OPAL_HWLOC_AVAILABLE);
nsocket = opal_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_SOCKET, 0, OPAL_HWLOC_AVAILABLE);
nnuma = opal_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_NUMANODE, 0, OPAL_HWLOC_AVAILABLE);
nsocket = opal_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_PACKAGE, 0, OPAL_HWLOC_AVAILABLE);
nl3 = opal_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_L3CACHE, 3, OPAL_HWLOC_AVAILABLE);
nl2 = opal_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_L2CACHE, 2, OPAL_HWLOC_AVAILABLE);
nl1 = opal_hwloc_base_get_nbobjs_by_type(topo, HWLOC_OBJ_L1CACHE, 1, OPAL_HWLOC_AVAILABLE);
Expand Down Expand Up @@ -2167,8 +2159,8 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
/* get the object type at this depth */
type = hwloc_get_depth_type(topo, d);
/* if it isn't one of interest, then ignore it */
if (HWLOC_OBJ_NODE != type &&
HWLOC_OBJ_SOCKET != type &&
if (HWLOC_OBJ_NUMANODE != type &&
HWLOC_OBJ_PACKAGE != type &&
#if HWLOC_API_VERSION < 0x20000
HWLOC_OBJ_CACHE != type &&
#else
Expand All @@ -2190,14 +2182,14 @@ char* opal_hwloc_base_get_locality_string(hwloc_topology_t topo,
if (!hwloc_bitmap_iszero(result)) {
hwloc_bitmap_list_asprintf(&tmp, result);
switch(type) {
case HWLOC_OBJ_NODE:
case HWLOC_OBJ_NUMANODE:
opal_asprintf(&t2, "%sNM%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) {
free(locality);
}
locality = t2;
break;
case HWLOC_OBJ_SOCKET:
case HWLOC_OBJ_PACKAGE:
opal_asprintf(&t2, "%sSK%s:", (NULL == locality) ? "" : locality, tmp);
if (NULL != locality) {
free(locality);
Expand Down Expand Up @@ -2316,10 +2308,10 @@ char* opal_hwloc_base_get_location(char *locality,
return NULL;
}
switch(type) {
case HWLOC_OBJ_NODE:
case HWLOC_OBJ_NUMANODE:
srch = "NM";
break;
case HWLOC_OBJ_SOCKET:
case HWLOC_OBJ_PACKAGE:
srch = "SK";
break;
#if HWLOC_API_VERSION < 0x20000
Expand Down
4 changes: 1 addition & 3 deletions opal/mca/hwloc/configure.m4
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2010-2017 Cisco Systems, Inc. All rights reserved
dnl Copyright (c) 2020 Inria. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
Expand Down Expand Up @@ -89,9 +90,6 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[
# REQUIRE.
MCA_CONFIGURE_FRAMEWORK([opal], [hwloc], 1)

# Restore the --enable-pci flag
enable_pci=$opal_hwloc_hwloc132_save_enable_pci

# Give a blank line to separate these messages from the last
# component's configure.m4 output.
echo " "
Expand Down
22 changes: 4 additions & 18 deletions opal/mca/hwloc/external/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# and Technology (RIST). All rights reserved.
#
# Copyright (c) 2018 Intel, Inc. All rights reserved.
# Copyright (c) 2020 Inria. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
Expand Down Expand Up @@ -134,12 +135,12 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
LDFLAGS="$LDFLAGS $opal_hwloc_external_LDFLAGS"
LIBS="$LIBS $opal_hwloc_external_LIBS"

AC_MSG_CHECKING([if external hwloc version is 1.5 or greater])
AC_MSG_CHECKING([if external hwloc version is 1.11 or greater])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <hwloc.h>]],
[[
#if HWLOC_API_VERSION < 0x00010500
#error "hwloc API version is less than 0x00010500"
#if HWLOC_API_VERSION < 0x00010b00
#error "hwloc API version is less than 0x00010b00"
#endif
]])],
[AC_MSG_RESULT([yes])],
Expand Down Expand Up @@ -170,21 +171,6 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
[external],
[Version of hwloc])

AC_CHECK_DECLS([HWLOC_OBJ_OSDEV_COPROC], [], [], [#include <hwloc.h>])
AC_CHECK_FUNCS([hwloc_topology_dup])

# See if the external hwloc supports XML
AC_MSG_CHECKING([if external hwloc supports XML])
AS_IF([test "$opal_hwloc_dir" != ""],
[opal_hwloc_external_lstopo="$opal_hwloc_dir/bin/lstopo"],
[OPAL_WHICH(lstopo, opal_hwloc_external_lstopo)])
opal_hwloc_external_tmp=`$opal_hwloc_external_lstopo --help | $GREP "Supported output file formats" | grep xml`
AS_IF([test "$opal_hwloc_external_tmp" = ""],
[opal_hwloc_external_enable_xml=0
AC_MSG_RESULT([no])],
[opal_hwloc_external_enable_xml=1
AC_MSG_RESULT([yes])])

AC_CHECK_HEADERS([infiniband/verbs.h])

# These flags need to get passed to the wrapper compilers
Expand Down
8 changes: 2 additions & 6 deletions opal/mca/hwloc/external/external.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* and Technology (RIST). All rights reserved.
*
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
* Copyright (c) 2020 Inria. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -56,7 +57,7 @@ BEGIN_C_DECLS
# if defined(HAVE_INFINIBAND_VERBS_H)
# include MCA_hwloc_external_openfabrics_header
# else
# error Tried to include hwloc verbs helper file, but hwloc was compiled with no OpenFabrics support
# error Tried to include hwloc verbs helper file, but <infiniband/verbs.h> is missing
# endif
#endif

Expand All @@ -69,11 +70,6 @@ BEGIN_C_DECLS
*/
#endif

#if HWLOC_API_VERSION < 0x00010b00
#define HWLOC_OBJ_NUMANODE HWLOC_OBJ_NODE
#define HWLOC_OBJ_PACKAGE HWLOC_OBJ_SOCKET
#endif

END_C_DECLS

#endif /* MCA_OPAL_HWLOC_EXTERNAL_H */
4 changes: 1 addition & 3 deletions opal/mca/hwloc/hwloc2/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ AC_DEFUN([MCA_opal_hwloc_hwloc2_CONFIG],[
# distclean" infrastructure to work properly).
AS_IF([test "$opal_hwloc_external_support" = "yes"],
[AC_MSG_NOTICE([using an external hwloc; disqualifying this component])
opal_hwloc_hwloc2_support=no],
[AC_DEFINE([HAVE_DECL_HWLOC_OBJ_OSDEV_COPROC], [1])
AC_DEFINE([HAVE_HWLOC_TOPOLOGY_DUP], [1])])
opal_hwloc_hwloc2_support=no])

# Done!
AS_IF([test "$opal_hwloc_hwloc2_support" = "yes"],
Expand Down
3 changes: 2 additions & 1 deletion opal/mca/hwloc/hwloc2/hwloc2.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* Copyright (c) 2017 Research Organization for Information Science
* and Technology (RIST). All rights reserved.
*
* Copyright (c) 2020 Inria. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
Expand Down Expand Up @@ -42,7 +43,7 @@ BEGIN_C_DECLS
# if defined(HAVE_INFINIBAND_VERBS_H)
# include "hwloc/include/hwloc/openfabrics-verbs.h"
# else
# error Tried to include hwloc verbs helper file, but hwloc was compiled with no OpenFabrics support
# error Tried to include hwloc verbs helper file, but <infiniband/verbs.h> is missing
# endif
#endif

Expand Down