diff --git a/ompi/tools/ompi_info/param.c b/ompi/tools/ompi_info/param.c index cddaa9bca3..e56c8a2ba8 100644 --- a/ompi/tools/ompi_info/param.c +++ b/ompi/tools/ompi_info/param.c @@ -516,6 +516,7 @@ void ompi_info_do_config(bool want_all) char *symbol_visibility; char *ft_support; char *crdebug_support; + char *hwloc_support; /* Do a little preprocessor trickery here to figure ompi_info_out the * tri-state of MPI_PARAM_CHECK (which will be either 0, 1, or * ompi_mpi_param_check). The preprocessor will only allow @@ -560,6 +561,7 @@ void ompi_info_do_config(bool want_all) have_mpi_io = OMPI_PROVIDE_MPI_FILE_INTERFACE ? "yes" : "no"; wtime_support = OPAL_TIMER_USEC_NATIVE ? "native" : "gettimeofday"; symbol_visibility = OPAL_C_HAVE_VISIBILITY ? "yes" : "no"; + hwloc_support = OPAL_HAVE_HWLOC ? "yes" : "no"; /* setup strings that require allocation */ if (OMPI_WANT_F77_BINDINGS) { @@ -832,6 +834,7 @@ void ompi_info_do_config(bool want_all) ompi_info_out("MPI I/O support", "options:mpi-io", have_mpi_io); ompi_info_out("MPI_WTIME support", "options:mpi-wtime", wtime_support); ompi_info_out("Symbol vis. support", "options:visibility", symbol_visibility); + ompi_info_out("Hwloc support", "options:hwloc", hwloc_support); ompi_info_out("MPI extensions", "options:mpi_ext", OMPI_MPIEXT_COMPONENTS); diff --git a/opal/mca/hwloc/configure.m4 b/opal/mca/hwloc/configure.m4 index 01e3b3b154..3ca1f45c3d 100644 --- a/opal/mca/hwloc/configure.m4 +++ b/opal/mca/hwloc/configure.m4 @@ -20,57 +20,68 @@ dnl # component's $hwloc_base_* to CPPFLAGS, LDFLAGS, and LIBS, # respectively. -# If the user specifies --without-hwloc, then: -# -# - no hwloc component will be configured -# - $OPAL_HAVE_HWLOC will be set to 0 -# - OPAL_HAVE_HWLOC will be AC_DEFINE'd to 0 -# -# Otherwise: -# -# - a hwloc component will be configured. configure will abort if no -# hwloc component is able to be configured. -# - $OPAL_HAVE_HWLOC will be set to 1 -# - OPAL_HAVE_HWLOC will be AC_DEFINE'd to 1 -# -# Other configury (e.g., components that depend on hwloc) can simply -# check the value of $with_hwloc. If it's "no", then they should know -# that hwloc will not be available. If it's not "no", then they can -# assume that hwloc will be available (and that this framework will -# abort configure if hwloc is *not* available). - dnl We only want one winning component. m4_define(MCA_opal_hwloc_CONFIGURE_MODE, STOP_AT_FIRST_PRIORITY) +# Other components may depend on at least 1 hwloc component being +# available. As such, we may need to artificially force this +# framework to be configured first. Hence, we move the entirety of +# the hwloc framework's m4 to a separate macro and AC REQUIRE it. +# Other components can do this as well. This will guarantee that +# OPAL_HAVE_HWLOC is set to 0 or 1 *before* some component needs to +# check it. + AC_DEFUN([MCA_opal_hwloc_CONFIG],[ + # Use a crude shell variable to know whether this component is + # being required "early". See below. + opal_hwloc_its_time_to_configure=1 + AC_REQUIRE([MCA_opal_hwloc_CONFIG_REQUIRE]) +]) + +AC_DEFUN([MCA_opal_hwloc_CONFIG_REQUIRE],[ + + # If this shell variable is not 1, then this m4 is being invoked + # "early" via AC REQUIRE. Therefore, since we like having fairly + # readable configure output, print out a nice banner explaining why + # this is coming early. + AS_IF([test "$opal_hwloc_its_time_to_configure" != "1"], + [echo " " + echo "==> Pre-emptively configuring the hwloc framework to satisfy dependencies."]) # See if we want hwloc, and if so, internal vs external AC_ARG_WITH(hwloc, AC_HELP_STRING([--with-hwloc(=DIR)], [Build hwloc support. DIR can take one of three values: "internal", "external", or a valid directory name. "internal" (or no DIR value) forces Open MPI to use its internal copy of hwloc. "external" forces Open MPI to use an external installation of hwloc. Supplying a valid directory name also forces Open MPI to use an external installation of hwloc, and adds DIR/include, DIR/lib, and DIR/lib64 to the search path for headers and libraries.])) - # set default + # set defaults of not having any support hwloc_base_enable_xml=0 + OPAL_HAVE_HWLOC=0 - AC_MSG_CHECKING([want hwloc support]) - if test "$with_hwloc" = "no"; then - AC_MSG_RESULT([no]) - OPAL_HAVE_HWLOC=0 - else - AC_MSG_RESULT([yes]) - OPAL_HAVE_HWLOC=1 - fi + # Configure all the components - always have to do this, even if + # we configure --without-hwloc. Note that instead of passing in + # the traditional $1 and $2 as the first arguments, we hard-code + # "opal" and "hwloc", because this macro is invoked via AC + # REQUIRE. + MCA_CONFIGURE_FRAMEWORK([opal], [hwloc], 1) - # configure all the components - always have to do this - MCA_CONFIGURE_FRAMEWORK($1, $2, 1) + # Give a blank line to separate these messages from the last + # component's configure.m4 output. + echo " " - if test "$with_hwloc" != "no"; then - # We must have found exactly 1 static component, or we can't - # continue. STOP_AT_FIRST_PRIORITY will guarantee that we find at - # most one. We need to check here that we found *at least* one. + # Unless --with-hwloc[=] was given, it's ok to have no hwloc + # component. + AS_IF([test "$with_hwloc" = "no" -o "$with_hwloc" = ""], [], + [ # STOP_AT_FIRST_PRIORITY will guarantee that we find at most + # one. We need to check here that we found *at least* one. AS_IF([test "$MCA_opal_hwloc_STATIC_COMPONENTS" = ""], [AC_MSG_WARN([Did not find a suitable static opal hwloc component]) AC_MSG_ERROR([Cannot continue])]) + ]) + + # If we have a winning component, do some more logic + AS_IF([test "$MCA_opal_hwloc_STATIC_COMPONENTS" != ""], + [ # We had a winner -- w00t! + OPAL_HAVE_HWLOC=1 # The winning component will have set this. AS_IF([test "$hwloc_base_include" = ""], @@ -81,11 +92,7 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG],[ ["$hwloc_base_include"], [Header to include for hwloc implementation]) - # Give a blank line to separate these messages from the last - # component's configure.m4 output. - - echo " " - + # See if they set any flags for us AC_MSG_CHECKING([for winning hwloc component additional CPPFLAGS]) AS_IF([test "$hwloc_base_cppflags" != ""], [AC_MSG_RESULT([$hwloc_base_cppflags]) @@ -94,18 +101,27 @@ AC_DEFUN([MCA_opal_hwloc_CONFIG],[ AC_MSG_CHECKING([for winning hwloc component additional LDFLAGS]) AS_IF([test "$hwloc_base_ldflags" != ""], [AC_MSG_RESULT([$hwloc_base_ldflags]) - CPPFLAGS="$CPPFLAGS $hwloc_base_ldflags"], + LDFLAGS="$LDFLAGS $hwloc_base_ldflags"], [AC_MSG_RESULT([none])]) AC_MSG_CHECKING([for winning hwloc component additional LIBS]) AS_IF([test "$hwloc_base_libs" != ""], [AC_MSG_RESULT([$hwloc_base_libs]) - CPPFLAGS="$CPPFLAGS $hwloc_base_libs"], + LIB="$LIBS $hwloc_base_libs"], [AC_MSG_RESULT([none])]) - fi + ]) - AM_CONDITIONAL(OPAL_HAVE_HWLOC, test "$with_hwloc" != "no") + AM_CONDITIONAL(OPAL_HAVE_HWLOC, test $OPAL_HAVE_HWLOC -eq 1) AC_DEFINE_UNQUOTED(OPAL_HAVE_HWLOC, $OPAL_HAVE_HWLOC, [Whether we have hwloc support or not]) AC_DEFINE_UNQUOTED(OPAL_HAVE_HWLOC_XML, $hwloc_base_enable_xml, [Enable xml support or not]) + + # Similar to above, if this m4 is being invoked "early" via AC + # REQUIRE, print out a nice banner that we have now finished + # pre-emption and are returning to the Normal Order Of Things. + AS_IF([test "$opal_hwloc_its_time_to_configure" != "1"], + [echo " " + echo "<== Pre-emptive hwloc framework configuration complete." + echo "<== We now return you to your regularly scheduled programming." + echo " "]); ]) diff --git a/opal/mca/hwloc/hwloc121/configure.m4 b/opal/mca/hwloc/hwloc121/configure.m4 index b7c6c3e802..435359e746 100644 --- a/opal/mca/hwloc/hwloc121/configure.m4 +++ b/opal/mca/hwloc/hwloc121/configure.m4 @@ -108,7 +108,7 @@ AC_DEFUN([MCA_opal_hwloc_hwloc121_CONFIG],[ fi # Done! - AS_IF([test "$OPAL_HAVE_HWLOC" -eq 1 -a "$opal_hwloc_hwloc121_support" = "yes"], + AS_IF([test "$opal_hwloc_hwloc121_support" = "yes"], [AC_DEFINE_UNQUOTED([HWLOC_HWLOC121_HWLOC_VERSION], ["$HWLOC_VERSION"], [Version of hwloc]) diff --git a/opal/mca/maffinity/hwloc/configure.m4 b/opal/mca/maffinity/hwloc/configure.m4 index 9e0d57aaba..e98a967341 100644 --- a/opal/mca/maffinity/hwloc/configure.m4 +++ b/opal/mca/maffinity/hwloc/configure.m4 @@ -12,12 +12,13 @@ # MCA_maffinity_hwloc_CONFIG([action-if-found], [action-if-not-found]) # -------------------------------------------------------------------- AC_DEFUN([MCA_opal_maffinity_hwloc_CONFIG],[ + AC_REQUIRE([MCA_opal_hwloc_CONFIG_REQUIRE]) AC_CONFIG_FILES([opal/mca/maffinity/hwloc/Makefile]) - # All we check for is whether --without-hwloc was given - # configury. See big comment in opal/mca/hwloc/configure.m4. + # All we check for is whether $OPAL_HAVE_HWLOC is 1. + # See big comment in opal/mca/hwloc/configure.m4. AC_MSG_CHECKING([if hwloc is enabled]) - AS_IF([test "$with_hwloc" != "no"], + AS_IF([test $OPAL_HAVE_HWLOC -eq 1], [AC_MSG_RESULT([yes]) $1], [AC_MSG_RESULT([no]) diff --git a/opal/mca/paffinity/hwloc/configure.m4 b/opal/mca/paffinity/hwloc/configure.m4 index 4f556668a9..24087a1ce7 100644 --- a/opal/mca/paffinity/hwloc/configure.m4 +++ b/opal/mca/paffinity/hwloc/configure.m4 @@ -22,12 +22,13 @@ # MCA_paffinity_hwloc_CONFIG([action-if-found], [action-if-not-found]) # -------------------------------------------------------------------- AC_DEFUN([MCA_opal_paffinity_hwloc_CONFIG],[ + AC_REQUIRE([MCA_opal_hwloc_CONFIG_REQUIRE]) AC_CONFIG_FILES([opal/mca/paffinity/hwloc/Makefile]) - # All we check for is whether --without-hwloc was given - # configury. See big comment in opal/mca/hwloc/configure.m4. + # All we check for is whether $OPAL_HAVE_HWLOC is 1. + # See big comment in opal/mca/hwloc/configure.m4. AC_MSG_CHECKING([if hwloc is enabled]) - AS_IF([test "$with_hwloc" != "no"], + AS_IF([test $OPAL_HAVE_HWLOC -eq 1], [AC_MSG_RESULT([yes]) $1], [AC_MSG_RESULT([no])