aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure
diff options
context:
space:
mode:
authorGravatar Jonathan Hseu <jhseu@google.com>2017-01-17 15:06:43 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-01-17 15:48:13 -0800
commitc058a01d99621c7220c57e4f8c5ee6efd163ed03 (patch)
tree4457b18c03c51036be0331a173e1d287857152ab /configure
parent7da561c73d5476699d20ed6bffe7e7dbe624a6c2 (diff)
In ./configure, only ask about jemalloc when running on Linux.
Also add functions to test whether we're running on Linux or macOS, and convert every check over to them. Fixes #6869 Change: 144761341
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure65
1 files changed, 42 insertions, 23 deletions
diff --git a/configure b/configure
index 87ef6e99be..c755ee1b75 100755
--- a/configure
+++ b/configure
@@ -9,6 +9,23 @@ SOURCE_BASE_DIR=`pwd -P`
popd > /dev/null
PLATFORM="$(uname -s | tr 'A-Z' 'a-z')"
+
+function is_linux() {
+ if [[ "${PLATFORM}" == "linux" ]]; then
+ true
+ else
+ false
+ fi
+}
+
+function is_macos() {
+ if [[ "${PLATFORM}" == "darwin" ]]; then
+ true
+ else
+ false
+ fi
+}
+
function is_windows() {
# On windows, the shell script is actually running in msys
if [[ "${PLATFORM}" =~ msys_nt* ]]; then
@@ -65,16 +82,20 @@ if is_windows; then
TF_NEED_OPENCL=0
fi
-while [ "$TF_NEED_JEMALLOC" == "" ]; do
- read -p "Do you wish to use jemalloc as the malloc implementation? "\
-"(Linux only) [Y/n] " INPUT
- case $INPUT in
- [Yy]* ) echo "jemalloc enabled on Linux"; TF_NEED_JEMALLOC=1;;
- [Nn]* ) echo "jemalloc disabled on Linux"; TF_NEED_JEMALLOC=0;;
- "" ) echo "jemalloc enabled on Linux"; TF_NEED_JEMALLOC=1;;
- * ) echo "Invalid selection: " $INPUT;;
- esac
-done
+if is_linux; then
+ while [ "$TF_NEED_JEMALLOC" == "" ]; do
+ read -p "Do you wish to use jemalloc as the malloc implementation? [Y/n] "\
+ INPUT
+ case $INPUT in
+ [Yy]* ) echo "jemalloc enabled"; TF_NEED_JEMALLOC=1;;
+ [Nn]* ) echo "jemalloc disabled"; TF_NEED_JEMALLOC=0;;
+ "" ) echo "jemalloc enabled"; TF_NEED_JEMALLOC=1;;
+ * ) echo "Invalid selection: " $INPUT;;
+ esac
+ done
+else
+ TF_NEED_JEMALLOC=0
+fi
if [ "$TF_NEED_JEMALLOC" == "1" ]; then
sed -i -e "s/WITH_JEMALLOC = False/WITH_JEMALLOC = True/" tensorflow/core/platform/default/build_config.bzl
@@ -99,7 +120,7 @@ done
if [ "$TF_NEED_GCP" == "1" ]; then
## Verify that libcurl header files are available.
# Only check Linux, since on MacOS the header files are installed with XCode.
- if [[ $(uname -a) =~ Linux ]] && [[ ! -f "/usr/include/curl/curl.h" ]]; then
+ if is_linux && [[ ! -f "/usr/include/curl/curl.h" ]]; then
echo "ERROR: It appears that the development version of libcurl is not "\
"available. Please install the libcurl3-dev package."
exit 1
@@ -226,8 +247,6 @@ while ! is_windows && true; do
done
# Find out where the CUDA toolkit is installed
-OSNAME=`uname -s`
-
while true; do
# Configure the Cuda SDK version to use.
if [ -z "$TF_CUDA_VERSION" ]; then
@@ -259,9 +278,9 @@ while true; do
if is_windows; then
CUDA_RT_LIB_PATH="lib/x64/cudart.lib"
- elif [ "$OSNAME" == "Linux" ]; then
+ elif is_linux; then
CUDA_RT_LIB_PATH="lib64/libcudart.so${TF_CUDA_EXT}"
- elif [ "$OSNAME" == "Darwin" ]; then
+ elif is_macos; then
CUDA_RT_LIB_PATH="lib/libcudart${TF_CUDA_EXT}.dylib"
fi
@@ -307,10 +326,10 @@ while true; do
if is_windows; then
cudnn_lib_path="${CUDNN_INSTALL_PATH}/lib/x64/cudnn.lib"
cudnn_alt_lib_path="${CUDNN_INSTALL_PATH}/lib/x64/cudnn.lib"
- elif [ "$OSNAME" == "Linux" ]; then
+ elif is_linux; then
cudnn_lib_path="${CUDNN_INSTALL_PATH}/lib64/libcudnn.so"
cudnn_alt_lib_path="${CUDNN_INSTALL_PATH}/libcudnn.so"
- elif [ "$OSNAME" == "Darwin" ]; then
+ elif is_macos; then
cudnn_lib_path="${CUDNN_INSTALL_PATH}/lib/libcudnn.dylib"
cudnn_alt_lib_path="${CUDNN_INSTALL_PATH}/libcudnn.dylib"
fi
@@ -337,7 +356,7 @@ while true; do
echo "libcudnn.dylib resolves to libcudnn${TF_CUDNN_EXT}"
fi
else
- if [ "$OSNAME" == "Darwin" ]; then
+ if is_macos; then
TF_CUDNN_EXT=".${TF_CUDNN_VERSION}.dylib"
else
TF_CUDNN_EXT=".$TF_CUDNN_VERSION"
@@ -347,10 +366,10 @@ while true; do
if is_windows; then
CUDA_DNN_LIB_PATH="lib/x64/cudnn.lib"
CUDA_DNN_LIB_ALT_PATH="lib/x64/cudnn.lib"
- elif [ "$OSNAME" == "Linux" ]; then
+ elif is_linux; then
CUDA_DNN_LIB_PATH="lib64/libcudnn.so${TF_CUDNN_EXT}"
CUDA_DNN_LIB_ALT_PATH="libcudnn.so${TF_CUDNN_EXT}"
- elif [ "$OSNAME" == "Darwin" ]; then
+ elif is_macos; then
CUDA_DNN_LIB_PATH="lib/libcudnn${TF_CUDNN_EXT}"
CUDA_DNN_LIB_ALT_PATH="libcudnn${TF_CUDNN_EXT}"
fi
@@ -361,7 +380,7 @@ while true; do
break
fi
- if [ "$OSNAME" == "Linux" ]; then
+ if is_linux; then
CUDNN_PATH_FROM_LDCONFIG="$(ldconfig -p | sed -n 's/.*libcudnn.so .* => \(.*\)/\1/p')"
if [ -e "${CUDNN_PATH_FROM_LDCONFIG}${TF_CUDNN_EXT}" ]; then
export TF_CUDNN_VERSION
@@ -372,7 +391,7 @@ while true; do
echo "Invalid path to cuDNN ${CUDNN_VERSION} toolkit. Neither of the following two files can be found:"
echo "${CUDNN_INSTALL_PATH}/${CUDA_DNN_LIB_PATH}"
echo "${CUDNN_INSTALL_PATH}/${CUDA_DNN_LIB_ALT_PATH}"
- if [ "$OSNAME" == "Linux" ]; then
+ if is_linux; then
echo "${CUDNN_PATH_FROM_LDCONFIG}${TF_CUDNN_EXT}"
fi
@@ -499,7 +518,7 @@ while true; do
fi
fi
- if [ "$OSNAME" == "Linux" ]; then
+ if is_linux; then
SYCL_RT_LIB_PATH="lib/libComputeCpp.so"
fi