Skip to content

Commit 2203f8d

Browse files
authored
Merge pull request #6185 from ggouaillardet/topic/hwloc_macros
hwloc: remove public hwloc macros from opal_config.h
2 parents 29915fc + 0aeb27f commit 2203f8d

File tree

6 files changed

+43
-7
lines changed

6 files changed

+43
-7
lines changed

ompi/mca/topo/treematch/Makefile.am

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# Copyright (c) 2011-2015 INRIA. All rights reserved.
66
# Copyright (c) 2011-2015 Université Bordeaux 1
77
# Copyright (c) 2017 IBM Corporation. All rights reserved.
8+
# Copyright (c) 2019 Research Organization for Information Science
9+
# and Technology (RIST). All rights reserved.
810
# $COPYRIGHT$
911
#
1012
# Additional copyrights may follow
@@ -67,3 +69,5 @@ noinst_LTLIBRARIES = $(lib)
6769
libmca_topo_treematch_la_SOURCES = $(lib_sources)
6870
libmca_topo_treematch_la_LDFLAGS = -module -avoid-version
6971

72+
distclean-local:
73+
rm -f config.h

ompi/mca/topo/treematch/configure.m4

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
# Copyright (c) 2011-2015 INRIA. All rights reserved.
77
# Copyright (c) 2011-2015 Universite Bordeaux 1
88
# Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
9-
# Copyright (c) 2015 Intel, Inc. All rights reserved.
9+
# Copyright (c) 2015 Intel, Inc. All rights reserved.
10+
# Copyright (c) 2019 Research Organization for Information Science
11+
# and Technology (RIST). All rights reserved.
1012
# $COPYRIGHT$
1113
#
1214
# Additional copyrights may follow
@@ -77,7 +79,21 @@ AC_DEFUN([MCA_ompi_topo_treematch_CONFIG], [
7779
[ompi_topo_treematch_happy=1])])])
7880

7981
AS_IF([test $ompi_topo_treematch_happy -eq 1],
80-
[$1],
82+
[AS_IF([test "x$treematch_files_local" = "xyes"],
83+
[AS_IF([! test -d $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch],
84+
[mkdir -p $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch])
85+
cat > $OMPI_TOP_BUILDDIR/ompi/mca/topo/treematch/config.h << EOF
86+
/*
87+
* This file is automatically generated by configure. Edits will be lost
88+
*
89+
* This is an dummy config.h in order to prevent the embedded treematch from using
90+
* the config.h from the embedded hwloc
91+
*
92+
* see https://github.com/open-mpi/ompi/pull/6185#issuecomment-458807930
93+
*/
94+
EOF
95+
])
96+
$1],
8197
[AS_IF([test ! -z "$with_treematch" && test "$with_treematch" != "no"],
8298
[AC_MSG_ERROR([TreeMatch support requested but not found. Aborting])])
8399
$2])

opal/include/opal_config_bottom.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@
260260
including stdint.h */
261261
#define __STDC_LIMIT_MACROS
262262
#endif
263-
#include "opal_config.h"
264263
#include "opal_stdint.h"
265264

266265
/***********************************************************************

opal/mca/hwloc/base/hwloc_base_dt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ int opal_hwloc_unpack(opal_buffer_t *buffer, void *dest,
9898
free(xmlbuffer);
9999
goto cleanup;
100100
}
101-
if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer))) {
101+
if (0 != hwloc_topology_set_xmlbuffer(t, xmlbuffer, strlen(xmlbuffer)+1)) {
102102
rc = OPAL_ERROR;
103103
free(xmlbuffer);
104104
hwloc_topology_destroy(t);

opal/mca/hwloc/base/hwloc_base_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ int opal_hwloc_base_get_topology(void)
371371
free(val);
372372
return OPAL_ERROR;
373373
}
374-
if (0 != hwloc_topology_set_xmlbuffer(opal_hwloc_topology, val, strlen(val))) {
374+
if (0 != hwloc_topology_set_xmlbuffer(opal_hwloc_topology, val, strlen(val)+1)) {
375375
free(val);
376376
hwloc_topology_destroy(opal_hwloc_topology);
377377
return OPAL_ERROR;

opal/mca/hwloc/external/external.h

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
2-
* Copyright (c) 2011-2017 Cisco Systems, Inc. All rights reserved
3-
* Copyright (c) 2016 Research Organization for Information Science
2+
* Copyright (c) 2011-2019 Cisco Systems, Inc. All rights reserved
3+
* Copyright (c) 2016-2019 Research Organization for Information Science
44
* and Technology (RIST). All rights reserved.
55
*
66
* Copyright (c) 2016-2017 Intel, Inc. All rights reserved.
@@ -21,6 +21,23 @@
2121
BEGIN_C_DECLS
2222

2323
#include <opal_config.h>
24+
25+
/* Top-level configure will always configure the embedded hwloc
26+
* component, even if we already know that we'll be using an external
27+
* hwloc (because of complicated reasons). A side-effect of this is
28+
* that the embedded hwloc will AC_DEFINE HWLOC_VERSION (and friends)
29+
* in opal_config.h. If the external hwloc defines a different value
30+
* of HWLOC_VERSION (etc.), we'll get zillions of warnings about the
31+
* two HWLOC_VERSION values not matching. Hence, we undefined all of
32+
* them here (so that the external <hwloc.h> can define them to
33+
* whatever it wants). */
34+
35+
#undef HWLOC_VERSION
36+
#undef HWLOC_VERSION_MAJOR
37+
#undef HWLOC_VERSION_MINOR
38+
#undef HWLOC_VERSION_RELEASE
39+
#undef HWLOC_VERSION_GREEK
40+
2441
#include MCA_hwloc_external_header
2542

2643
/* If the including file requested it, also include the hwloc verbs

0 commit comments

Comments
 (0)