Geoffrey Irving | 4c85a08 | 2016-03-16 12:20:34 -0800 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 2 | |
Andrew Selle | 09045e4 | 2016-09-06 08:19:04 -0800 | [diff] [blame] | 3 | # Find out the absolute path to where ./configure resides |
| 4 | pushd `dirname $0` #> /dev/null |
| 5 | SOURCE_BASE_DIR=`pwd -P` |
| 6 | popd > /dev/null |
| 7 | |
Jonathan Hseu | 1283b84 | 2016-09-29 15:05:32 -0800 | [diff] [blame^] | 8 | function bazel_clean_and_fetch() { |
| 9 | bazel clean --expunge |
| 10 | bazel fetch //tensorflow/... |
| 11 | } |
| 12 | |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 13 | ## Set up python-related environment settings |
| 14 | while true; do |
| 15 | fromuser="" |
| 16 | if [ -z "$PYTHON_BIN_PATH" ]; then |
| 17 | default_python_bin_path=$(which python) |
| 18 | read -p "Please specify the location of python. [Default is $default_python_bin_path]: " PYTHON_BIN_PATH |
| 19 | fromuser="1" |
| 20 | if [ -z "$PYTHON_BIN_PATH" ]; then |
| 21 | PYTHON_BIN_PATH=$default_python_bin_path |
| 22 | fi |
| 23 | fi |
| 24 | if [ -e "$PYTHON_BIN_PATH" ]; then |
| 25 | break |
| 26 | fi |
| 27 | echo "Invalid python path. ${PYTHON_BIN_PATH} cannot be found" 1>&2 |
| 28 | if [ -z "$fromuser" ]; then |
| 29 | exit 1 |
| 30 | fi |
| 31 | PYTHON_BIN_PATH="" |
| 32 | # Retry |
| 33 | done |
| 34 | |
A. Unique TensorFlower | ed65e69 | 2016-05-11 21:03:48 -0800 | [diff] [blame] | 35 | while [ "$TF_NEED_GCP" == "" ]; do |
| 36 | read -p "Do you wish to build TensorFlow with "\ |
| 37 | "Google Cloud Platform support? [y/N] " INPUT |
| 38 | case $INPUT in |
| 39 | [Yy]* ) echo "Google Cloud Platform support will be enabled for "\ |
| 40 | "TensorFlow"; TF_NEED_GCP=1;; |
| 41 | [Nn]* ) echo "No Google Cloud Platform support will be enabled for "\ |
| 42 | "TensorFlow"; TF_NEED_GCP=0;; |
| 43 | "" ) echo "No Google Cloud Platform support will be enabled for "\ |
| 44 | "TensorFlow"; TF_NEED_GCP=0;; |
| 45 | * ) echo "Invalid selection: " $INPUT;; |
| 46 | esac |
| 47 | done |
| 48 | |
| 49 | if [ "$TF_NEED_GCP" == "1" ]; then |
| 50 | |
| 51 | ## Verify that libcurl header files are available. |
| 52 | # Only check Linux, since on MacOS the header files are installed with XCode. |
| 53 | if [[ $(uname -a) =~ Linux ]] && [[ ! -f "/usr/include/curl/curl.h" ]]; then |
| 54 | echo "ERROR: It appears that the development version of libcurl is not "\ |
| 55 | "available. Please install the libcurl3-dev package." |
| 56 | exit 1 |
| 57 | fi |
| 58 | |
| 59 | # Update Bazel build configuration. |
| 60 | perl -pi -e "s,WITH_GCP_SUPPORT = (False|True),WITH_GCP_SUPPORT = True,s" tensorflow/core/platform/default/build_config.bzl |
| 61 | else |
| 62 | # Update Bazel build configuration. |
| 63 | perl -pi -e "s,WITH_GCP_SUPPORT = (False|True),WITH_GCP_SUPPORT = False,s" tensorflow/core/platform/default/build_config.bzl |
| 64 | fi |
| 65 | |
Jonathan Hseu | 9f5b098 | 2016-09-19 11:14:58 -0800 | [diff] [blame] | 66 | while [ "$TF_NEED_HDFS" == "" ]; do |
| 67 | read -p "Do you wish to build TensorFlow with "\ |
| 68 | "Hadoop File System support? [y/N] " INPUT |
| 69 | case $INPUT in |
| 70 | [Yy]* ) echo "Hadoop File System support will be enabled for "\ |
| 71 | "TensorFlow"; TF_NEED_HDFS=1;; |
| 72 | [Nn]* ) echo "No Hadoop File System support will be enabled for "\ |
| 73 | "TensorFlow"; TF_NEED_HDFS=0;; |
| 74 | "" ) echo "No Hadoop File System support will be enabled for "\ |
| 75 | "TensorFlow"; TF_NEED_HDFS=0;; |
| 76 | * ) echo "Invalid selection: " $INPUT;; |
| 77 | esac |
| 78 | done |
| 79 | |
| 80 | if [ "$TF_NEED_HDFS" == "1" ]; then |
| 81 | # Update Bazel build configuration. |
| 82 | perl -pi -e "s,WITH_HDFS_SUPPORT = (False|True),WITH_HDFS_SUPPORT = True,s" tensorflow/core/platform/default/build_config.bzl |
| 83 | else |
| 84 | # Update Bazel build configuration. |
| 85 | perl -pi -e "s,WITH_HDFS_SUPPORT = (False|True),WITH_HDFS_SUPPORT = False,s" tensorflow/core/platform/default/build_config.bzl |
| 86 | fi |
| 87 | |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 88 | ## Find swig path |
| 89 | if [ -z "$SWIG_PATH" ]; then |
| 90 | SWIG_PATH=`type -p swig 2> /dev/null` |
| 91 | fi |
| 92 | if [[ ! -e "$SWIG_PATH" ]]; then |
| 93 | echo "Can't find swig. Ensure swig is in \$PATH or set \$SWIG_PATH." |
| 94 | exit 1 |
| 95 | fi |
| 96 | echo "$SWIG_PATH" > tensorflow/tools/swig/swig_path |
| 97 | |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 98 | # Invoke python_config and set up symlinks to python includes |
| 99 | (./util/python/python_config.sh --setup "$PYTHON_BIN_PATH";) || exit -1 |
| 100 | |
Andrew Selle | 09045e4 | 2016-09-06 08:19:04 -0800 | [diff] [blame] | 101 | # Run the gen_git_source to create links where bazel can track dependencies for |
| 102 | # git hash propagation |
| 103 | GEN_GIT_SOURCE=tensorflow/tools/git/gen_git_source.py |
| 104 | chmod a+x ${GEN_GIT_SOURCE} |
| 105 | ${PYTHON_BIN_PATH} ${GEN_GIT_SOURCE} --configure ${SOURCE_BASE_DIR} |
| 106 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 107 | ## Set up Cuda-related environment settings |
| 108 | |
| 109 | while [ "$TF_NEED_CUDA" == "" ]; do |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 110 | read -p "Do you wish to build TensorFlow with GPU support? [y/N] " INPUT |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 111 | case $INPUT in |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 112 | [Yy]* ) echo "GPU support will be enabled for TensorFlow"; TF_NEED_CUDA=1;; |
| 113 | [Nn]* ) echo "No GPU support will be enabled for TensorFlow"; TF_NEED_CUDA=0;; |
| 114 | "" ) echo "No GPU support will be enabled for TensorFlow"; TF_NEED_CUDA=0;; |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 115 | * ) echo "Invalid selection: " $INPUT;; |
| 116 | esac |
| 117 | done |
| 118 | |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 119 | export TF_NEED_CUDA |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 120 | if [ "$TF_NEED_CUDA" == "0" ]; then |
| 121 | echo "Configuration finished" |
Jonathan Hseu | 1283b84 | 2016-09-29 15:05:32 -0800 | [diff] [blame^] | 122 | bazel_clean_and_fetch |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 123 | exit |
| 124 | fi |
| 125 | |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 126 | # Set up which gcc nvcc should use as the host compiler |
| 127 | while true; do |
| 128 | fromuser="" |
| 129 | if [ -z "$GCC_HOST_COMPILER_PATH" ]; then |
| 130 | default_gcc_host_compiler_path=$(which gcc) |
Shanqing Cai | a81c4f9 | 2016-07-22 10:37:35 -0800 | [diff] [blame] | 131 | 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 |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 132 | fromuser="1" |
| 133 | if [ -z "$GCC_HOST_COMPILER_PATH" ]; then |
| 134 | GCC_HOST_COMPILER_PATH=$default_gcc_host_compiler_path |
| 135 | fi |
| 136 | fi |
| 137 | if [ -e "$GCC_HOST_COMPILER_PATH" ]; then |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 138 | export GCC_HOST_COMPILER_PATH |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 139 | break |
| 140 | fi |
| 141 | echo "Invalid gcc path. ${GCC_HOST_COMPILER_PATH} cannot be found" 1>&2 |
| 142 | if [ -z "$fromuser" ]; then |
| 143 | exit 1 |
| 144 | fi |
| 145 | GCC_HOST_COMPILER_PATH="" |
| 146 | # Retry |
| 147 | done |
| 148 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 149 | # Find out where the CUDA toolkit is installed |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 150 | OSNAME=`uname -s` |
| 151 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 152 | while true; do |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 153 | # Configure the Cuda SDK version to use. |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 154 | if [ -z "$TF_CUDA_VERSION" ]; then |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 155 | read -p "Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: " TF_CUDA_VERSION |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 156 | fi |
| 157 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 158 | fromuser="" |
| 159 | if [ -z "$CUDA_TOOLKIT_PATH" ]; then |
| 160 | default_cuda_path=/usr/local/cuda |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 161 | 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 |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 162 | fromuser="1" |
| 163 | if [ -z "$CUDA_TOOLKIT_PATH" ]; then |
| 164 | CUDA_TOOLKIT_PATH=$default_cuda_path |
| 165 | fi |
| 166 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 167 | |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 168 | if [[ -z "$TF_CUDA_VERSION" ]]; then |
| 169 | TF_CUDA_EXT="" |
| 170 | else |
| 171 | TF_CUDA_EXT=".$TF_CUDA_VERSION" |
| 172 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 173 | |
| 174 | if [ "$OSNAME" == "Linux" ]; then |
| 175 | CUDA_RT_LIB_PATH="lib64/libcudart.so${TF_CUDA_EXT}" |
| 176 | elif [ "$OSNAME" == "Darwin" ]; then |
| 177 | CUDA_RT_LIB_PATH="lib/libcudart${TF_CUDA_EXT}.dylib" |
| 178 | fi |
| 179 | |
| 180 | if [ -e "${CUDA_TOOLKIT_PATH}/${CUDA_RT_LIB_PATH}" ]; then |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 181 | export CUDA_TOOLKIT_PATH |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 182 | export TF_CUDA_VERSION |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 183 | break |
| 184 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 185 | echo "Invalid path to CUDA $TF_CUDA_VERSION toolkit. ${CUDA_TOOLKIT_PATH}/${CUDA_RT_LIB_PATH} cannot be found" |
| 186 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 187 | if [ -z "$fromuser" ]; then |
| 188 | exit 1 |
| 189 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 190 | # Retry |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 191 | TF_CUDA_VERSION="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 192 | CUDA_TOOLKIT_PATH="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 193 | done |
| 194 | |
Martin Wicke | 916776a | 2016-01-14 07:30:00 -0800 | [diff] [blame] | 195 | # Find out where the cuDNN library is installed |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 196 | while true; do |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 197 | # Configure the Cudnn version to use. |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 198 | if [ -z "$TF_CUDNN_VERSION" ]; then |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 199 | read -p "Please specify the Cudnn version you want to use. [Leave empty to use system default]: " TF_CUDNN_VERSION |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 200 | fi |
| 201 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 202 | fromuser="" |
| 203 | if [ -z "$CUDNN_INSTALL_PATH" ]; then |
| 204 | default_cudnn_path=${CUDA_TOOLKIT_PATH} |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 205 | read -p "Please specify the location where cuDNN $TF_CUDNN_VERSION library is installed. Refer to README.md for more details. [Default is $default_cudnn_path]: " CUDNN_INSTALL_PATH |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 206 | fromuser="1" |
| 207 | if [ -z "$CUDNN_INSTALL_PATH" ]; then |
| 208 | CUDNN_INSTALL_PATH=$default_cudnn_path |
| 209 | fi |
| 210 | # Result returned from "read" will be used unexpanded. That make "~" unuseable. |
| 211 | # Going through one more level of expansion to handle that. |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 212 | CUDNN_INSTALL_PATH=`${PYTHON_BIN_PATH} -c "import os; print(os.path.realpath(os.path.expanduser('${CUDNN_INSTALL_PATH}')))"` |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 213 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 214 | |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 215 | if [[ -z "$TF_CUDNN_VERSION" ]]; then |
| 216 | TF_CUDNN_EXT="" |
A. Unique TensorFlower | 533d891 | 2016-06-30 12:10:50 -0800 | [diff] [blame] | 217 | # Resolve to the SONAME of the symlink. Use readlink without -f |
| 218 | # to resolve exactly once to the SONAME. E.g, libcudnn.so -> |
| 219 | # libcudnn.so.4 |
| 220 | REALVAL=`readlink ${CUDNN_INSTALL_PATH}/lib64/libcudnn.so` |
| 221 | |
| 222 | # Extract the version of the SONAME, if it was indeed symlinked to |
| 223 | # the SONAME version of the file. |
| 224 | if [[ "$REALVAL" =~ .so[.]+([0-9]*) ]]; |
| 225 | then |
| 226 | TF_CUDNN_EXT="."${BASH_REMATCH[1]} |
| 227 | TF_CUDNN_VERSION=${BASH_REMATCH[1]} |
| 228 | echo "libcudnn.so resolves to libcudnn${TF_CUDNN_EXT}" |
| 229 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 230 | else |
| 231 | TF_CUDNN_EXT=".$TF_CUDNN_VERSION" |
| 232 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 233 | |
| 234 | if [ "$OSNAME" == "Linux" ]; then |
| 235 | CUDA_DNN_LIB_PATH="lib64/libcudnn.so${TF_CUDNN_EXT}" |
| 236 | CUDA_DNN_LIB_ALT_PATH="libcudnn.so${TF_CUDNN_EXT}" |
| 237 | elif [ "$OSNAME" == "Darwin" ]; then |
| 238 | CUDA_DNN_LIB_PATH="lib/libcudnn${TF_CUDNN_EXT}.dylib" |
| 239 | CUDA_DNN_LIB_ALT_PATH="libcudnn${TF_CUDNN_EXT}.dylib" |
| 240 | fi |
| 241 | |
| 242 | if [ -e "$CUDNN_INSTALL_PATH/${CUDA_DNN_LIB_ALT_PATH}" -o -e "$CUDNN_INSTALL_PATH/${CUDA_DNN_LIB_PATH}" ]; then |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 243 | export TF_CUDNN_VERSION |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 244 | export CUDNN_INSTALL_PATH |
Eugene Brevdo | 56f1d64 | 2016-03-10 17:18:30 -0800 | [diff] [blame] | 245 | break |
| 246 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 247 | |
| 248 | if [ "$OSNAME" == "Linux" ]; then |
| 249 | CUDNN_PATH_FROM_LDCONFIG="$(ldconfig -p | sed -n 's/.*libcudnn.so .* => \(.*\)/\1/p')" |
| 250 | if [ -e "${CUDNN_PATH_FROM_LDCONFIG}${TF_CUDNN_EXT}" ]; then |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 251 | export TF_CUDNN_VERSION |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 252 | export CUDNN_INSTALL_PATH="$(dirname ${CUDNN_PATH_FROM_LDCONFIG})" |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 253 | break |
| 254 | fi |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 255 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 256 | echo "Invalid path to cuDNN ${CUDNN_VERSION} toolkit. Neither of the following two files can be found:" |
| 257 | echo "${CUDNN_INSTALL_PATH}/${CUDA_DNN_LIB_PATH}" |
| 258 | echo "${CUDNN_INSTALL_PATH}/${CUDA_DNN_LIB_ALT_PATH}" |
| 259 | if [ "$OSNAME" == "Linux" ]; then |
| 260 | echo "${CUDNN_PATH_FROM_LDCONFIG}${TF_CUDNN_EXT}" |
| 261 | fi |
| 262 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 263 | if [ -z "$fromuser" ]; then |
| 264 | exit 1 |
| 265 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 266 | # Retry |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 267 | TF_CUDNN_VERSION="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 268 | CUDNN_INSTALL_PATH="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 269 | done |
| 270 | |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 271 | # Configure the compute capabilities that TensorFlow builds for. |
| 272 | # Since Cuda toolkit is not backward-compatible, this is not guaranteed to work. |
| 273 | while true; do |
| 274 | fromuser="" |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 275 | default_cuda_compute_capabilities="3.5,5.2" |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 276 | if [ -z "$TF_CUDA_COMPUTE_CAPABILITIES" ]; then |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 277 | cat << EOF |
| 278 | Please specify a list of comma-separated Cuda compute capabilities you want to build with. |
| 279 | You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. |
| 280 | Please note that each additional compute capability significantly increases your build time and binary size. |
| 281 | EOF |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 282 | read -p "[Default is: \"3.5,5.2\"]: " TF_CUDA_COMPUTE_CAPABILITIES |
| 283 | fromuser=1 |
| 284 | fi |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 285 | if [ -z "$TF_CUDA_COMPUTE_CAPABILITIES" ]; then |
| 286 | TF_CUDA_COMPUTE_CAPABILITIES=$default_cuda_compute_capabilities |
| 287 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 288 | # Check whether all capabilities from the input is valid |
| 289 | COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES//,/ } |
| 290 | ALL_VALID=1 |
| 291 | for CAPABILITY in $COMPUTE_CAPABILITIES; do |
| 292 | if [[ ! "$CAPABILITY" =~ [0-9]+.[0-9]+ ]]; then |
| 293 | echo "Invalid compute capability: " $CAPABILITY |
| 294 | ALL_VALID=0 |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 295 | break |
| 296 | fi |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 297 | done |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 298 | if [ "$ALL_VALID" == "0" ]; then |
| 299 | if [ -z "$fromuser" ]; then |
| 300 | exit 1 |
| 301 | fi |
| 302 | else |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 303 | export TF_CUDA_COMPUTE_CAPABILITIES |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 304 | break |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 305 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 306 | TF_CUDA_COMPUTE_CAPABILITIES="" |
| 307 | done |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 308 | |
Jonathan Hseu | 1283b84 | 2016-09-29 15:05:32 -0800 | [diff] [blame^] | 309 | bazel_clean_and_fetch |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 310 | |
| 311 | echo "Configuration finished" |