Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
hwloc: prefer external hwloc component
Signed-off-by: Gilles Gouaillardet <[email protected]>
Signed-off-by: Jeff Squyres <[email protected]>
  • Loading branch information
ggouaillardet committed Jul 23, 2018
commit ce2c9fffd421036f46c3d35c1c85439d57538ca6
142 changes: 77 additions & 65 deletions opal/mca/hwloc/external/configure.m4
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- shell-script -*-
#
# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2014-2017 Research Organization for Information Science
# Copyright (c) 2014-2018 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
#
# Copyright (c) 2018 Intel, Inc. All rights reserved.
Expand Down Expand Up @@ -84,7 +84,7 @@ AC_DEFUN([MCA_opal_hwloc_external_POST_CONFIG],[
AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
AC_CONFIG_FILES([opal/mca/hwloc/external/Makefile])

OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_want opal_hwloc_external_tmp opal_hwloc_external_lstopo])
OPAL_VAR_SCOPE_PUSH([opal_hwloc_external_CPPFLAGS_save opal_hwloc_external_CFLAGS_save opal_hwloc_external_LDFLAGS_save opal_hwloc_external_LIBS_save opal_hwloc_external_tmp opal_hwloc_external_lstopo opal_hwloc_summary_msg])

AC_ARG_WITH([hwloc-libdir],
[AC_HELP_STRING([--with-hwloc-libdir=DIR],
Expand All @@ -98,19 +98,9 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
AC_MSG_WARN([were specified, which does not make sense.])
AC_MSG_ERROR([Cannot continue])])

# Do we want this external component? (slightly redundant logic,
# but hopefully slightly more clear...)
opal_hwloc_external_want=no
AS_IF([test "$with_hwloc_libdir" != ""], [opal_hwloc_external_want=yes])
AS_IF([test "$with_hwloc" = "external"], [opal_hwloc_external_want=yes])
AS_IF([test "$with_hwloc" != "" && \
test "$with_hwloc" != "no" && \
test "$with_hwloc" != "internal" && \
test "$with_hwloc" != "future"], [opal_hwloc_external_want=yes])
AS_IF([test "$with_hwloc" = "no"], [opal_hwloc_external_want=no])

# If we still want external support, try it
AS_IF([test "$opal_hwloc_external_want" = "yes"],
opal_hwloc_summary_msg="internal"
# Try external support if needed
AS_IF([test "$with_hwloc" != "internal"],
[OPAL_CHECK_WITHDIR([hwloc-libdir], [$with_hwloc_libdir],
[libhwloc.*])

Expand Down Expand Up @@ -144,64 +134,86 @@ AC_DEFUN([MCA_opal_hwloc_external_CONFIG],[
LDFLAGS="$LDFLAGS $opal_hwloc_external_LDFLAGS"
LIBS="$LIBS $opal_hwloc_external_LIBS"
AC_CHECK_DECLS([HWLOC_OBJ_OSDEV_COPROC], [], [], [#include <hwloc.h>])
AC_CHECK_FUNCS([hwloc_topology_dup])])
AC_CHECK_FUNCS([hwloc_topology_dup])

CPPFLAGS=$opal_hwloc_external_CPPFLAGS_save
CFLAGS=$opal_hwloc_external_CFLAGS_save
LDFLAGS=$opal_hwloc_external_LDFLAGS_save
LIBS=$opal_hwloc_external_LIBS_save
])

# Done!
AS_IF([test "$opal_hwloc_external_support" = "yes"],
[AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION],
[external],
[Version of hwloc])

# 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])

AC_MSG_CHECKING([if external hwloc version is 1.5 or greater])
AS_IF([test "$opal_hwloc_dir" != ""],
[opal_hwloc_external_CFLAGS_save=$CFLAGS
CFLAGS="-I$opal_hwloc_dir/include $opal_hwloc_external_CFLAGS_save"])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <hwloc.h>]],
[[
AC_MSG_CHECKING([if external hwloc version is 1.5 or greater])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <hwloc.h>]],
[[
#if HWLOC_API_VERSION < 0x00010500
#error "hwloc API version is less than 0x00010500"
#endif
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([Cannot continue])])

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per #5031, if external support is not available, we need to emit a message at the bottom of this configure.m4:

  1. If the user explicitly asked for external support, print why the external hwloc is not suitable and then abort.
  2. If the user did not explicitly ask for external support, print why the external hwloc is not suitable and then allow processing to continue (which will end up selecting the internal hwloc).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fixed in the latest commit

AS_IF([test "$opal_hwloc_dir" != ""],
[CFLAGS=$opal_hwloc_external_CFLAGS_save])
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
opal_hwloc_external_support=no])])

