|
# Environment variables for building TensorFlow 1.12 on Ubuntu 18.04 |
|
# |
|
# Notes: |
|
# - For some reason, bazel was unable to find the correct temporary directory |
|
# and the specified libraries (even though the locations are specified via |
|
# configuration.) A workaround is to populate the TMP and LD_LIBRARY_PATH |
|
# environment variables explicitly with the lib64 and lib paths of the libraries. |
|
# - You might need to install additional Keras packages as described in the solutions |
|
# to this issue: https://github.com/tensorflow/tensorflow/issues/21518 |
|
# |
|
# CPU type (see https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html): |
|
# - native |
|
# |
|
# This assumes: |
|
# - Python 3.6 |
|
# - Bazel 0.15+ |
|
# - GCC 8 |
|
# |
|
# For CUDA: |
|
# - GCC 6.4 (see https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html) |
|
# - CUDA 9.2 |
|
# - cuDNN 7.3.1 |
|
# - NCCL 2.3.5 |
|
# - TensorRT 4.0.1.6 |
|
# |
|
# Optionally instead of CUDA: |
|
# - ComputeCPP 1.0.1 |
|
# |
|
# Optionally: |
|
# - libibverbs-dev |
|
# - librdmacm-dev |
|
# |
|
# Source this file, then follow the on-screen instructions. |
|
|
|
# Bazel 0.18.0 quirks |
|
export TMP=/tmp |
|
|
|
# CPU architecture |
|
export CPU_ARCH=native |
|
|
|
# Python |
|
export PYTHON_BIN_PATH=/home/mmayer/anaconda3/envs/tensorflow-1.12/bin/python |
|
export PYTHON_LIB_PATH=/home/mmayer/anaconda3/envs/tensorflow-1.12/lib/python3.6/site-packages |
|
|
|
# GCC |
|
export HOST_C_COMPILER=/usr/bin/gcc-7 |
|
export HOST_CXX_COMPILER=/usr/bin/g++-7 |
|
export GCC_HOST_COMPILER_PATH=/usr/bin/gcc-6 |
|
export CC_OPT_FLAGS=-march=$CPU_ARCH |
|
|
|
# Compilation |
|
export TF_DOWNLOAD_CLANG=0 |
|
|
|
# OpenCL |
|
export TF_NEED_COMPUTECPP=0 |
|
export TF_NEED_OPENCL_SYCL=0 |
|
export TF_NEED_OPENCL=0 |
|
export COMPUTECPP_TOOLKIT_PATH=/opt/ComputeCpp-CE-1.0.1-Ubuntu-16.04-x86_64 |
|
|
|
# Apache Ignite support |
|
export TF_NEED_IGNITE=1 |
|
|
|
# AMD ROCm |
|
export TF_NEED_ROCM=0 |
|
|
|
# CUDA |
|
export TF_NEED_CUDA=1 |
|
export TF_CUDA_CLANG=0 |
|
export TF_CUDA_VERSION=9.2 |
|
export CUDA_TOOLKIT_PATH=/usr/local/cuda-$TF_CUDA_VERSION |
|
|
|
# NCCL |
|
export TF_NCCL_VERSION=2.3.5 |
|
export NCCL_INSTALL_PATH=/opt/nccl_2.3.5-2-cuda9.2 |
|
export NCCL_HDR_PATH=$NCCL_INSTALL_PATH/include |
|
|
|
# CUDA Compute Capabilities |
|
# https://developer.nvidia.com/cuda-gpus |
|
# |
|
# - 3.7: K80 |
|
# - 5.2: Titan X, 980 Ti |
|
# - 5.3: Jetson TX1 |
|
# - 6.0: Tesla P100 |
|
# - 6.1: GTX 1080 Ti, GTX 1070, Titan XP |
|
# - 7.0: Tesla V100 |
|
export TF_CUDA_COMPUTE_CAPABILITIES=5.2,6.1 |
|
|
|
# cuDNN |
|
export TF_CUDNN_VERSION=7.3.1 |
|
export CUDNN_INSTALL_PATH=/opt/cudnn7.3.1-cuda9.2 |
|
|
|
# TensorRT |
|
export TF_NEED_TENSORRT=1 |
|
export TF_TENSORRT_VERSION=4.0.1.6 |
|
export TENSORRT_INSTALL_PATH=/opt/TensorRT-4.0.1.6-cuda9.2-cudnn7.1/ |
|
|
|
# MPI |
|
export TF_NEED_MPI=0 |
|
|
|
# Android |
|
export TF_SET_ANDROID_WORKSPACE=0 |
|
|
|
# Memory access GDR/VERBS |
|
# https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/verbs/README.md |
|
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/gdr/README.md |
|
export TF_NEED_GDR=0 |
|
export TF_NEED_VERBS=0 |
|
|
|
# XLA JIT: Accelerated Linear Algebra |
|
export TF_ENABLE_XLA=1 |
|
|
|
# Build options |
|
export BUILD_OPTIONS='--config=opt --config=mkl --config=ngraph' |
|
if [ "$TF_NEED_CUDA" == "1" ]; then |
|
BUILD_OPTIONS="$OPTIONS --config=cuda" |
|
fi |
|
if [ "$TF_NEED_GDR" == "1" ]; then |
|
BUILD_OPTIONS="$OPTIONS --config=gdr" |
|
fi |
|
if [ "$TF_NEED_VERBS" == "1" ]; then |
|
BUILD_OPTIONS="$OPTIONS --config=verbs" |
|
fi |
|
|
|
# Documentation hints |
|
echo "Targeting $CPU_ARCH architecture." |
|
echo "To build TensorFlow, run:" |
|
echo "" |
|
echo " ./configure" |
|
echo " bazel build \$BUILD_OPTIONS //tensorflow/tools/pip_package:build_pip_package" |
|
echo " bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg" |
|
echo "" |
|
echo "For extra tooling, run:" |
|
echo " bazel build \$BUILD_OPTIONS //tensorflow/compiler/aot:tfcompile" |
|
echo " bazel build \$BUILD_OPTIONS //tensorflow/tools/graph_transforms:transform_graph" |
|
echo " bazel build \$BUILD_OPTIONS //tensorflow/python/tools:freeze_graph" |
|
echo " bazel build \$BUILD_OPTIONS tensorflow/contrib/lite/toco:toco" |
|
echo "" |
|
echo "Note that all --config=... options are available from the \$BUILD_OPTIONS environment variable." |
|
echo "They expand to the following values:" |
|
echo " $BUILD_OPTIONS" |
|
echo "" |