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