# These flags need to get passed to the wrapper compilers
# (this is unnecessary for the internal/embedded hwloc)
# If external hwloc is not explicitly requested, check external version
# is not lower than the internal one
AS_IF([test "$opal_hwloc_external_support" = "yes"],
[AS_IF([test -z "$with_hwloc" || test "$with_hwloc" = "yes"],
[AC_MSG_CHECKING([if external hwloc version is 2.0 or greater])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <hwloc.h>]],
[[
#if HWLOC_API_VERSION < 0x00020000
#error "hwloc API version is less than 0x00020000"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to have this version by reference instead of by value? I.e., I imagine that this will be one more place to forget to update if/when we update the embedded version of hwloc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know ... strictly speaking, this is not even the library version (e.g. 2.0.1) but the API version (e.g. 2.0.0).

@bgoglin is there any way to test the __library__version instead of the API version at compile time ?
for example, libevent defines _EVENT_NUMERIC_VERSION.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggouaillardet Don't you also need to test that $with_hwloc wasn't given without any path (and so has a yes value)? I thought that test -z just means it wasn't given at all.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhc54 you are right, and I just pushed a commit that fixes that.

#endif
]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
opal_hwloc_summary_msg="internal (external hlwoc version is less than internal version 2.0)"
AC_MSG_WARN([external hwloc version is less than internal version 2.0])
AC_MSG_WARN([using internal hwloc])
opal_hwloc_external_support=no])])])

# Finally, add some flags to the wrapper compiler if we're
# building with developer headers so that our headers can
# be found.
hwloc_external_WRAPPER_EXTRA_CPPFLAGS=$opal_hwloc_external_CPPFLAGS
hwloc_external_WRAPPER_EXTRA_LDFLAGS=$opal_hwloc_external_LDFLAGS
hwloc_external_WRAPPER_EXTRA_LIBS=$opal_hwloc_external_LIBS
AS_IF([test "$opal_hwloc_external_support" = "yes"],
[AC_DEFINE_UNQUOTED([HWLOC_EXTERNAL_HWLOC_VERSION],
[external],
[Version of hwloc])

# 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
# (this is unnecessary for the internal/embedded hwloc)

# Finally, add some flags to the wrapper compiler if we're
# building with developer headers so that our headers can
# be found.
hwloc_external_WRAPPER_EXTRA_CPPFLAGS=$opal_hwloc_external_CPPFLAGS
hwloc_external_WRAPPER_EXTRA_LDFLAGS=$opal_hwloc_external_LDFLAGS
hwloc_external_WRAPPER_EXTRA_LIBS=$opal_hwloc_external_LIBS])

CPPFLAGS=$opal_hwloc_external_CPPFLAGS_save
CFLAGS=$opal_hwloc_external_CFLAGS_save
LDFLAGS=$opal_hwloc_external_LDFLAGS_save
LIBS=$opal_hwloc_external_LIBS_save
])

# Done!
AS_IF([test "$opal_hwloc_external_support" = "yes"],
[opal_hwloc_summary_msg="external"
$1],
[$2])
[# Abort is external hwloc was explicitly requested but cannot be built
AS_IF([test "$with_hwloc" != internal &&
test -n "$with_hwloc"],
[AC_MSG_WARN([external hwloc cannot be built])
AC_MSG_ERROR([Cannot continue.])])
$2])

OPAL_SUMMARY_ADD([[Miscellaneous]],[[HWLOC support]], [], [$opal_hwloc_summary_msg])

AC_SUBST(opal_hwloc_external_LDFLAGS)
AC_SUBST(opal_hwloc_external_LIBS)
Expand Down
4 changes: 2 additions & 2 deletions opal/mca/hwloc/hwloc201/configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Copyright (c) 2009-2017 Cisco Systems, Inc. All rights reserved
# Copyright (c) 2014-2017 Intel, Inc. All rights reserved.
# Copyright (c) 2015-2017 Research Organization for Information Science
# Copyright (c) 2015-2018 Research Organization for Information Science
# and Technology (RIST). All rights reserved.
# Copyright (c) 2016 Los Alamos National Security, LLC. All rights
# reserved.
Expand All @@ -17,7 +17,7 @@
#
# Priority
#
AC_DEFUN([MCA_opal_hwloc_hwloc201_PRIORITY], [90])
AC_DEFUN([MCA_opal_hwloc_hwloc201_PRIORITY], [80])

#
# Force this component to compile in static-only mode
Expand Down