sh 构建Tensorflow自动化

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 构建Tensorflow自动化相关的知识,希望对你有一定的参考价值。

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`

以上是关于sh 构建Tensorflow自动化的主要内容,如果未能解决你的问题,请参考以下文章

如何学习TensorFlow源码

如何学习TensorFlow源码

在Jetson TX2上构建TensorFlow

sh 从tensorflow冷冻模型到tensorflow lite

sh 使用当前时间戳自动更新xcode项目内部版本号和构建版本

远程视频实时监控人脸识别色球追踪Tensorflow 目标检测目标分类未知区域探索全自动SLAM构建地图 PS2手柄控制