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 | |
A. Unique TensorFlower | edaf3b3 | 2016-10-10 10:26:22 -0800 | [diff] [blame] | 3 | set -e |
| 4 | set -o pipefail |
| 5 | |
Andrew Selle | 09045e4 | 2016-09-06 08:19:04 -0800 | [diff] [blame] | 6 | # Find out the absolute path to where ./configure resides |
A. Unique TensorFlower | 46d2c28 | 2017-01-02 22:19:48 -0800 | [diff] [blame] | 7 | pushd `dirname $0` > /dev/null |
Andrew Selle | 09045e4 | 2016-09-06 08:19:04 -0800 | [diff] [blame] | 8 | SOURCE_BASE_DIR=`pwd -P` |
| 9 | popd > /dev/null |
| 10 | |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 11 | PLATFORM="$(uname -s | tr 'A-Z' 'a-z')" |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 12 | |
| 13 | function is_linux() { |
| 14 | if [[ "${PLATFORM}" == "linux" ]]; then |
| 15 | true |
| 16 | else |
| 17 | false |
| 18 | fi |
| 19 | } |
| 20 | |
| 21 | function is_macos() { |
| 22 | if [[ "${PLATFORM}" == "darwin" ]]; then |
| 23 | true |
| 24 | else |
| 25 | false |
| 26 | fi |
| 27 | } |
| 28 | |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 29 | function is_windows() { |
| 30 | # On windows, the shell script is actually running in msys |
Shanqing Cai | 56fc883 | 2017-01-23 18:25:25 -0800 | [diff] [blame] | 31 | if [[ "${PLATFORM}" =~ msys_nt*|mingw*|cygwin*|uwin* ]]; then |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 32 | true |
| 33 | else |
| 34 | false |
| 35 | fi |
| 36 | } |
| 37 | |
Jonathan Hseu | 1283b84 | 2016-09-29 15:05:32 -0800 | [diff] [blame] | 38 | function bazel_clean_and_fetch() { |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 39 | # bazel clean --expunge currently doesn't work on Windows |
| 40 | # TODO(pcloudy): Re-enable it after bazel clean --expunge is fixed. |
| 41 | if ! is_windows; then |
| 42 | bazel clean --expunge |
| 43 | fi |
Benoit Steiner | 639b4e7 | 2017-02-08 09:25:09 -0800 | [diff] [blame^] | 44 | bazel fetch "//tensorflow/... -//tensorflow/contrib/nccl/... \ |
| 45 | -//tensorflow/examples/android/..." |
Jonathan Hseu | 1283b84 | 2016-09-29 15:05:32 -0800 | [diff] [blame] | 46 | } |
| 47 | |
Andrew Harp | 51dbc46 | 2017-01-27 14:42:30 -0800 | [diff] [blame] | 48 | # Delete any leftover BUILD files from the Makefile build, which would interfere |
| 49 | # with Bazel parsing. |
| 50 | MAKEFILE_DOWNLOAD_DIR=tensorflow/contrib/makefile/downloads |
| 51 | if [ -d "${MAKEFILE_DOWNLOAD_DIR}" ]; then |
| 52 | find ${MAKEFILE_DOWNLOAD_DIR} -type f -name '*BUILD' -delete |
| 53 | fi |
| 54 | |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 55 | ## Set up python-related environment settings |
| 56 | while true; do |
| 57 | fromuser="" |
| 58 | if [ -z "$PYTHON_BIN_PATH" ]; then |
A. Unique TensorFlower | edaf3b3 | 2016-10-10 10:26:22 -0800 | [diff] [blame] | 59 | default_python_bin_path=$(which python || which python3 || true) |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 60 | read -p "Please specify the location of python. [Default is $default_python_bin_path]: " PYTHON_BIN_PATH |
| 61 | fromuser="1" |
| 62 | if [ -z "$PYTHON_BIN_PATH" ]; then |
| 63 | PYTHON_BIN_PATH=$default_python_bin_path |
| 64 | fi |
| 65 | fi |
| 66 | if [ -e "$PYTHON_BIN_PATH" ]; then |
| 67 | break |
| 68 | fi |
| 69 | echo "Invalid python path. ${PYTHON_BIN_PATH} cannot be found" 1>&2 |
| 70 | if [ -z "$fromuser" ]; then |
| 71 | exit 1 |
| 72 | fi |
| 73 | PYTHON_BIN_PATH="" |
| 74 | # Retry |
| 75 | done |
| 76 | |
Benoit Steiner | 639b4e7 | 2017-02-08 09:25:09 -0800 | [diff] [blame^] | 77 | ## Set up MKL related environment settings |
| 78 | if false; then # Disable building with MKL for now |
| 79 | while [ "$TF_NEED_MKL" == "" ]; do |
| 80 | fromuser="" |
| 81 | read -p "Do you wish to build TensorFlow with MKL support? [y/N] " INPUT |
| 82 | fromuser="1" |
| 83 | case $INPUT in |
| 84 | [Yy]* ) echo "MKL support will be enabled for TensorFlow"; TF_NEED_MKL=1;; |
| 85 | [Nn]* ) echo "No MKL support will be enabled for TensorFlow"; TF_NEED_MKL=0;; |
| 86 | "" ) echo "No MKL support will be enabled for TensorFlow"; TF_NEED_MKL=0;; |
| 87 | * ) echo "Invalid selection: " $INPUT;; |
| 88 | esac |
| 89 | done |
| 90 | |
| 91 | OSNAME=`uname -s` |
| 92 | |
| 93 | if [ "$TF_NEED_MKL" == "1" ]; then # TF_NEED_MKL |
| 94 | DST=`dirname $0` |
| 95 | ARCHIVE_BASENAME=mklml_lnx_2017.0.2.20170110.tgz |
| 96 | GITHUB_RELEASE_TAG=v0.3 |
| 97 | MKLURL="https://github.com/01org/mkl-dnn/releases/download/$GITHUB_RELEASE_TAG/$ARCHIVE_BASENAME" |
| 98 | if ! [ -e "$DST/third_party/mkl/$ARCHIVE_BASENAME" ]; then |
| 99 | wget --no-check-certificate -P $DST/third_party/mkl/ $MKLURL |
| 100 | fi |
| 101 | tar -xzf $DST/third_party/mkl/$ARCHIVE_BASENAME -C $DST/third_party/mkl/ |
| 102 | extracted_dir_name="${ARCHIVE_BASENAME%.*}" |
| 103 | MKL_INSTALL_PATH=$DST/third_party/mkl/$extracted_dir_name |
| 104 | MKL_INSTALL_PATH=`${PYTHON_BIN_PATH} -c "import os; print(os.path.realpath(os.path.expanduser('${MKL_INSTALL_PATH}')))"` |
| 105 | |
| 106 | if [ "$OSNAME" == "Linux" ]; then |
| 107 | # Full MKL configuration |
| 108 | MKL_RT_LIB_PATH="lib/intel64/libmkl_rt.so" #${TF_MKL_EXT}#TODO version? |
| 109 | MKL_RT_OMP_LIB_PATH="../compiler/lib/intel64/libiomp5.so" #TODO VERSION? |
| 110 | |
| 111 | # MKL-ML configuration |
| 112 | MKL_ML_LIB_PATH="lib/libmklml_intel.so" #${TF_MKL_EXT}#TODO version? |
| 113 | MKL_ML_OMP_LIB_PATH="lib/libiomp5.so" #TODO VERSION? |
| 114 | elif [ "$OSNAME" == "Darwin" ]; then |
| 115 | echo "Darwin is unsupported yet"; |
| 116 | exit 1 |
| 117 | fi |
| 118 | |
| 119 | if [ -e "$MKL_INSTALL_PATH/${MKL_ML_LIB_PATH}" ]; then |
| 120 | ln -sf $MKL_INSTALL_PATH/${MKL_ML_LIB_PATH} third_party/mkl/ |
| 121 | ln -sf $MKL_INSTALL_PATH/${MKL_ML_OMP_LIB_PATH} third_party/mkl/ |
| 122 | ln -sf $MKL_INSTALL_PATH/include third_party/mkl/ |
| 123 | ln -sf $MKL_INSTALL_PATH/include third_party/eigen3/mkl_include |
| 124 | else |
| 125 | echo "ERROR: $MKL_INSTALL_PATH/${MKL_ML_LIB_PATH} does not exist"; |
| 126 | exit 1 |
| 127 | fi |
| 128 | |
| 129 | if [ -z "$fromuser" ]; then |
| 130 | exit 1 |
| 131 | fi |
| 132 | |
| 133 | cat > third_party/mkl/mkl.config <<EOF |
| 134 | # MKL_INSTALL_PATH refers to the location of MKL root folder. The MKL header and library |
| 135 | # files can be either in this directory, or under include/ and lib64/ |
| 136 | MKL_INSTALL_PATH=$MKL_INSTALL_PATH |
| 137 | EOF |
| 138 | |
| 139 | fi # TF_NEED_MKL |
| 140 | ################## MKL |
| 141 | fi # Disable building with MKL for now |
| 142 | |
Martin Wicke | c4e3d4a | 2017-01-13 12:20:42 -0800 | [diff] [blame] | 143 | ## Set up architecture-dependent optimization flags. |
| 144 | if [ -z "$CC_OPT_FLAGS" ]; then |
| 145 | default_cc_opt_flags="-march=native" |
Benoit Steiner | 639b4e7 | 2017-02-08 09:25:09 -0800 | [diff] [blame^] | 146 | read -p "Please specify optimization flags to use during compilation when bazel option "\ |
| 147 | "\"--config=opt\" is specified [Default is $default_cc_opt_flags]: " CC_OPT_FLAGS |
Martin Wicke | c4e3d4a | 2017-01-13 12:20:42 -0800 | [diff] [blame] | 148 | if [ -z "$CC_OPT_FLAGS" ]; then |
| 149 | CC_OPT_FLAGS=$default_cc_opt_flags |
| 150 | fi |
| 151 | fi |
| 152 | |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 153 | if is_windows; then |
A. Unique TensorFlower | 95a954a | 2016-12-28 13:40:08 -0800 | [diff] [blame] | 154 | TF_NEED_GCP=0 |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 155 | TF_NEED_HDFS=0 |
Jonathan Hseu | 83c6e0c | 2017-01-11 16:39:35 -0800 | [diff] [blame] | 156 | TF_NEED_JEMALLOC=0 |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 157 | TF_NEED_OPENCL=0 |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 158 | fi |
| 159 | |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 160 | if is_linux; then |
| 161 | while [ "$TF_NEED_JEMALLOC" == "" ]; do |
| 162 | read -p "Do you wish to use jemalloc as the malloc implementation? [Y/n] "\ |
| 163 | INPUT |
| 164 | case $INPUT in |
| 165 | [Yy]* ) echo "jemalloc enabled"; TF_NEED_JEMALLOC=1;; |
| 166 | [Nn]* ) echo "jemalloc disabled"; TF_NEED_JEMALLOC=0;; |
| 167 | "" ) echo "jemalloc enabled"; TF_NEED_JEMALLOC=1;; |
| 168 | * ) echo "Invalid selection: " $INPUT;; |
| 169 | esac |
| 170 | done |
| 171 | else |
| 172 | TF_NEED_JEMALLOC=0 |
| 173 | fi |
Jonathan Hseu | 83c6e0c | 2017-01-11 16:39:35 -0800 | [diff] [blame] | 174 | |
| 175 | if [ "$TF_NEED_JEMALLOC" == "1" ]; then |
| 176 | sed -i -e "s/WITH_JEMALLOC = False/WITH_JEMALLOC = True/" tensorflow/core/platform/default/build_config.bzl |
| 177 | else |
| 178 | sed -i -e "s/WITH_JEMALLOC = True/WITH_JEMALLOC = False/" tensorflow/core/platform/default/build_config.bzl |
| 179 | fi |
| 180 | |
A. Unique TensorFlower | 95a954a | 2016-12-28 13:40:08 -0800 | [diff] [blame] | 181 | while [ "$TF_NEED_GCP" == "" ]; do |
| 182 | read -p "Do you wish to build TensorFlow with "\ |
| 183 | "Google Cloud Platform support? [y/N] " INPUT |
| 184 | case $INPUT in |
| 185 | [Yy]* ) echo "Google Cloud Platform support will be enabled for "\ |
| 186 | "TensorFlow"; TF_NEED_GCP=1;; |
| 187 | [Nn]* ) echo "No Google Cloud Platform support will be enabled for "\ |
| 188 | "TensorFlow"; TF_NEED_GCP=0;; |
| 189 | "" ) echo "No Google Cloud Platform support will be enabled for "\ |
| 190 | "TensorFlow"; TF_NEED_GCP=0;; |
| 191 | * ) echo "Invalid selection: " $INPUT;; |
| 192 | esac |
| 193 | done |
| 194 | |
| 195 | if [ "$TF_NEED_GCP" == "1" ]; then |
| 196 | ## Verify that libcurl header files are available. |
| 197 | # Only check Linux, since on MacOS the header files are installed with XCode. |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 198 | if is_linux && [[ ! -f "/usr/include/curl/curl.h" ]]; then |
A. Unique TensorFlower | 95a954a | 2016-12-28 13:40:08 -0800 | [diff] [blame] | 199 | echo "ERROR: It appears that the development version of libcurl is not "\ |
| 200 | "available. Please install the libcurl3-dev package." |
| 201 | exit 1 |
| 202 | fi |
| 203 | |
| 204 | # Update Bazel build configuration. |
| 205 | sed -i -e "s/WITH_GCP_SUPPORT = False/WITH_GCP_SUPPORT = True/" tensorflow/core/platform/default/build_config.bzl |
| 206 | else |
| 207 | # Update Bazel build configuration. |
| 208 | sed -i -e "s/WITH_GCP_SUPPORT = True/WITH_GCP_SUPPORT = False/" tensorflow/core/platform/default/build_config.bzl |
| 209 | fi |
| 210 | |
Jonathan Hseu | 9f5b098 | 2016-09-19 11:14:58 -0800 | [diff] [blame] | 211 | while [ "$TF_NEED_HDFS" == "" ]; do |
| 212 | read -p "Do you wish to build TensorFlow with "\ |
| 213 | "Hadoop File System support? [y/N] " INPUT |
| 214 | case $INPUT in |
| 215 | [Yy]* ) echo "Hadoop File System support will be enabled for "\ |
| 216 | "TensorFlow"; TF_NEED_HDFS=1;; |
| 217 | [Nn]* ) echo "No Hadoop File System support will be enabled for "\ |
| 218 | "TensorFlow"; TF_NEED_HDFS=0;; |
| 219 | "" ) echo "No Hadoop File System support will be enabled for "\ |
| 220 | "TensorFlow"; TF_NEED_HDFS=0;; |
| 221 | * ) echo "Invalid selection: " $INPUT;; |
| 222 | esac |
| 223 | done |
| 224 | |
| 225 | if [ "$TF_NEED_HDFS" == "1" ]; then |
| 226 | # Update Bazel build configuration. |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 227 | sed -i -e "s/WITH_HDFS_SUPPORT = False/WITH_HDFS_SUPPORT = True/" tensorflow/core/platform/default/build_config.bzl |
Jonathan Hseu | 9f5b098 | 2016-09-19 11:14:58 -0800 | [diff] [blame] | 228 | else |
| 229 | # Update Bazel build configuration. |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 230 | sed -i -e "s/WITH_HDFS_SUPPORT = True/WITH_HDFS_SUPPORT = False/" tensorflow/core/platform/default/build_config.bzl |
Jonathan Hseu | 9f5b098 | 2016-09-19 11:14:58 -0800 | [diff] [blame] | 231 | fi |
| 232 | |
Peter Hawkins | 1e67c90 | 2017-01-09 12:04:37 -0800 | [diff] [blame] | 233 | ## Enable XLA. |
| 234 | while [ "$TF_ENABLE_XLA" == "" ]; do |
| 235 | read -p "Do you wish to build TensorFlow with the XLA just-in-time compiler (experimental)? [y/N] " INPUT |
| 236 | case $INPUT in |
| 237 | [Yy]* ) echo "XLA JIT support will be enabled for TensorFlow"; TF_ENABLE_XLA=1;; |
| 238 | [Nn]* ) echo "No XLA JIT support will be enabled for TensorFlow"; TF_ENABLE_XLA=0;; |
| 239 | "" ) echo "No XLA support will be enabled for TensorFlow"; TF_ENABLE_XLA=0;; |
| 240 | * ) echo "Invalid selection: " $INPUT;; |
| 241 | esac |
| 242 | done |
| 243 | |
| 244 | if [ "$TF_ENABLE_XLA" == "1" ]; then |
| 245 | # Update Bazel build configuration. |
Eugene Brevdo | ce2a102 | 2017-01-27 17:37:30 -0800 | [diff] [blame] | 246 | sed -i -e "s/^WITH_XLA_SUPPORT = [FT].*/WITH_XLA_SUPPORT = True/" tensorflow/core/platform/default/build_config_root.bzl |
Peter Hawkins | 1e67c90 | 2017-01-09 12:04:37 -0800 | [diff] [blame] | 247 | else |
| 248 | # Update Bazel build configuration. |
Eugene Brevdo | ce2a102 | 2017-01-27 17:37:30 -0800 | [diff] [blame] | 249 | sed -i -e "s/^WITH_XLA_SUPPORT = [FT].*/WITH_XLA_SUPPORT = False/" tensorflow/core/platform/default/build_config_root.bzl |
Peter Hawkins | 1e67c90 | 2017-01-09 12:04:37 -0800 | [diff] [blame] | 250 | fi |
| 251 | |
| 252 | |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 253 | # Invoke python_config and set up symlinks to python includes |
A. Unique TensorFlower | edaf3b3 | 2016-10-10 10:26:22 -0800 | [diff] [blame] | 254 | ./util/python/python_config.sh --setup "$PYTHON_BIN_PATH" |
Vijay Vasudevan | bf6b536 | 2015-12-02 15:04:40 -0800 | [diff] [blame] | 255 | |
Martin Wicke | c4e3d4a | 2017-01-13 12:20:42 -0800 | [diff] [blame] | 256 | # Append CC optimization flags to bazel.rc |
| 257 | echo >> tools/bazel.rc |
| 258 | for opt in $CC_OPT_FLAGS; do |
Gunhan Gulsoy | acdbd68 | 2017-01-16 01:21:51 -0800 | [diff] [blame] | 259 | echo "build:opt --cxxopt=$opt --copt=$opt" >> tools/bazel.rc |
Martin Wicke | c4e3d4a | 2017-01-13 12:20:42 -0800 | [diff] [blame] | 260 | done |
| 261 | |
Andrew Selle | 09045e4 | 2016-09-06 08:19:04 -0800 | [diff] [blame] | 262 | # Run the gen_git_source to create links where bazel can track dependencies for |
| 263 | # git hash propagation |
| 264 | GEN_GIT_SOURCE=tensorflow/tools/git/gen_git_source.py |
| 265 | chmod a+x ${GEN_GIT_SOURCE} |
Patrick Nguyen | c5ab3dd | 2016-10-20 12:09:18 -0800 | [diff] [blame] | 266 | "${PYTHON_BIN_PATH}" ${GEN_GIT_SOURCE} --configure "${SOURCE_BASE_DIR}" |
Andrew Selle | 09045e4 | 2016-09-06 08:19:04 -0800 | [diff] [blame] | 267 | |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 268 | ## Set up SYCL-related environment settings |
| 269 | while [ "$TF_NEED_OPENCL" == "" ]; do |
| 270 | read -p "Do you wish to build TensorFlow with OpenCL support? [y/N] " INPUT |
| 271 | case $INPUT in |
| 272 | [Yy]* ) echo "OpenCL support will be enabled for TensorFlow"; TF_NEED_OPENCL=1;; |
| 273 | [Nn]* ) echo "No OpenCL support will be enabled for TensorFlow"; TF_NEED_OPENCL=0;; |
| 274 | "" ) echo "No OpenCL support will be enabled for TensorFlow"; TF_NEED_OPENCL=0;; |
| 275 | * ) echo "Invalid selection: " $INPUT;; |
| 276 | esac |
| 277 | done |
| 278 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 279 | ## Set up Cuda-related environment settings |
| 280 | |
| 281 | while [ "$TF_NEED_CUDA" == "" ]; do |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 282 | read -p "Do you wish to build TensorFlow with CUDA support? [y/N] " INPUT |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 283 | case $INPUT in |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 284 | [Yy]* ) echo "CUDA support will be enabled for TensorFlow"; TF_NEED_CUDA=1;; |
| 285 | [Nn]* ) echo "No CUDA support will be enabled for TensorFlow"; TF_NEED_CUDA=0;; |
| 286 | "" ) echo "No CUDA support will be enabled for TensorFlow"; TF_NEED_CUDA=0;; |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 287 | * ) echo "Invalid selection: " $INPUT;; |
| 288 | esac |
| 289 | done |
| 290 | |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 291 | export TF_NEED_CUDA |
Rohan Jain | aab0997 | 2017-01-05 14:39:17 -0800 | [diff] [blame] | 292 | export TF_NEED_OPENCL |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 293 | if [[ "$TF_NEED_CUDA" == "0" ]] && [[ "$TF_NEED_OPENCL" == "0" ]]; then |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 294 | echo "Configuration finished" |
Jonathan Hseu | 1283b84 | 2016-09-29 15:05:32 -0800 | [diff] [blame] | 295 | bazel_clean_and_fetch |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 296 | exit |
| 297 | fi |
| 298 | |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 299 | if [ "$TF_NEED_CUDA" == "1" ]; then |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 300 | # Set up which gcc nvcc should use as the host compiler |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 301 | # No need to set this on Windows |
| 302 | while ! is_windows && true; do |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 303 | fromuser="" |
| 304 | if [ -z "$GCC_HOST_COMPILER_PATH" ]; then |
A. Unique TensorFlower | edaf3b3 | 2016-10-10 10:26:22 -0800 | [diff] [blame] | 305 | default_gcc_host_compiler_path=$(which gcc || true) |
Shanqing Cai | a81c4f9 | 2016-07-22 10:37:35 -0800 | [diff] [blame] | 306 | 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] | 307 | fromuser="1" |
| 308 | if [ -z "$GCC_HOST_COMPILER_PATH" ]; then |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 309 | GCC_HOST_COMPILER_PATH="$default_gcc_host_compiler_path" |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 310 | fi |
| 311 | fi |
| 312 | if [ -e "$GCC_HOST_COMPILER_PATH" ]; then |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 313 | export GCC_HOST_COMPILER_PATH |
Vijay Vasudevan | 80a5a3e | 2016-03-29 18:23:11 -0800 | [diff] [blame] | 314 | break |
| 315 | fi |
| 316 | echo "Invalid gcc path. ${GCC_HOST_COMPILER_PATH} cannot be found" 1>&2 |
| 317 | if [ -z "$fromuser" ]; then |
| 318 | exit 1 |
| 319 | fi |
| 320 | GCC_HOST_COMPILER_PATH="" |
| 321 | # Retry |
| 322 | done |
| 323 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 324 | # Find out where the CUDA toolkit is installed |
| 325 | while true; do |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 326 | # Configure the Cuda SDK version to use. |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 327 | if [ -z "$TF_CUDA_VERSION" ]; then |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 328 | 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] | 329 | fi |
| 330 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 331 | fromuser="" |
| 332 | if [ -z "$CUDA_TOOLKIT_PATH" ]; then |
| 333 | default_cuda_path=/usr/local/cuda |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 334 | if is_windows; then |
| 335 | if [ -z "$CUDA_PATH" ]; then |
| 336 | default_cuda_path="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0" |
| 337 | else |
| 338 | default_cuda_path="$(cygpath -m "$CUDA_PATH")" |
| 339 | fi |
| 340 | fi |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 341 | 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] | 342 | fromuser="1" |
| 343 | if [ -z "$CUDA_TOOLKIT_PATH" ]; then |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 344 | CUDA_TOOLKIT_PATH="$default_cuda_path" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 345 | fi |
| 346 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 347 | |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 348 | if [[ -z "$TF_CUDA_VERSION" ]]; then |
| 349 | TF_CUDA_EXT="" |
| 350 | else |
| 351 | TF_CUDA_EXT=".$TF_CUDA_VERSION" |
| 352 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 353 | |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 354 | if is_windows; then |
| 355 | CUDA_RT_LIB_PATH="lib/x64/cudart.lib" |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 356 | elif is_linux; then |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 357 | CUDA_RT_LIB_PATH="lib64/libcudart.so${TF_CUDA_EXT}" |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 358 | elif is_macos; then |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 359 | CUDA_RT_LIB_PATH="lib/libcudart${TF_CUDA_EXT}.dylib" |
| 360 | fi |
| 361 | |
| 362 | if [ -e "${CUDA_TOOLKIT_PATH}/${CUDA_RT_LIB_PATH}" ]; then |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 363 | export CUDA_TOOLKIT_PATH |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 364 | export TF_CUDA_VERSION |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 365 | break |
| 366 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 367 | echo "Invalid path to CUDA $TF_CUDA_VERSION toolkit. ${CUDA_TOOLKIT_PATH}/${CUDA_RT_LIB_PATH} cannot be found" |
| 368 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 369 | if [ -z "$fromuser" ]; then |
| 370 | exit 1 |
| 371 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 372 | # Retry |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 373 | TF_CUDA_VERSION="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 374 | CUDA_TOOLKIT_PATH="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 375 | done |
| 376 | |
Martin Wicke | 916776a | 2016-01-14 07:30:00 -0800 | [diff] [blame] | 377 | # Find out where the cuDNN library is installed |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 378 | while true; do |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 379 | # Configure the Cudnn version to use. |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 380 | if [ -z "$TF_CUDNN_VERSION" ]; then |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 381 | 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] | 382 | fi |
| 383 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 384 | fromuser="" |
| 385 | if [ -z "$CUDNN_INSTALL_PATH" ]; then |
| 386 | default_cudnn_path=${CUDA_TOOLKIT_PATH} |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 387 | 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] | 388 | fromuser="1" |
| 389 | if [ -z "$CUDNN_INSTALL_PATH" ]; then |
| 390 | CUDNN_INSTALL_PATH=$default_cudnn_path |
| 391 | fi |
| 392 | # Result returned from "read" will be used unexpanded. That make "~" unuseable. |
| 393 | # Going through one more level of expansion to handle that. |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 394 | 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] | 395 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 396 | |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 397 | if [[ -z "$TF_CUDNN_VERSION" ]]; then |
| 398 | TF_CUDNN_EXT="" |
| 399 | else |
Benoit Steiner | 639b4e7 | 2017-02-08 09:25:09 -0800 | [diff] [blame^] | 400 | TF_CUDNN_EXT=".$TF_CUDNN_VERSION" |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 401 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 402 | |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 403 | if is_windows; then |
| 404 | CUDA_DNN_LIB_PATH="lib/x64/cudnn.lib" |
| 405 | CUDA_DNN_LIB_ALT_PATH="lib/x64/cudnn.lib" |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 406 | elif is_linux; then |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 407 | CUDA_DNN_LIB_PATH="lib64/libcudnn.so${TF_CUDNN_EXT}" |
| 408 | CUDA_DNN_LIB_ALT_PATH="libcudnn.so${TF_CUDNN_EXT}" |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 409 | elif is_macos; then |
Benoit Steiner | 639b4e7 | 2017-02-08 09:25:09 -0800 | [diff] [blame^] | 410 | CUDA_DNN_LIB_PATH="lib/libcudnn${TF_CUDNN_EXT}.dylib" |
| 411 | CUDA_DNN_LIB_ALT_PATH="libcudnn${TF_CUDNN_EXT}.dylib" |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 412 | fi |
| 413 | |
| 414 | 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] | 415 | export TF_CUDNN_VERSION |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 416 | export CUDNN_INSTALL_PATH |
Eugene Brevdo | 56f1d64 | 2016-03-10 17:18:30 -0800 | [diff] [blame] | 417 | break |
| 418 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 419 | |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 420 | if is_linux; then |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 421 | CUDNN_PATH_FROM_LDCONFIG="$(ldconfig -p | sed -n 's/.*libcudnn.so .* => \(.*\)/\1/p')" |
| 422 | if [ -e "${CUDNN_PATH_FROM_LDCONFIG}${TF_CUDNN_EXT}" ]; then |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 423 | export TF_CUDNN_VERSION |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 424 | export CUDNN_INSTALL_PATH="$(dirname ${CUDNN_PATH_FROM_LDCONFIG})" |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 425 | break |
| 426 | fi |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 427 | fi |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 428 | echo "Invalid path to cuDNN ${CUDNN_VERSION} toolkit. Neither of the following two files can be found:" |
| 429 | echo "${CUDNN_INSTALL_PATH}/${CUDA_DNN_LIB_PATH}" |
| 430 | echo "${CUDNN_INSTALL_PATH}/${CUDA_DNN_LIB_ALT_PATH}" |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 431 | if is_linux; then |
A. Unique TensorFlower | 8bf6ef1 | 2016-05-05 08:36:05 -0800 | [diff] [blame] | 432 | echo "${CUDNN_PATH_FROM_LDCONFIG}${TF_CUDNN_EXT}" |
| 433 | fi |
| 434 | |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 435 | if [ -z "$fromuser" ]; then |
| 436 | exit 1 |
| 437 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 438 | # Retry |
A. Unique TensorFlower | 8a59748 | 2016-01-29 09:34:18 -0800 | [diff] [blame] | 439 | TF_CUDNN_VERSION="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 440 | CUDNN_INSTALL_PATH="" |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 441 | done |
| 442 | |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 443 | # Configure the compute capabilities that TensorFlow builds for. |
| 444 | # Since Cuda toolkit is not backward-compatible, this is not guaranteed to work. |
| 445 | while true; do |
| 446 | fromuser="" |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 447 | default_cuda_compute_capabilities="3.5,5.2" |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 448 | if [ -z "$TF_CUDA_COMPUTE_CAPABILITIES" ]; then |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 449 | cat << EOF |
| 450 | Please specify a list of comma-separated Cuda compute capabilities you want to build with. |
| 451 | You can find the compute capability of your device at: https://developer.nvidia.com/cuda-gpus. |
| 452 | Please note that each additional compute capability significantly increases your build time and binary size. |
| 453 | EOF |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 454 | read -p "[Default is: \"3.5,5.2\"]: " TF_CUDA_COMPUTE_CAPABILITIES |
| 455 | fromuser=1 |
| 456 | fi |
A. Unique TensorFlower | 2c598e8 | 2016-08-25 10:22:44 -0800 | [diff] [blame] | 457 | if [ -z "$TF_CUDA_COMPUTE_CAPABILITIES" ]; then |
| 458 | TF_CUDA_COMPUTE_CAPABILITIES=$default_cuda_compute_capabilities |
| 459 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 460 | # Check whether all capabilities from the input is valid |
| 461 | COMPUTE_CAPABILITIES=${TF_CUDA_COMPUTE_CAPABILITIES//,/ } |
| 462 | ALL_VALID=1 |
| 463 | for CAPABILITY in $COMPUTE_CAPABILITIES; do |
| 464 | if [[ ! "$CAPABILITY" =~ [0-9]+.[0-9]+ ]]; then |
| 465 | echo "Invalid compute capability: " $CAPABILITY |
| 466 | ALL_VALID=0 |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 467 | break |
| 468 | fi |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 469 | done |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 470 | if [ "$ALL_VALID" == "0" ]; then |
| 471 | if [ -z "$fromuser" ]; then |
| 472 | exit 1 |
| 473 | fi |
| 474 | else |
A. Unique TensorFlower | b0bdff4 | 2016-08-26 12:50:48 -0800 | [diff] [blame] | 475 | export TF_CUDA_COMPUTE_CAPABILITIES |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 476 | break |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 477 | fi |
Vijay Vasudevan | fe056f0 | 2016-02-17 11:42:30 -0800 | [diff] [blame] | 478 | TF_CUDA_COMPUTE_CAPABILITIES="" |
| 479 | done |
Vijay Vasudevan | 4dffee7 | 2015-11-12 11:27:00 -0800 | [diff] [blame] | 480 | |
Andrew Harp | 1cb9689 | 2016-12-08 20:05:49 -0800 | [diff] [blame] | 481 | if is_windows; then |
| 482 | # The following three variables are needed for MSVC toolchain configuration in Bazel |
| 483 | export CUDA_PATH="$CUDA_TOOLKIT_PATH" |
| 484 | export CUDA_COMPUTE_CAPABILITIES="$TF_CUDA_COMPUTE_CAPABILITIES" |
| 485 | export NO_WHOLE_ARCHIVE_OPTION=1 |
| 486 | |
| 487 | # Set GCC_HOST_COMPILER_PATH to keep cuda_configure.bzl happy |
| 488 | export GCC_HOST_COMPILER_PATH="/usr/bin/dummy_compiler" |
| 489 | fi |
| 490 | |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 491 | # end of if "$TF_NEED_CUDA" == "1" |
| 492 | fi |
| 493 | |
| 494 | # OpenCL configuration |
| 495 | |
| 496 | if [ "$TF_NEED_OPENCL" == "1" ]; then |
| 497 | |
| 498 | # Determine which C++ compiler should be used as the host compiler |
| 499 | while true; do |
| 500 | fromuser="" |
| 501 | if [ -z "$HOST_CXX_COMPILER" ]; then |
Jonathan Hseu | bed8383 | 2016-12-22 15:38:30 -0800 | [diff] [blame] | 502 | default_cxx_host_compiler=$(which clang++-3.6 || true) |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 503 | read -p "Please specify which C++ compiler should be used as the host C++ compiler. [Default is $default_cxx_host_compiler]: " HOST_CXX_COMPILER |
| 504 | fromuser="1" |
| 505 | if [ -z "$HOST_CXX_COMPILER" ]; then |
| 506 | HOST_CXX_COMPILER=$default_cxx_host_compiler |
| 507 | fi |
| 508 | fi |
| 509 | if [ -e "$HOST_CXX_COMPILER" ]; then |
| 510 | export HOST_CXX_COMPILER |
| 511 | break |
| 512 | fi |
| 513 | echo "Invalid C++ compiler path. ${HOST_CXX_COMPILER} cannot be found" 1>&2 |
| 514 | if [ -z "$fromuser" ]; then |
| 515 | exit 1 |
| 516 | fi |
| 517 | HOST_CXX_COMPILER="" |
| 518 | # Retry |
| 519 | done |
| 520 | |
| 521 | # Determine which C compiler should be used as the host compiler |
| 522 | while true; do |
| 523 | fromuser="" |
| 524 | if [ -z "$HOST_C_COMPILER" ]; then |
Jonathan Hseu | bed8383 | 2016-12-22 15:38:30 -0800 | [diff] [blame] | 525 | default_c_host_compiler=$(which clang-3.6 || true) |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 526 | read -p "Please specify which C compiler should be used as the host C compiler. [Default is $default_c_host_compiler]: " HOST_C_COMPILER |
| 527 | fromuser="1" |
| 528 | if [ -z "$HOST_C_COMPILER" ]; then |
| 529 | HOST_C_COMPILER=$default_c_host_compiler |
| 530 | fi |
| 531 | fi |
| 532 | if [ -e "$HOST_C_COMPILER" ]; then |
| 533 | export HOST_C_COMPILER |
| 534 | break |
| 535 | fi |
| 536 | echo "Invalid C compiler path. ${HOST_C_COMPILER} cannot be found" 1>&2 |
| 537 | if [ -z "$fromuser" ]; then |
| 538 | exit 1 |
| 539 | fi |
| 540 | HOST_C_COMPILER="" |
| 541 | # Retry |
| 542 | done |
| 543 | |
| 544 | while true; do |
| 545 | # Configure the OPENCL version to use. |
| 546 | TF_OPENCL_VERSION="1.2" |
| 547 | |
| 548 | # Point to ComputeCpp root |
| 549 | if [ -z "$COMPUTECPP_TOOLKIT_PATH" ]; then |
| 550 | default_computecpp_toolkit_path=/usr/local/computecpp |
Martin Wicke | 2e4869a | 2016-12-14 15:46:53 -0800 | [diff] [blame] | 551 | read -p "Please specify the location where ComputeCpp for SYCL $TF_OPENCL_VERSION is installed. [Default is $default_computecpp_toolkit_path]: " COMPUTECPP_TOOLKIT_PATH |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 552 | fromuser="1" |
| 553 | if [ -z "$COMPUTECPP_TOOLKIT_PATH" ]; then |
| 554 | COMPUTECPP_TOOLKIT_PATH=$default_computecpp_toolkit_path |
| 555 | fi |
| 556 | fi |
| 557 | |
Jonathan Hseu | c058a01 | 2017-01-17 15:06:43 -0800 | [diff] [blame] | 558 | if is_linux; then |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 559 | SYCL_RT_LIB_PATH="lib/libComputeCpp.so" |
| 560 | fi |
| 561 | |
| 562 | if [ -e "${COMPUTECPP_TOOLKIT_PATH}/${SYCL_RT_LIB_PATH}" ]; then |
| 563 | export COMPUTECPP_TOOLKIT_PATH |
| 564 | break |
| 565 | fi |
| 566 | echo "Invalid SYCL $TF_OPENCL_VERSION library path. ${COMPUTECPP_TOOLKIT_PATH}/${SYCL_RT_LIB_PATH} cannot be found" |
| 567 | |
| 568 | if [ -z "$fromuser" ]; then |
| 569 | exit 1 |
| 570 | fi |
| 571 | # Retry |
| 572 | TF_OPENCL_VERSION="" |
| 573 | COMPUTECPP_TOOLKIT_PATH="" |
| 574 | done |
| 575 | |
Benoit Steiner | a771598 | 2016-11-09 13:14:03 -0800 | [diff] [blame] | 576 | # end of if "$TF_NEED_OPENCL" == "1" |
| 577 | fi |
| 578 | |
Jonathan Hseu | 1283b84 | 2016-09-29 15:05:32 -0800 | [diff] [blame] | 579 | bazel_clean_and_fetch |
Manjunath Kudlur | f41959c | 2015-11-06 16:27:58 -0800 | [diff] [blame] | 580 | |
| 581 | echo "Configuration finished" |