From 639b4e71f532761a4840b1cdbaea55ad0917c75b Mon Sep 17 00:00:00 2001 From: Benoit Steiner Date: Wed, 8 Feb 2017 09:25:09 -0800 Subject: Merge changes from github. Change: 146918929 --- configure | 116 +++++++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 73 insertions(+), 43 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 2d8d85b021..4f1dc2a910 100755 --- a/configure +++ b/configure @@ -41,7 +41,8 @@ function bazel_clean_and_fetch() { if ! is_windows; then bazel clean --expunge fi - bazel fetch "//tensorflow/... -//tensorflow/examples/android/..." + bazel fetch "//tensorflow/... -//tensorflow/contrib/nccl/... \ + -//tensorflow/examples/android/..." } # Delete any leftover BUILD files from the Makefile build, which would interfere @@ -73,10 +74,77 @@ while true; do # Retry done +## Set up MKL related environment settings +if false; then # Disable building with MKL for now + while [ "$TF_NEED_MKL" == "" ]; do + fromuser="" + read -p "Do you wish to build TensorFlow with MKL support? [y/N] " INPUT + fromuser="1" + case $INPUT in + [Yy]* ) echo "MKL support will be enabled for TensorFlow"; TF_NEED_MKL=1;; + [Nn]* ) echo "No MKL support will be enabled for TensorFlow"; TF_NEED_MKL=0;; + "" ) echo "No MKL support will be enabled for TensorFlow"; TF_NEED_MKL=0;; + * ) echo "Invalid selection: " $INPUT;; + esac + done + + OSNAME=`uname -s` + + if [ "$TF_NEED_MKL" == "1" ]; then # TF_NEED_MKL + DST=`dirname $0` + ARCHIVE_BASENAME=mklml_lnx_2017.0.2.20170110.tgz + GITHUB_RELEASE_TAG=v0.3 + MKLURL="https://github.com/01org/mkl-dnn/releases/download/$GITHUB_RELEASE_TAG/$ARCHIVE_BASENAME" + if ! [ -e "$DST/third_party/mkl/$ARCHIVE_BASENAME" ]; then + wget --no-check-certificate -P $DST/third_party/mkl/ $MKLURL + fi + tar -xzf $DST/third_party/mkl/$ARCHIVE_BASENAME -C $DST/third_party/mkl/ + extracted_dir_name="${ARCHIVE_BASENAME%.*}" + MKL_INSTALL_PATH=$DST/third_party/mkl/$extracted_dir_name + MKL_INSTALL_PATH=`${PYTHON_BIN_PATH} -c "import os; print(os.path.realpath(os.path.expanduser('${MKL_INSTALL_PATH}')))"` + + if [ "$OSNAME" == "Linux" ]; then + # Full MKL configuration + MKL_RT_LIB_PATH="lib/intel64/libmkl_rt.so" #${TF_MKL_EXT}#TODO version? + MKL_RT_OMP_LIB_PATH="../compiler/lib/intel64/libiomp5.so" #TODO VERSION? + + # MKL-ML configuration + MKL_ML_LIB_PATH="lib/libmklml_intel.so" #${TF_MKL_EXT}#TODO version? + MKL_ML_OMP_LIB_PATH="lib/libiomp5.so" #TODO VERSION? + elif [ "$OSNAME" == "Darwin" ]; then + echo "Darwin is unsupported yet"; + exit 1 + fi + + if [ -e "$MKL_INSTALL_PATH/${MKL_ML_LIB_PATH}" ]; then + ln -sf $MKL_INSTALL_PATH/${MKL_ML_LIB_PATH} third_party/mkl/ + ln -sf $MKL_INSTALL_PATH/${MKL_ML_OMP_LIB_PATH} third_party/mkl/ + ln -sf $MKL_INSTALL_PATH/include third_party/mkl/ + ln -sf $MKL_INSTALL_PATH/include third_party/eigen3/mkl_include + else + echo "ERROR: $MKL_INSTALL_PATH/${MKL_ML_LIB_PATH} does not exist"; + exit 1 + fi + + if [ -z "$fromuser" ]; then + exit 1 + fi + +cat > third_party/mkl/mkl.config < - # libcudnn.so.4. - # If the path is not a symlink, readlink will exit with an error code, so - # in that case, we return the path itself. - if [ -f "$cudnn_lib_path" ]; then - REALVAL=`readlink "${cudnn_lib_path}" || echo "${cudnn_lib_path}"` - else - REALVAL=`readlink "${cudnn_alt_lib_path}" || echo "${cudnn_alt_lib_path}"` - fi - - # Extract the version of the SONAME, if it was indeed symlinked to - # the SONAME version of the file. - if [[ "$REALVAL" =~ .so[.]+([0-9]*) ]]; then - TF_CUDNN_EXT="."${BASH_REMATCH[1]} - TF_CUDNN_VERSION=${BASH_REMATCH[1]} - echo "libcudnn.so resolves to libcudnn${TF_CUDNN_EXT}" - elif [[ "$REALVAL" =~ ([0-9]*).dylib ]]; then - TF_CUDNN_EXT=${BASH_REMATCH[1]}".dylib" - TF_CUDNN_VERSION=${BASH_REMATCH[1]} - echo "libcudnn.dylib resolves to libcudnn${TF_CUDNN_EXT}" - fi else - if is_macos; then - TF_CUDNN_EXT=".${TF_CUDNN_VERSION}.dylib" - else - TF_CUDNN_EXT=".$TF_CUDNN_VERSION" - fi + TF_CUDNN_EXT=".$TF_CUDNN_VERSION" fi if is_windows; then @@ -377,8 +407,8 @@ while true; do CUDA_DNN_LIB_PATH="lib64/libcudnn.so${TF_CUDNN_EXT}" CUDA_DNN_LIB_ALT_PATH="libcudnn.so${TF_CUDNN_EXT}" elif is_macos; then - CUDA_DNN_LIB_PATH="lib/libcudnn${TF_CUDNN_EXT}" - CUDA_DNN_LIB_ALT_PATH="libcudnn${TF_CUDNN_EXT}" + CUDA_DNN_LIB_PATH="lib/libcudnn${TF_CUDNN_EXT}.dylib" + CUDA_DNN_LIB_ALT_PATH="libcudnn${TF_CUDNN_EXT}.dylib" fi if [ -e "$CUDNN_INSTALL_PATH/${CUDA_DNN_LIB_ALT_PATH}" -o -e "$CUDNN_INSTALL_PATH/${CUDA_DNN_LIB_PATH}" ]; then -- cgit v1.2.3