From f22b7d4f46b03554add3ff2254d1c893359aff84 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 29 Jan 2019 07:36:01 -0800 Subject: [PATCH 1/4] hwloc/external.h: fix a clash with external HWLOC_VERSION[*] Some macros defined by the embedded hwloc ends up in opal_config.h because hwloc configury m4 files are slurped into Open MPI. These macros are not required here, and they might conflict with an external hwloc install, so simply #undef them in hwloc/external/external.h after including but before including the external . Signed-off-by: Gilles Gouaillardet Signed-off-by: Jeff Squyres --- opal/mca/hwloc/external/external.h | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/opal/mca/hwloc/external/external.h b/opal/mca/hwloc/external/external.h index 1428459755..8a1a32068b 100644 --- a/opal/mca/hwloc/external/external.h +++ b/opal/mca/hwloc/external/external.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved - * Copyright (c) 2016 Research Organization for Information Science + * Copyright (c) 2011-2019 Cisco Systems, Inc. All rights reserved + * Copyright (c) 2016-2019 Research Organization for Information Science * and Technology (RIST). All rights reserved. * * Copyright (c) 2016-2017 Intel, Inc. All rights reserved. @@ -21,6 +21,23 @@ BEGIN_C_DECLS #include + +/* Top-level configure will always configure the embedded hwloc + * component, even if we already know that we'll be using an external + * hwloc (because of complicated reasons). A side-effect of this is + * that the embedded hwloc will AC_DEFINE HWLOC_VERSION (and friends) + * in opal_config.h. If the external hwloc defines a different value + * of HWLOC_VERSION (etc.), we'll get zillions of warnings about the + * two HWLOC_VERSION values not matching. Hence, we undefined all of + * them here (so that the external can define them to + * whatever it wants). */ + +#undef HWLOC_VERSION +#undef HWLOC_VERSION_MAJOR +#undef HWLOC_VERSION_MINOR +#undef HWLOC_VERSION_RELEASE +#undef HWLOC_VERSION_GREEK + #include MCA_hwloc_external_header /* If the including file requested it, also include the hwloc verbs From 73d104f6959c95f676a779826f511826e0b17f6a Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 29 Jan 2019 07:36:15 -0800 Subject: [PATCH 2/4] hwloc/base: fix some off-by-one errors Signed-off-by: Gilles Gouaillardet --- opal/mca/hwloc/base/hwloc_base_dt.c | 2 +- opal/mca/hwloc/base/hwloc_base_util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opal/mca/hwloc/base/hwloc_base_dt.c b/opal/mca/hwloc/base/hwloc_base_dt.c index 0eb401f2a4..0bee844532 100644 --- a/opal/mca/hwloc/base/hwloc_base_dt.c +++ b/opal/mca/hwloc/base/hwloc_base_dt.c @@ -98,7 +98,7 @@ int opal_hwloc_unpack(opal_buffer_t *buffer, void *dest, free(xmlbuffer); goto cleanup; } - if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer))) { + if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer)+1)) { rc = OPAL_ERROR; free(xmlbuffer); hwloc_topology_destroy(t); diff --git a/opal/mca/hwloc/base/hwloc_base_util.c b/opal/mca/hwloc/base/hwloc_base_util.c index eb7eece810..fe1ce47aac 100644 --- a/opal/mca/hwloc/base/hwloc_base_util.c +++ b/opal/mca/hwloc/base/hwloc_base_util.c @@ -371,7 +371,7 @@ int opal_hwloc_base_get_topology(void) free(val); return OPAL_ERROR; } - if (0 != hwloc_topology_set_xmlbuffer(opal_hwloc_topology, val, strlen(val))) { + if (0 != hwloc_topology_set_xmlbuffer(opal_hwloc_topology, val, strlen(val)+1)) { free(val); hwloc_topology_destroy(opal_hwloc_topology); return OPAL_ERROR; From c8790d29de5ef399fd805f27366af6c2dc87ce9e Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 12 Dec 2018 14:18:02 +0900 Subject: [PATCH 3/4] opal: remove unnecessary #include file opal_config_bottom.h can only be #include'd in opal_config.h, so there is no need to #include "opal_config.h" inside. Signed-off-by: Gilles Gouaillardet --- opal/include/opal_config_bottom.h | 1 - 1 file changed, 1 deletion(-) diff --git a/opal/include/opal_config_bottom.h b/opal/include/opal_config_bottom.h index 5882347177..da4086df01 100644 --- a/opal/include/opal_config_bottom.h +++ b/opal/include/opal_config_bottom.h @@ -260,7 +260,6 @@ including stdint.h */ #define __STDC_LIMIT_MACROS #endif -#include "opal_config.h" #include "opal_stdint.h" /*********************************************************************** From 0aeb27f77650d3ee97e17e770c9e5aa487d5e1f5 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Wed, 30 Jan 2019 13:31:44 +0900 Subject: [PATCH 4/4] topo/treematch: silence a hwloc related warning treematch/km_partitioning.c #include "config.h", but there is no such file when the embedded treematch is used. In order to prevent the embedded treematch from incorrectly using the config.h from the embedded hwloc, generate a dummy config.h. Signed-off-by: Gilles Gouaillardet --- ompi/mca/topo/treematch/Makefile.am | 4 ++++ ompi/mca/topo/treematch/configure.m4 | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ompi/mca/topo/treematch/Makefile.am b/ompi/mca/topo/treematch/Makefile.am index 27d07bc64f..79cda83265 100644 --- a/ompi/mca/topo/treematch/Makefile.am +++ b/ompi/mca/topo/treematch/Makefile.am @@ -5,6 +5,8 @@ # Copyright (c) 2011-2015 INRIA. All rights reserved. # Copyright (c) 2011-2015 Université Bordeaux 1 # Copyright (c) 2017 IBM Corporation. All rights reserved. +# Copyright (c) 2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -67,3 +69,5 @@ noinst_LTLIBRARIES = $(lib) libmca_topo_treematch_la_SOURCES = $(lib_sources) libmca_topo_treematch_la_LDFLAGS = -module -avoid-version +distclean-local: + rm -f config.h diff --git a/ompi/mca/topo/treematch/configure.m4 b/ompi/mca/topo/treematch/configure.m4 index c937df3611..81a5ad56e4 100644 --- a/ompi/mca/topo/treematch/configure.m4 +++ b/ompi/mca/topo/treematch/configure.m4 @@ -6,7 +6,9 @@ # Copyright (c) 2011-2015 INRIA. All rights reserved. # Copyright (c) 2011-2015 Universite Bordeaux 1 # Copyright (c) 2015 Cisco Systems, Inc. All rights reserved. -# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2015 Intel, Inc. All rights reserved. +# Copyright (c) 2019 Research Organization for Information Science +# and Technology (RIST). All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -77,7 +79,21 @@ AC_DEFUN([MCA_ompi_topo_treematch_CONFIG], [ [ompi_topo_treematch_happy=1])])]) AS_IF([test $ompi_topo_treematch_happy -eq 1], - [$1], + [AS_IF([test "x$treematch_files_local" = "xyes"], + [AS_IF([! test -d $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch], + [mkdir -p $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch]) + cat > $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch/config.h << EOF +/* + * This file is automatically generated by configure. Edits will be lost + * + * This is an dummy config.h in order to prevent the embedded treematch from using + * the config.h from the embedded hwloc + * + * see https://github.com/open-mpi/ompi/pull/6185#issuecomment-458807930 + */ +EOF + ]) + $1], [AS_IF([test ! -z "$with_treematch" && test "$with_treematch" != "no"], [AC_MSG_ERROR([TreeMatch support requested but not found. Aborting])]) $2])