From 19d932f4cb49182c111d646267ac6c0bbc4f2f00 Mon Sep 17 00:00:00 2001 From: mahmoud-abuzaina Date: Fri, 3 Feb 2017 16:56:10 -0700 Subject: Added Intel MKL graph optimization code and the ability to enable MKL when running configure. (#6921) * Added Intel MKL graph optimization code and the ability to enable MKL when running configure. * Fixed inclusion of MKL into build files. * Made changes to MKL graph optimization files based on review comments. * Adding support for MKL matmul op * Revert "Adding support for MKL matmul op" This reverts commit 20d6cdd865dbe790bd03765e82b709bd750d8823. * Changes based on Vijay Vasudevan's comments * Made format-related fixes to some build files. * Setting the execute bit (755) for tensorflow/tools/pip_package/build_pip_package.sh --- configure | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) (limited to 'configure') diff --git a/configure b/configure index 62db930860..513c5a363f 100755 --- a/configure +++ b/configure @@ -73,6 +73,72 @@ 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 <