1 安裝JDK
apt-get install openjdk-8-jdk
2 安裝bazel
到 https://github.com/bazelbuild/bazel/releases 去下載 bazel-0.16.1-installer-linux-x86_64.sh ,然後執行:
sh bazel-0.16.1-installer-linux-x86_64.sh
來安裝bazel。
3 安裝 nccl
tensorflow 1.10.1 需要用到nccl,可以到 https://developer.nvidia.com/nccl 下載最新版本。建議選擇”NCCL <version> O/S agnostic and cuda xx”,直接拷貝到對應cuda目錄就好。
4 編譯 tensorflow/
到 https://github.com/tensorflow/tensorflow/releases 下載 tensorflow-1.10.1.tar.gz,然後執行以下命令:
tar zxvf tensorflow-1.10.1.tar.gz
cd tensorflow-1.10.1
./configure
bazel build --verbose_failures --config=opt --config=cuda --copt=-mavx --copt=-mavx2 --copt=-mfma --copt=-mfpmath=both --copt=-msse4.2 -k //tensorflow/tools/pip_package:build_pip_package
bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
pip install /tmp/tensorflow_pkg/tensorflow-1.10.1-cp35-cp35m-linux_x86_64.whl