aboutsummaryrefslogtreecommitdiffhomepage
path: root/configure
diff options
context:
space:
mode:
authorGravatar Dan Ringwalt <ringwalt@google.com>2017-05-05 09:09:05 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-05-05 10:26:00 -0700
commit692fad20f913ffa2cb874a87578ecabb03cc4557 (patch)
tree172717f537c91b0d1ac0366731b4eb2093fb743b /configure
parentb329dd821e29e64c93b1b9bf38e61871c6cb53da (diff)
Merge changes from github.
Change: 155209832
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure70
1 files changed, 38 insertions, 32 deletions
diff --git a/configure b/configure
index d7dde98292..7f68a8f5d4 100755
--- a/configure
+++ b/configure
@@ -35,12 +35,9 @@ function is_windows() {
fi
}
-function sed_hyphen_i() {
- if is_macos; then
- sed -i '' "$@"
- else
- sed -i "$@"
- fi
+function sed_in_place() {
+ sed -e $1 $2 > "$2.bak"
+ mv "$2.bak" $2
}
function write_to_bazelrc() {
@@ -170,7 +167,7 @@ function setup_python {
rm -f .tf_configure.bazelrc
touch .tf_configure.bazelrc
touch .bazelrc
-sed_hyphen_i "/tf_configure/d" .bazelrc
+sed_in_place "/tf_configure/d" .bazelrc
echo "import %workspace%/.tf_configure.bazelrc" >> .bazelrc
# Delete any leftover BUILD files from the Makefile build, which would interfere
@@ -409,31 +406,6 @@ done
export TF_CUDA_CLANG
write_action_env_to_bazelrc "TF_CUDA_CLANG" "$TF_CUDA_CLANG"
-# Set up which gcc nvcc should use as the host compiler
-# No need to set this on Windows
-while [[ "$TF_CUDA_CLANG" != "1" ]] && ! is_windows && true; do
- fromuser=""
- if [ -z "$GCC_HOST_COMPILER_PATH" ]; then
- default_gcc_host_compiler_path=$(which gcc || true)
- read -p "Please specify which gcc should be used by nvcc as the host compiler. [Default is $default_gcc_host_compiler_path]: " GCC_HOST_COMPILER_PATH
- fromuser="1"
- if [ -z "$GCC_HOST_COMPILER_PATH" ]; then
- GCC_HOST_COMPILER_PATH="$default_gcc_host_compiler_path"
- fi
- fi
- if [ -e "$GCC_HOST_COMPILER_PATH" ]; then
- export GCC_HOST_COMPILER_PATH
- write_action_env_to_bazelrc "GCC_HOST_COMPILER_PATH" "$GCC_HOST_COMPILER_PATH"
- break
- fi
- echo "Invalid gcc path. ${GCC_HOST_COMPILER_PATH} cannot be found" 1>&2
- if [ -z "$fromuser" ]; then
- exit 1
- fi
- GCC_HOST_COMPILER_PATH=""
- # Retry
-done
-
# Set up which clang we should use as the cuda / host compiler.
while [[ "$TF_CUDA_CLANG" == "1" ]] && true; do
fromuser=""
@@ -474,6 +446,11 @@ while true; do
else
default_cuda_path="$(cygpath -m "$CUDA_PATH")"
fi
+ elif is_linux; then
+ # If the default doesn't exist, try an alternative default.
+ if [ ! -d $default_cuda_path ] && [ -d /opt/cuda ]; then
+ default_cuda_path=/opt/cuda
+ fi
fi
read -p "Please specify the location where CUDA $TF_CUDA_VERSION toolkit is installed. Refer to README.md for more details. [Default is $default_cuda_path]: " CUDA_TOOLKIT_PATH
fromuser="1"
@@ -513,6 +490,35 @@ while true; do
CUDA_TOOLKIT_PATH=""
done
+# Set up which gcc nvcc should use as the host compiler
+# No need to set this on Windows
+while [[ "$TF_CUDA_CLANG" != "1" ]] && ! is_windows && true; do
+ fromuser=""
+ if [ -z "$GCC_HOST_COMPILER_PATH" ]; then
+ default_gcc_host_compiler_path=$(which gcc || true)
+ cuda_bin_symlink="$CUDA_TOOLKIT_PATH/bin/gcc"
+ if [ -L "$cuda_bin_symlink" ]; then
+ default_gcc_host_compiler_path=$(readlink $cuda_bin_symlink)
+ fi
+ read -p "Please specify which gcc should be used by nvcc as the host compiler. [Default is $default_gcc_host_compiler_path]: " GCC_HOST_COMPILER_PATH
+ fromuser="1"
+ if [ -z "$GCC_HOST_COMPILER_PATH" ]; then
+ GCC_HOST_COMPILER_PATH="$default_gcc_host_compiler_path"
+ fi
+ fi
+ if [ -e "$GCC_HOST_COMPILER_PATH" ]; then
+ export GCC_HOST_COMPILER_PATH
+ write_action_env_to_bazelrc "GCC_HOST_COMPILER_PATH" "$GCC_HOST_COMPILER_PATH"
+ break
+ fi
+ echo "Invalid gcc path. ${GCC_HOST_COMPILER_PATH} cannot be found" 1>&2
+ if [ -z "$fromuser" ]; then
+ exit 1
+ fi
+ GCC_HOST_COMPILER_PATH=""
+ # Retry
+done
+
# Find out where the cuDNN library is installed
while true; do
# Configure the cuDNN version to use.