You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by bm...@apache.org on 2016/03/30 01:24:28 UTC

[2/2] mesos git commit: Added configure flags to build with Nvidia GPU support.

Added configure flags to build with Nvidia GPU support.

This is the initial commit to begin adding native support for GPUs in
Mesos. This initial version will only include support for Nvidia GPUs
that can be managed by the Nvidia Management Library (NVML).

The configure flags added in this commit can be used to enable Nvidia
GPU support, as well as specify the installation directories of the
NVML header and library files if not already installed in standard
include/library paths on the system.

In a subsequent commit, we will use these configure flags to
conditionally build support for Nvidia GPUs into Mesos.

Review: https://reviews.apache.org/r/44361/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2bb19aa3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2bb19aa3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2bb19aa3

Branch: refs/heads/master
Commit: 2bb19aa3eb52b68ebfe9dd4f5efbee2ac2e377d3
Parents: 250af60
Author: Kevin Klues <kl...@gmail.com>
Authored: Tue Mar 29 16:10:37 2016 -0700
Committer: Benjamin Mahler <bm...@apache.org>
Committed: Tue Mar 29 16:23:50 2016 -0700

----------------------------------------------------------------------
 configure.ac | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2bb19aa3/configure.ac
----------------------------------------------------------------------
diff --git a/configure.ac b/configure.ac
index 9ec4bc1..812c92a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,6 +210,18 @@ AC_ARG_WITH([nl],
                             (required for network-isolator). [default: /usr]]),
             [], [])
 
+AC_ARG_WITH([nvml-include],
+            AS_HELP_STRING([--with-nvml-include@<:@=DIR@:>@],
+                           [specify where to locate the Nvidia NVML headers
+                            (required for Nvidia GPU support)]),
+            [], [])
+
+AC_ARG_WITH([nvml-lib],
+            AS_HELP_STRING([--with-nvml-lib@<:@=DIR@:>@],
+                           [specify where to locate the Nvidia NVML libraries
+                            (required for Nvidia GPU support)]),
+            [], [])
+
 AC_ARG_ENABLE([bundled-distribute],
               AS_HELP_STRING([--disable-bundled-distribute],
                              [excludes building and using the bundled distribute
@@ -257,6 +269,11 @@ AC_ARG_ENABLE([libevent],
                              [use libevent instead of libev default: no]),
               [enable_libevent=yes], [])
 
+AC_ARG_ENABLE([nvidia-gpu-support],
+              AS_HELP_STRING([--enable-nvidia-gpu-support],
+                             [build with Nvidia GPU support default: no]),
+              [enable_nvidia_gpu_support=yes], [])
+
 AC_ARG_ENABLE([ssl],
               AS_HELP_STRING([--enable-ssl],
                              [use ssl for libprocess communication
@@ -921,6 +938,51 @@ AM_CONDITIONAL([WITH_NETWORK_ISOLATOR],
                [test "x$with_network_isolator" = "xyes"])
 
 
+# Check if Nvidia GPU support is enabled, and if so, verify we can
+# access the NVML header files and libs.
+if test x"$enable_nvidia_gpu_support" = "xyes"; then
+  # If the paths to the NVML headers and/or NVML libraries have been
+  # specified, make sure that those paths are absolute. If everything
+  # is in order, add these paths to the CPPFLAGS and LDFLAGS
+  # respectively.
+  if test -n "`echo $with_nvml_include`"; then
+    if test "$with_nvml_include" = "${with_nvml_include#/}"; then
+      AC_MSG_ERROR([The path passed to --with-nvml-include must be absolute.])
+    fi
+    CPPFLAGS="-I${with_nvml_include} $CPPFLAGS"
+  fi
+  if test -n "`echo $with_nvml_lib`"; then
+    if test "$with_nvml_lib" = "${with_nvml_lib#/}"; then
+      AC_MSG_ERROR([The path passed to --with-nvml-lib must be absolute.])
+    fi
+    LDFLAGS="-L${with_nvml_lib} $LDFLAGS"
+  fi
+
+  AC_CHECK_HEADERS([nvidia/gdk/nvml.h], [],
+                   [AC_MSG_ERROR([Cannot find the Nvidia NVML headers
+-------------------------------------------------------------------
+The Nvidia NVML headers are required to build Mesos with Nvidia
+GPU support. Make sure these headers are either installed on the
+system or the path passed via --with-nvml-include is correct.
+-------------------------------------------------------------------
+  ])])
+
+  AC_CHECK_LIB([nvidia-ml], [nvmlInit], [],
+               [AC_MSG_ERROR([Cannot find the Nvidia NVML libraries
+-------------------------------------------------------------------
+The Nvidia NVML libraries are required to build Mesos with Nvidia
+GPU support. Make sure these libraries are either installed on the
+system or the path passed via --with-nvml-lib is correct.
+-------------------------------------------------------------------
+  ])])
+
+  AC_DEFINE([ENABLE_NVIDIA_GPU_SUPPORT])
+fi
+
+AM_CONDITIONAL([ENABLE_NVIDIA_GPU_SUPPORT],
+  [test x"$enable_nvidia_gpu_support" = "xyes"])
+
+
 # TODO(benh): Consider using AS_IF instead of just shell 'if'
 # statements for better autoconf style (the AS_IF macros also make
 # sure variable dependencies are handled appropriately).