Le 08/12/2011 18:21, Rayson Ho a écrit :
> On Thu, Dec 8, 2011 at 11:27 AM, Brice Goglin <brice.gog...@inria.fr> wrote:
>> Well, we didn't plan to release another 1.2.x release (the stable branch
>> is now 1.3). But I can provide a custom tarball of 1.2.2 + the libnuma
>> patch.
> Oh, then don't worry about it, as I should backport the patch to 1.2.2
> myself as 1.2 is not officially supported. Also, thanks a lot for the
> help!

Here's the backported patch for 1.2.2.

> BTW, is there work to be done in Open MPI (like passing down
> "--disable-libnuma" to hwloc's configure)?

I don't see --disable-libnuma in my OMPI configure help. Does it
actually exist?

Otherwise, my understanding is that these hwloc configure options will
automatically appear in OMPI configure. So it may just work out of the
box. But I may well be wrong.

Brice

diff --git a/config/hwloc.m4 b/config/hwloc.m4
index 680eb7b..1f19662 100644
--- a/config/hwloc.m4
+++ b/config/hwloc.m4
@@ -485,25 +485,6 @@ EOF])
     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>
@@ -542,6 +523,40 @@ EOF])
     fi
     HWLOC_CFLAGS="$HWLOC_CFLAGS $HWLOC_XML_CFLAGS"    

+    # 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
+
     # Setup HWLOC's C, CPP, and LD flags, and LIBS
     AC_SUBST(HWLOC_REQUIRES)
     AC_SUBST(HWLOC_CFLAGS)
diff --git a/config/hwloc_internal.m4 b/config/hwloc_internal.m4
index 64a5322..f0d7314 100644
--- a/config/hwloc_internal.m4
+++ b/config/hwloc_internal.m4
@@ -59,6 +59,12 @@ AC_DEFUN([HWLOC_DEFINE_ARGS],[
     AC_ARG_ENABLE([xml],
                   AS_HELP_STRING([--disable-xml], 
 		                 [Disable the XML back-end of hwloc's lstopo command]))
+
+    # Linux libnuma
+    AC_ARG_ENABLE([libnuma],
+                  AS_HELP_STRING([--disable-libnuma],
+                                 [Disable the Linux libnuma]))
+
 ])dnl

 #-----------------------------------------------------------------------

Reply via email to