1.安装nccl
&& git clone https://github.com/NVIDIA/nccl.git \
&& pip3 install cython -i https://pypi.tuna.tsinghua.edu.cn/simple \
&& cd nccl && make -j32 src.build CUDA_HOME='/usr/local/cuda-9.0/' NVCC_GENCODE="-gencode=arch=compute_61,code=sm_61" \
&& yum install -y rpm-build rpmdevtools && make -j32 pkg.redhat.build && make install \
&& cd /home && rm -rf nccl \
# 验证 nccl 是否安装成功
# cd /home && git clone https://github.com/NVIDIA/nccl-tests.git \
# cd nccl-tests && make -j32 && ./build/all_reduce_perf -b 8 -e 256M -f 2 -g 2 \
# cd /home && rm -rf nccl-tests
# cat /etc/ld.so.conf
include ld.so.conf.d/*.conf
# echo "/usr/local/lib" >> /etc/ld.so.conf
# ldconfig
2.安装git
wget https://github.com/git/git/archive/v2.9.2.tar.gz && \
yum -y groupinstall "Development Tools" && \
yum -y install zlib-devel asciidoc xmlto openssl-devel\
yum -y install perl-ExtUtils-MakeMaker && \
tar -xvf v2.9.2.tar.gz && \
cd git-2.9.2 && \
autoconf && \
./configure --prefix=/usr/local/git && make -j32 install && \
echo export PATH=/usr/local/git/bin:/usr/libexec/git-core:$PATH >> /etc/profile && \
source /etc/profile &&\
echo export PATH=/usr/local/git/bin:/usr/libexec/git-core:$PATH >> /etc/profile.d/source_profile.sh &&\
rm -rf /home/*
3.安装python3
cd /home/wth && \
tar -xvf Python-3.6.6.tar.xz && \
cd Python-3.6.6 && \
./configure --prefix=/usr/local/python3 && \
make && make install && \
ln -s /usr/local/python3/bin/python3 /usr/bin/python3 &&
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
4.安装Bazel
wget https://github.com/bazelbuild/bazel/releases/download/0.19.1/bazel-0.19.1-installer-linux-x86_64.sh .
chmod +x ./bazel-0.19.1-installer-linux-x86_64.sh
./bazel-0.24.0-installer-linux-x86_64.sh --user
自动补全脚本在 ~/.bazel/bin/bazel-complete.bash,把这个全路径,写入到 ~/.bashrc 文件中
source /path/to/bazel-complete.bash
ln -s /root/bin/bazel /usr/bin/bazel
5.安装protobuf
cd /home && unzip protobuf-cpp-3.5.1.zip && \
cd /home/protobuf-3.5.1 && \
./configure && make -j32 && make install && ldconfig && \
cd /home && rm -rf protobuf-3.5.1 && \
unzip protobuf-python-3.5.1.zip && \
cd /home/protobuf-3.5.1 && \
cd python && /usr/local/python3/bin/python3 setup.py build && /usr/local/python3/bin/python3 setup.py install && \
6.编译的时候需要用到numpy,keras_applications,keras_preprocessing
pip install keras_preprocessing numpy keras_applications -i https://pypi.tuna.tsinghua.edu.cn/simple
7.下载编译tensorflow
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git pull
git checkout r1.12 #此处可以将1.10换成您想安装的任意版本
./configure
8.安装Java
yum install java-11-openjdk
yum install java-11-openjdk-devel
9.安装Bazel
wget https://github.com/bazelbuild/bazel/releases/download/0.19.1/bazel-0.19.1-installer-linux-x86_64.sh .
chmod +x ./bazel-0.19.1-installer-linux-x86_64.sh
./bazel-0.24.0-installer-linux-x86_64.sh --user
自动补全脚本在 ~/.bazel/bin/bazel-complete.bash,把这个全路径,写入到 ~/.bashrc 文件中
source /path/to/bazel-complete.bash
ln -s /root/bin/bazel /usr/bin/bazel
bazel build --config=opt --config=cuda //tensorflow/tools/pip_package:build_pip_package
10.下载编译tensorflow
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
git pull
git checkout r1.12 #此处可以将1.10换成您想安装的任意版本
./configure
11.将其打包成能够使用pip安装的whl包
bazel-bin/tensorflow/tools/pip_package/build_pip_package /home/tensorflow
12.pip install /home/tensorflow_pkg/*.whl