/
build_tensorflow.sh
executable file
·46 lines (37 loc) · 1.24 KB
/
build_tensorflow.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
set -e
(
#bazel clean
export CC_OPT_FLAGS="-march=native"
export TF_NEED_S3=${TF_NEED_S3-0}
export TF_NEED_GDR=${TF_NEED_GDR-0}
export TF_NEED_GCP=${TF_NEED_GCP-0}
export TF_NEED_HDFS=${TF_NEED_HDFS-0}
export TF_NEED_OPENCL=${TF_NEED_OPENCL-0}
export TF_NEED_JEMALLOC=${TF_NEED_JEMALLOC-1}
export TF_NEED_VERBS=${TF_NEED_VERBS-0}
export TF_NEED_MPI=${TF_NEED_MPI-0}
export TF_ENABLE_XLA=${TF_ENABLE_XLA-0}
export TF_CUDA_CLANG=${TF_CUDA_LANG-0}
export TF_NEED_CUDA=${TF_NEED_CUDA-0}
export TF_NEED_MKL=${TF_NEED_MKL-0}
export TF_DOWNLOAD_MKL=${TF_DOWNLOAD_MKL-0}
if [ "${TF_DOWNLOAD_MKL}" == "0" ]
then
export TF_MKL_ROOT="$(readlink -e ../mkl_dnn)"
fi
export PYTHON_BIN_PATH="$(which python)"
export PYTHON_LIB_PATH="$(${PYTHON_BIN_PATH} -c 'import site; print(site.getsitepackages()[0])')"
./configure
CONFIG="-c opt --copt=${CC_OPT_FLAGS} "
if [ "${TF_NEED_MKL}" == "1" ]
then
CONFIG="--config=mkl ${CONFIG} --copt=-DEIGEN_USE_VML --copt=-mfpmath=sse"
fi
if [ "${TF_NEED_CUDA}" == "1" ]
then
CONFIG="--config=cuda ${CONFIG}"
fi
bazel build ${ADDITIONAL_BAZEL_OPTS} --verbose_failures ${CONFIG} tensorflow:libtensorflow.so
bazel build ${ADDITIONAL_BAZEL_OPTS} --verbose_failures ${CONFIG} //tensorflow/tools/lib_package:libtensorflow
)