Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: Re: [hwloc-devel] [hwloc-svn] svn:hwloc r4025
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2011-12-08 17:02:41


Brice --

There might be a way to test for this in configure. What if we added a AC_CONFIG_COMMANDS (i.e., commands that run at the end of config.status -- after the libtool shell script is created) that try to use the generated libtool script to compile something with libnuma?

This test can run if libnuma was previously found to be "working" in earlier configure tests. Meaning: hwloc expects libnuma to compile/link successfully.

This test can compile/link a trivial application that uses a libnuma API call. If it fails to link, we can reasonably assume that the generated libtool script was trying to link in a way that is not supported by libnuma (e.g., we can even check $enable_static / $enable_shared), and then fail with a decent error message.

What do you think?

(I don't have time ATM to code this up, but it sounds possible...)

On Dec 8, 2011, at 4:46 PM, bgoglin_at_[hidden] wrote:

> Author: bgoglin
> Date: 2011-12-08 16:46:08 EST (Thu, 08 Dec 2011)
> New Revision: 4025
> URL: https://svn.open-mpi.org/trac/hwloc/changeset/4025
>
> Log:
> Add --disable-libnuma option
>
> This is a workaround for distro that don't ship static libnuma.
> Configure is happy if only the dynamic libnuma is available,
> but static linking would then fail.
>
> This patch also errors out if --enable-libnuma is given
> but libnuma cannot be found.
> Text files modified:
> trunk/NEWS | 1
> trunk/config/hwloc.m4 | 53 +++++++++++++++++++++++++--------------
> trunk/config/hwloc_internal.m4 | 5 +++
> 3 files changed, 40 insertions(+), 19 deletions(-)
>
> Modified: trunk/NEWS
> ==============================================================================
> --- trunk/NEWS (original)
> +++ trunk/NEWS 2011-12-08 16:46:08 EST (Thu, 08 Dec 2011)
> @@ -46,6 +46,7 @@
> * Add hwloc-distances utility to list distances.
> * Add more NVIDIA CUDA helpers in cuda.h and cudart.h to find hwloc objects
> corresponding to CUDA devices.
> +* Add --disable-libnuma configure option.
>
>
> Version 1.3.1
>
> Modified: trunk/config/hwloc.m4
> ==============================================================================
> --- trunk/config/hwloc.m4 (original)
> +++ trunk/config/hwloc.m4 2011-12-08 16:46:08 EST (Thu, 08 Dec 2011)
> @@ -486,25 +486,6 @@
> AC_CHECK_HEADERS([sys/utsname.h])
> AC_CHECK_FUNCS([uname])
>
> - # set_mempolicy and mbind support
> - AC_CHECK_HEADERS([numaif.h], [
> - AC_CHECK_LIB([numa], [set_mempolicy], [
> - enable_set_mempolicy=yes
> - AC_SUBST([HWLOC_LINUX_LIBNUMA_LIBS], ["-lnuma"])
> - AC_DEFINE([HWLOC_HAVE_SET_MEMPOLICY], [1], [Define to 1 if set_mempolicy is available.])
> - ])
> - AC_CHECK_LIB([numa], [mbind], [
> - enable_mbind=yes
> - AC_SUBST([HWLOC_LINUX_LIBNUMA_LIBS], ["-lnuma"])
> - AC_DEFINE([HWLOC_HAVE_MBIND], [1], [Define to 1 if mbind is available.])
> - ])
> - AC_CHECK_LIB([numa], [migrate_pages], [
> - enable_migrate_pages=yes
> - AC_SUBST([HWLOC_LINUX_LIBNUMA_LIBS], ["-lnuma"])
> - AC_DEFINE([HWLOC_HAVE_MIGRATE_PAGES], [1], [Define to 1 if migrate_pages is available.])
> - ])
> - ])
> -
> AC_CHECK_HEADERS([pthread_np.h])
> AC_CHECK_DECLS([pthread_setaffinity_np],,[:],[[
> #include <pthread.h>
> @@ -524,6 +505,40 @@
> AC_DEFINE([HWLOC_HAVE_PTHREAD_GETTHRDS_NP], 1, `Define to 1 if you have pthread_getthrds_np')
> )
>
> + # Linux libnuma support
> + hwloc_linux_libnuma_happy=no
> + if test "x$enable_libnuma" != "xno"; then
> + hwloc_linux_libnuma_happy=yes
> + AC_CHECK_HEADERS([numaif.h], [
> + AC_CHECK_LIB([numa], [numa_available], [HWLOC_LINUX_LIBNUMA_LIBS="-lnuma"], [hwloc_linux_libnuma_happy=no])
> + ], [hwloc_linux_libnuma_happy=no])
> + fi
> + AC_SUBST(HWLOC_LINUX_LIBNUMA_LIBS)
> + # If we asked for Linux libnuma support but couldn't deliver, fail
> + AS_IF([test "$enable_libnuma" = "yes" -a "$hwloc_linux_libnuma_happy" = "no"],
> + [AC_MSG_WARN([Specified --enable-libnuma switch, but could not])
> + AC_MSG_WARN([find appropriate support])
> + AC_MSG_ERROR([Cannot continue])])
> + if test "x$hwloc_linux_libnuma_happy" = "xyes"; then
> + tmp_save_LIBS="$LIBS"
> + LIBS="$LIBS $HWLOC_LINUX_LIBNUMA_LIBS"
> +
> + AC_CHECK_LIB([numa], [set_mempolicy], [
> + enable_set_mempolicy=yes
> + AC_DEFINE([HWLOC_HAVE_SET_MEMPOLICY], [1], [Define to 1 if set_mempolicy is available.])
> + ])
> + AC_CHECK_LIB([numa], [mbind], [
> + enable_mbind=yes
> + AC_DEFINE([HWLOC_HAVE_MBIND], [1], [Define to 1 if mbind is available.])
> + ])
> + AC_CHECK_LIB([numa], [migrate_pages], [
> + enable_migrate_pages=yes
> + AC_DEFINE([HWLOC_HAVE_MIGRATE_PAGES], [1], [Define to 1 if migrate_pages is available.])
> + ])
> +
> + LIBS="$tmp_save_LIBS"
> + fi
> +
> # PCI support
> hwloc_pci_happy=no
> if test "x$enable_pci" != "xno"; then
>
> Modified: trunk/config/hwloc_internal.m4
> ==============================================================================
> --- trunk/config/hwloc_internal.m4 (original)
> +++ trunk/config/hwloc_internal.m4 2011-12-08 16:46:08 EST (Thu, 08 Dec 2011)
> @@ -65,6 +65,11 @@
> AS_HELP_STRING([--disable-pci],
> [Disable the PCI device discovery using libpci]))
>
> + # Linux libnuma
> + AC_ARG_ENABLE([libnuma],
> + AS_HELP_STRING([--disable-libnuma],
> + [Disable the Linux libnuma]))
> +
> ])dnl
>
> #-----------------------------------------------------------------------
> _______________________________________________
> hwloc-svn mailing list
> hwloc-svn_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-svn

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/