preconfigured tensorflow building acript
x#! /bin/bash
# use XCode 8.2.1
export TF_TYPE=”cpu”
export TF_NEED_GCP=0
export TF_NEED_HDFS=0
export TF_NEED_AWS=0
export TF_NEED_KAFKA=0
export TF_ENABLE_XLA=1
export TF_NEED_GDR=0
export TF_NEED_VERBS=0
export TF_NEED_OPENCL_SYCL=0
export TF_DOWNLOAD_CLANG=0
export TF_NEED_MPI=0
export TF_SET_ANDROID_WORKSPACE=0
export TF_NEED_CUDA=0
export TF_CUDA_VERSION=9.1
#export CUDA_TOOLKIT_PATH=/usr/local/cuda
export TF_NCCL_VERSION=1.3
export NCCL_INSTALL_PATH=/Users/vseledkin/code/nccl/build/
export TF_CUDNN_VERSION=7
export CUDNN_INSTALL_PATH=~/code/cudnn7
export TF_CUDA_COMPUTE_CAPABILITIES=5.2 # for Quadro P6000, 5.2 for Titan X
export TF_CUDA_CLANG=0
export CLANG_CUDA_COMPILER_PATH=/usr/bin/clang
export PYTHON_BIN_PATH=/usr/local/bin/python3
export PYTHON_LIB_PATH=/usr/local/lib/python3.6/site-packages
raw_cpu_flags=`sysctl -a | grep machdep.cpu.features | cut -d ":" -f 2 | tr '[:upper:]' '[:lower:]'`
COPT="--copt=-march=native"
echo $raw_cpu_flags
for cpu_feature in $raw_cpu_flags
do
case "$cpu_feature" in
"sse4.1" | "sse4.2" | "ssse3" | "fma" | "cx16" | "popcnt" | "maes")
COPT+=" --copt=-m$cpu_feature"
;;
"avx1.0")
COPT+=" --copt=-mavx"
;;
*)
# noop
;;
esac
done
echo $COPT
#bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
#bazel shutdown
bazel clean
./configure
bazel build $COPT --config=opt -k //tensorflow/tools/pip_package:build_pip_package
#bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
#pip install --upgrade /tmp/tensorflow_pkg/`ls /tmp/tensorflow_pkg/ | grep tensorflow`