TensorFlow源码编译过程
Step1:下载TF-2.2.0版本并配置
Please specify the location of python. [Default is /home/yifei.wang/anaconda3/envs/py35/bin/python]: /home/yifei.wang/anaconda3/envs/py35/bin/python
Found possible Python library paths:
/home/yifei.wang/anaconda3/envs/py35/lib/python3.5/site-packages
Please input the desired Python library path to use. Default is [/home/yifei.wang/anaconda3/envs/py35/lib/python3.5/site-packages]
Do you wish to build TensorFlow with XLA JIT support? [Y/n]: n
No XLA JIT support will be enabled for TensorFlow.
Do you wish to build TensorFlow with OpenCL SYCL support? [y/N]: n
No OpenCL SYCL support will be enabled for TensorFlow.
Do you wish to build TensorFlow with ROCm support? [y/N]: n
No ROCm support will be enabled for TensorFlow.
Do you wish to build TensorFlow with CUDA support? [y/N]: n
No CUDA support will be enabled for TensorFlow.
Do you wish to download a fresh release of clang? (Experimental) [y/N]: n
Clang will be downloaded and used to compile tensorflow.
Do you wish to build TensorFlow with MPI support? [y/N]: N
No MPI support will be enabled for TensorFlow.
Please specify optimization flags to use during compilation when bazel option “—config=opt” is specified [Default is -march=native -Wno-sign-compare]:
Would you like to interactively configure ./WORKSPACE for Android builds? [y/N]: n
Not configuring the WORKSPACE for Android builds.
Preconfigured Bazel build configs. You can use any of the below by adding “—config=<>” to your build command. See .bazelrc for more details.
—config=mkl # Build with MKL support.
—config=monolithic # Config for mostly static monolithic build.
—config=ngraph # Build with Intel nGraph support.
—config=numa # Build with NUMA support.
—config=dynamic_kernels # (Experimental) Build kernels into separate shared objects.
—config=v2 # Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
—config=noaws # Disable AWS S3 filesystem support.
—config=nogcp # Disable GCP support.
—config=nohdfs # Disable HDFS support.
—config=nonccl # Disable NVIDIA NCCL support.
Configuration finished
Please specify the home path of the Android NDK to use. [Default is /home/yifei.wang/Android/Sdk/ndk-bundle]: /home/yifei.wang/android-ndk-r21
WARNING: The NDK version in /home/yifei.wang/android-ndk-r21 is 21, which is not supported by Bazel (officially supported versions: [10, 11, 12, 13, 14, 15, 16, 17, 18]). Please use another version. Compiling Android targets may result in confusing errors.
Please specify the (min) Android NDK API level to use. [Available levels: [‘16’, ‘17’, ‘18’, ‘19’, ‘21’, ‘22’, ‘23’, ‘24’, ‘26’, ‘27’, ‘28’, ‘29’]] [Default is 21]: 21
Please specify the home path of the Android SDK to use. [Default is /home/yifei.wang/Android/Sdk]: /home/yifei.wang/android-sdk-linux
Please specify the Android SDK API level to use. [Available levels: [‘29’]] [Default is 29]: 29
Please specify an Android build tools version to use. [Available versions: [‘29.0.2’]] [Default is 29.0.2]: 29.0.2
Preconfigured Bazel build configs. You can use any of the below by adding “—config=<>” to your build command. See .bazelrc for more details.
—config=mkl # Build with MKL support.
—config=monolithic # Config for mostly static monolithic build.
—config=ngraph # Build with Intel nGraph support.
—config=numa # Build with NUMA support.
—config=dynamic_kernels # (Experimental) Build kernels into separate shared objects.
—config=v2 # Build TensorFlow 2.x instead of 1.x.
Preconfigured Bazel build configs to DISABLE default on features:
—config=noaws # Disable AWS S3 filesystem support.
—config=nogcp # Disable GCP support.
—config=nohdfs # Disable HDFS support.
—config=nonccl # Disable NVIDIA NCCL support.
Configuration finished
Step2: 进入tensorflow/configure.py文件,查看当前TensorFlow源码对于的Bazel、NDK版本
| TF Version | Python Version | Compiler |
|---|---|---|
| 2.2.0 | 2.7、3.5-3.7 | GCC 7.3.1 |
| master | 2.7、3.5-3.7 | GCC 7.3.1 |
| 2.1.0 | 2.7、3.5-3.7 | GCC 7.3.1 |
| 2.0.0 | 2.7、3.5-3.7 | GCC 7.3.1 |
