From 6f2bb20e0a7b014bede944d4fb4fa7b6b1769b11 Mon Sep 17 00:00:00 2001 From: tianshuo78520a <707759223@qq.com> Date: Mon, 7 Dec 2020 12:33:45 +0800 Subject: [PATCH] update docker nccl version 2.7.8 (#28575) --- tools/dockerfile/Dockerfile.centos | 8 +- tools/dockerfile/Dockerfile.ubuntu18 | 20 +-- tools/dockerfile/build_scripts/build.sh | 11 -- .../dockerfile/build_scripts/install_nccl2.sh | 18 ++- tools/dockerfile/build_scripts/install_trt.sh | 13 ++ tools/dockerfile/centos6_manylinux.sh | 7 +- tools/dockerfile/ci_dockerfile.sh | 12 +- tools/dockerfile/ubuntu18_dev.sh | 124 ++++++++++++++++++ 8 files changed, 168 insertions(+), 45 deletions(-) create mode 100755 tools/dockerfile/ubuntu18_dev.sh diff --git a/tools/dockerfile/Dockerfile.centos b/tools/dockerfile/Dockerfile.centos index c88d5927cf0..7dc86e4b0b7 100644 --- a/tools/dockerfile/Dockerfile.centos +++ b/tools/dockerfile/Dockerfile.centos @@ -13,10 +13,11 @@ ENV PATH /opt/rh/devtoolset-2/root/usr/bin:$PATH ENV LD_LIBRARY_PATH /opt/rh/devtoolset-2/root/usr/lib64:/opt/rh/devtoolset-2/root/usr/lib:/usr/local/lib64:/usr/local/lib:${LD_LIBRARY_PATH} ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig -RUN yum install -y gettext-devel sqlite-devel zlib-devel openssl-devel pcre-devel vim tk-devel tkinter libtool xz graphviz wget curl-devel +RUN yum install -y bzip2 gettext-devel sqlite-devel zlib-devel openssl-devel pcre-devel vim tk-devel tkinter libtool xz graphviz wget curl-devel COPY build_scripts /build_scripts RUN bash build_scripts/build.sh RUN bash build_scripts/install_nccl2.sh +RUN bash build_scripts/install_trt.sh RUN rm -rf build_scripts ENV SSL_CERT_FILE=/opt/_internal/certs.pem @@ -40,7 +41,7 @@ ENV GOROOT=/usr/local/go GOPATH=/root/gopath ENV PATH=${GOROOT}/bin:${GOPATH}/bin:${PATH} # protobuf 3.6.1 -RUN cd /opt && wget -q --no-check-certificate https://github.com/google/protobuf/releases/download/v3.6.1/protobuf-cpp-3.6.1.tar.gz && \ +RUN cd /opt && wget -q --no-check-certificate https://paddle-ci.cdn.bcebos.com/protobuf-cpp-3.6.1.tar.gz && \ tar xzf protobuf-cpp-3.6.1.tar.gz && \ cd protobuf-3.6.1 && ./configure && make -j4 && make install && cd .. && rm -f protobuf-cpp-3.6.1.tar.gz @@ -79,7 +80,4 @@ RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \ make -j8 && make install && \ ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache -# Downgrade gcc&&g++ - - CMD ["bash", "/paddle/paddle/scripts/docker/build.sh"] diff --git a/tools/dockerfile/Dockerfile.ubuntu18 b/tools/dockerfile/Dockerfile.ubuntu18 index f8b7bbf91fb..327b77d67a3 100644 --- a/tools/dockerfile/Dockerfile.ubuntu18 +++ b/tools/dockerfile/Dockerfile.ubuntu18 @@ -20,18 +20,20 @@ RUN apt-get update && \ apt-get install -y software-properties-common && add-apt-repository ppa:deadsnakes/ppa && \ apt-get update && \ apt-get install -y curl wget vim git unzip unrar tar xz-utils bzip2 gzip \ - coreutils ntp language-pack-zh-hans python-qt4 libsm6 libxext6 libxrender-dev + coreutils ntp language-pack-zh-hans python-qt4 libsm6 libxext6 libxrender-dev \ + bison graphviz libjpeg-dev zlib1g-dev automake locales clang-format swig net-tools libtool module-init-tools # Downgrade gcc&&g++ WORKDIR /usr/bin - COPY tools/dockerfile/build_scripts /build_scripts - RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts - RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ - ENV PATH=/usr/local/gcc-8.2/bin:$PATH +COPY tools/dockerfile/build_scripts /build_scripts +RUN bash /build_scripts/install_trt.sh +RUN bash /build_scripts/install_gcc.sh gcc82 && rm -rf /build_scripts +RUN cp gcc gcc.bak && cp g++ g++.bak && rm gcc && rm g++ +RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc +RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ +RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc +RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ +ENV PATH=/usr/local/gcc-8.2/bin:$PATH RUN apt-get update && \ apt-get install -y python2.7 python2.7-dev \ diff --git a/tools/dockerfile/build_scripts/build.sh b/tools/dockerfile/build_scripts/build.sh index 7b1eb65ed28..a5d886e0a86 100644 --- a/tools/dockerfile/build_scripts/build.sh +++ b/tools/dockerfile/build_scripts/build.sh @@ -30,8 +30,6 @@ CPYTHON_VERSIONS="3.8.0 3.7.0 3.6.0 3.5.1 2.7.15" # archive OPENSSL_ROOT=openssl-1.1.0i OPENSSL_HASH=ebbfc844a8c8cc0ea5dc10b86c9ce97f401837f3fa08c17b2cdadc118253cf99 -EPEL_RPM_HASH=e5ed9ecf22d0c4279e92075a64c757ad2b38049bcf5c16c4f2b75d5f6860dc0d -DEVTOOLS_HASH=a8ebeb4bed624700f727179e6ef771dafe47651131a00a78b342251415646acc PATCHELF_HASH=f2aa40a6148cb3b0ca807a1bf836b081793e55ec9e5540a5356d800132be7e0a CURL_ROOT=curl-7.49.1 CURL_HASH=eb63cec4bef692eab9db459033f409533e6d10e20942f4b060b32819e81885f1 @@ -51,15 +49,6 @@ source $MY_DIR/build_utils.sh # EPEL support yum -y install wget curl epel-release -#curl -sLO https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm -#check_sha256sum epel-release-6-8.noarch.rpm $EPEL_RPM_HASH - -# Dev toolset (for LLVM and other projects requiring C++11 support) -#curl -sLO http://people.centos.org/tru/devtools-2/devtools-2.repo -#check_sha256sum devtools-2.repo $DEVTOOLS_HASH -#mv devtools-2.repo /etc/yum.repos.d/devtools-2.repo -#rpm -Uvh --replacepkgs epel-release-6*.rpm -#rm -f epel-release-6*.rpm # Development tools and libraries yum -y install bzip2 make git patch unzip bison yasm diffutils \ diff --git a/tools/dockerfile/build_scripts/install_nccl2.sh b/tools/dockerfile/build_scripts/install_nccl2.sh index d158db59436..9f2c30c477b 100644 --- a/tools/dockerfile/build_scripts/install_nccl2.sh +++ b/tools/dockerfile/build_scripts/install_nccl2.sh @@ -17,12 +17,18 @@ VERSION=$(nvcc --version | grep release | grep -oEi "release ([0-9]+)\.([0-9])"| sed "s/release //") if [ "$VERSION" == "10.0" ]; then DEB="nccl-repo-ubuntu1604-2.4.7-ga-cuda10.0_1-1_amd64.deb" -elif [ "$VERSION" == "11.0" ]; then - DEB="nccl-repo-ubuntu1604-2.7.8-ga-cuda11.0_1-1_amd64.deb" -elif [ "$VERSION" == "10.2" ]; then - DEB="nccl-repo-ubuntu1604-2.4.7-ga-cuda10.0_1-1_amd64.deb" -elif [ "$VERSION" == "10.1" ]; then - DEB="nccl-repo-ubuntu1604-2.4.7-ga-cuda10.0_1-1_amd64.deb" +elif [ "$VERSION" == "10.2" ] || [ "$VERSION" == "10.1" ] || [ "$VERSION" == "11.0" ]; then + if [ -f "ls /etc/redhat-release " ];then + rm -f /usr/local/lib/libnccl.so + wget --no-check-certificate -q https://nccl2-deb.cdn.bcebos.com/libnccl-2.7.8-1+cuda10.2.x86_64.rpm + wget --no-check-certificate -q https://nccl2-deb.cdn.bcebos.com/libnccl-devel-2.7.8-1+cuda10.2.x86_64.rpm + wget --no-check-certificate -q https://nccl2-deb.cdn.bcebos.com/libnccl-static-2.7.8-1+cuda10.2.x86_64.rpm + rpm -ivh libnccl-2.7.8-1+cuda10.2.x86_64.rpm + rpm -ivh libnccl-devel-2.7.8-1+cuda10.2.x86_64.rpm + rpm -ivh libnccl-static-2.7.8-1+cuda10.2.x86_64.rpm && rm -f /usr/include/nccl.h + exit 0 + fi + DEB="nccl-repo-ubuntu1604-2.7.8-ga-cuda10.2_1-1_amd64.deb" elif [ "$VERSION" == "9.0" ]; then DEB="nccl-repo-ubuntu1604-2.3.7-ga-cuda9.0_1-1_amd64.deb" else diff --git a/tools/dockerfile/build_scripts/install_trt.sh b/tools/dockerfile/build_scripts/install_trt.sh index 02441efbe2b..47d93c2dfca 100644 --- a/tools/dockerfile/build_scripts/install_trt.sh +++ b/tools/dockerfile/build_scripts/install_trt.sh @@ -20,12 +20,25 @@ if [[ "$VERSION" == "10.1" ]];then wget -q https://paddle-ci.gz.bcebos.com/TRT/TensorRT6-cuda10.1-cudnn7.tar.gz --no-check-certificate tar -zxf TensorRT6-cuda10.1-cudnn7.tar.gz -C /usr/local cp -rf /usr/local/TensorRT6-cuda10.1-cudnn7/include/* /usr/include/ && cp -rf /usr/local/TensorRT6-cuda10.1-cudnn7/lib/* /usr/lib/ + rm TensorRT6-cuda10.1-cudnn7.tar.gz +elif [[ "$VERSION" == "11.0" ]];then + wget -q https://paddle-ci.cdn.bcebos.com/TRT/TensorRT-7.1.3.4.Ubuntu-16.04.x86_64-gnu.cuda-11.0.cudnn8.0.tar.gz --no-check-certificate + tar -zxf TensorRT-7.1.3.4.Ubuntu-16.04.x86_64-gnu.cuda-11.0.cudnn8.0.tar.gz -C /usr/local + cp -rf /usr/local/TensorRT-7.1.3.4/include/* /usr/include/ && cp -rf /usr/local/TensorRT-7.1.3.4/lib/* /usr/lib/ + rm TensorRT-7.1.3.4.Ubuntu-16.04.x86_64-gnu.cuda-11.0.cudnn8.0.tar.gz +elif [[ "$VERSION" == "10.2" ]];then + wget -q https://paddle-ci.cdn.bcebos.com/TRT/TensorRT7-cuda10.2-cudnn7.tar.gz --no-check-certificate + tar -zxf TensorRT7-cuda10.2-cudnn7.tar.gz -C /usr/local + cp -rf /usr/local/TensorRT-7.0.0.11/include/* /usr/include/ && cp -rf /usr/local/TensorRT-7.0.0.11/lib/* /usr/lib/ + rm TensorRT7-cuda10.2-cudnn7.tar.gz elif [[ "$VERSION" == "10.0" ]];then wget -q https://paddle-ci.gz.bcebos.com/TRT/TensorRT6-cuda10.0-cudnn7.tar.gz --no-check-certificate tar -zxf TensorRT6-cuda10.0-cudnn7.tar.gz -C /usr/local cp -rf /usr/local/TensorRT6-cuda10.0-cudnn7/include/* /usr/include/ && cp -rf /usr/local/TensorRT6-cuda10.0-cudnn7/lib/* /usr/lib/ + rm TensorRT6-cuda10.0-cudnn7.tar.gz elif [[ "$VERSION" == "9.0" ]];then wget -q https://paddle-ci.gz.bcebos.com/TRT/TensorRT6-cuda9.0-cudnn7.tar.gz --no-check-certificate tar -zxf TensorRT6-cuda9.0-cudnn7.tar.gz -C /usr/local cp -rf /usr/local/TensorRT6-cuda9.0-cudnn7/include/* /usr/include/ && cp -rf /usr/local/TensorRT6-cuda9.0-cudnn7/lib/* /usr/lib/ + rm TensorRT6-cuda9.0-cudnn7.tar.gz fi diff --git a/tools/dockerfile/centos6_manylinux.sh b/tools/dockerfile/centos6_manylinux.sh index 617c51a9f42..a31376e22d2 100755 --- a/tools/dockerfile/centos6_manylinux.sh +++ b/tools/dockerfile/centos6_manylinux.sh @@ -30,20 +30,19 @@ function make_cuda10cudnn7() { function make_cuda101cudnn7() { sed 's//10.1-cudnn7-devel-centos6/g' Dockerfile.centos >Dockerfile.tmp - sed -i "s#COPY build_scripts /build_scripts#COPY build_scripts /build_scripts \nRUN bash build_scripts/install_gcc.sh gcc82 \nENV PATH=/usr/local/gcc-8.2/bin:\$PATH#g" Dockerfile.tmp + sed -i "s#RUN bash build_scripts/build.sh#RUN bash build_scripts/install_gcc.sh gcc82 \nRUN mv /usr/bin/cc /usr/bin/cc.bak \&\& ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/cc \nENV PATH=/usr/local/gcc-8.2/bin:\$PATH \nRUN bash build_scripts/build.sh#g" Dockerfile.tmp } function make_cuda102cudnn7() { sed 's//10.2-cudnn7-devel-centos6/g' Dockerfile.centos >Dockerfile.tmp - sed -i "s#COPY build_scripts /build_scripts#COPY build_scripts /build_scripts \nRUN bash build_scripts/install_gcc.sh gcc82 \nENV PATH=/usr/local/gcc-8.2/bin:\$PATH#g" Dockerfile.tmp + sed -i "s#RUN bash build_scripts/build.sh#RUN bash build_scripts/install_gcc.sh gcc82 \nRUN mv /usr/bin/cc /usr/bin/cc.bak \&\& ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/cc \nENV PATH=/usr/local/gcc-8.2/bin:\$PATH \nRUN bash build_scripts/build.sh#g" Dockerfile.tmp } function make_cuda11cudnn8() { sed 's//11.0-cudnn8-devel-centos7/g' Dockerfile.centos >Dockerfile.tmp - sed -i "s#COPY build_scripts /build_scripts#COPY build_scripts /build_scripts \nRUN bash build_scripts/install_gcc.sh gcc82 \nENV PATH=/usr/local/gcc-8.2/bin:\$PATH#g" Dockerfile.tmp + sed -i "s#RUN bash build_scripts/build.sh#RUN bash build_scripts/install_gcc.sh gcc82 \nRUN mv /usr/bin/cc /usr/bin/cc.bak \&\& ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/cc \nENV PATH=/usr/local/gcc-8.2/bin:\$PATH \nRUN bash build_scripts/build.sh#g" Dockerfile.tmp } - function main() { local CMD=$1 case $CMD in diff --git a/tools/dockerfile/ci_dockerfile.sh b/tools/dockerfile/ci_dockerfile.sh index 7138cd6f702..08d501c63c4 100644 --- a/tools/dockerfile/ci_dockerfile.sh +++ b/tools/dockerfile/ci_dockerfile.sh @@ -44,17 +44,9 @@ function make_centos_dockerfile(){ sed -i "${dockerfile_line}i RUN ln -s /usr/lib64/libz.so /usr/local/lib/libz.so \\ RUN ln -s /usr/local/lib/libnccl.so /usr/local/cuda/lib64/ \\ RUN rm -rf /usr/include/NvInfer*" ${dockerfile_name} - sed -i $"${dockerfile_line}i RUN wget --no-check-certificate -q https://paddle-edl.bj.bcebos.com/hadoop-2.7.7.tar.gz \\ + sed -i $"${dockerfile_line}i RUN wget --no-check-certificate -q https://paddle-edl.bj.bcebos.com/hadoop-2.7.7.tar.gz \\ RUN tar -xzf hadoop-2.7.7.tar.gz && mv hadoop-2.7.7 /usr/local/" ${dockerfile_name} - sed -i "s##WORKDIR /usr/bin \\ - COPY tools/dockerfile/build_scripts /build_scripts \\ - RUN bash /build_scripts/install_gcc.sh gcc82 \&\& rm -rf /build_scripts \\ - RUN cp gcc gcc.bak \&\& cp g++ g++.bak \&\& rm gcc \&\& rm g++ \\ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc \\ - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ \\ - RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc \\ - RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ \\ - ENV PATH=/usr/local/gcc-8.2/bin:\$PATH #g" ${dockerfile_name} + sed -i "s#RUN bash build_scripts/build.sh#RUN bash build_scripts/install_gcc.sh gcc82 \nRUN mv /usr/bin/cc /usr/bin/cc.bak \&\& ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/cc \nENV PATH=/usr/local/gcc-8.2/bin:\$PATH \nRUN bash build_scripts/build.sh#g" ${dockerfile_name} } diff --git a/tools/dockerfile/ubuntu18_dev.sh b/tools/dockerfile/ubuntu18_dev.sh new file mode 100755 index 00000000000..03423b28255 --- /dev/null +++ b/tools/dockerfile/ubuntu18_dev.sh @@ -0,0 +1,124 @@ +#!/bin/bash + +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +docker_name=$1 + + +function ref_whl(){ + if [[ ${WITH_GPU} == "ON" ]]; then + ref_gpu=gpu-cuda${ref_CUDA_MAJOR}-cudnn${CUDNN_MAJOR} + install_gpu="_gpu" + else + ref_gpu="cpu" + install_gpu="" + fi + + if [[ ${WITH_MKL} == "ON" ]]; then + ref_mkl=mkl + else + ref_mkl=openblas + fi + + if [[ ${gcc_version} == "8.2.0" ]];then + ref_gcc=_gcc8.2 + fi + + if [[ ${ref_CUDA_MAJOR} == "10" ]];then + ref_version=.post100 + elif [[ ${ref_CUDA_MAJOR} == "10.1" ]];then + ref_version=.post101 + elif [[ ${ref_CUDA_MAJOR} == "10.2" ]];then + ref_version="" + elif [[ ${ref_CUDA_MAJOR} == "9" ]];then + ref_version=.post90 + fi + + ref_web="https://paddle-wheel.bj.bcebos.com/${PADDLE_BRANCH}-${ref_gpu}-${ref_mkl}${ref_gcc}" + + if [[ ${PADDLE_VERSION} == "0.0.0" && ${WITH_GPU} == "ON" ]]; then + ref_paddle_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp27-cp27mu-linux_x86_64.whl + ref_paddle3_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp35-cp35m-linux_x86_64.whl + ref_paddle36_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp36-cp36m-linux_x86_64.whl + ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp37-cp37m-linux_x86_64.whl + ref_paddle38_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp38-cp38-linux_x86_64.whl + else + ref_paddle_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp27-cp27mu-linux_x86_64.whl + ref_paddle3_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp35-cp35m-linux_x86_64.whl + ref_paddle36_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp36-cp36m-linux_x86_64.whl + ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp37-cp37m-linux_x86_64.whl + ref_paddle38_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp38-cp38-linux_x86_64.whl + fi + + if [[ ${PADDLE_VERSION} != "0.0.0" && ${WITH_GPU} == "ON" ]]; then + ref_paddle_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}${ref_version}-cp27-cp27mu-linux_x86_64.whl + ref_paddle3_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}${ref_version}-cp35-cp35m-linux_x86_64.whl + ref_paddle36_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}${ref_version}-cp36-cp36m-linux_x86_64.whl + ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}${ref_version}-cp37-cp37m-linux_x86_64.whl + ref_paddle38_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}${ref_version}-cp38-cp38-linux_x86_64.whl + else + ref_paddle_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp27-cp27mu-linux_x86_64.whl + ref_paddle3_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp35-cp35m-linux_x86_64.whl + ref_paddle36_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp36-cp36m-linux_x86_64.whl + ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp37-cp37m-linux_x86_64.whl + ref_paddle38_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp38-cp38-linux_x86_64.whl + fi +} + + +function install_whl(){ + dockerfile_line=`wc -l Dockerfile.tmp|awk '{print $1}'` + sed -i "${dockerfile_line}i RUN wget -q ${ref_web}/${ref_paddle_whl} && pip install ${ref_paddle_whl} && rm -f ${ref_paddle_whl}" Dockerfile.tmp + sed -i "${dockerfile_line}i RUN wget -q ${ref_web}/${ref_paddle3_whl} && pip3.5 install ${ref_paddle3_whl} && rm -f ${ref_paddle3_whl}" Dockerfile.tmp + sed -i "${dockerfile_line}i RUN wget -q ${ref_web}/${ref_paddle36_whl} && pip3.6 install ${ref_paddle36_whl} && rm -f ${ref_paddle36_whl}" Dockerfile.tmp + sed -i "${dockerfile_line}i RUN wget -q ${ref_web}/${ref_paddle37_whl} && pip3.7 install ${ref_paddle37_whl} && rm -f ${ref_paddle37_whl}" Dockerfile.tmp + sed -i "${dockerfile_line}i RUN wget -q ${ref_web}/${ref_paddle38_whl} && pip3.8 install ${ref_paddle38_whl} && rm -f ${ref_paddle38_whl}" Dockerfile.tmp +} + + +function install_gcc(){ + if [ "${gcc_version}" == "8.2.0" ];then + sed -i 's##WORKDIR /usr/bin \ + COPY tools/dockerfile/build_scripts /build_scripts \ + RUN bash /build_scripts/install_trt.sh \ + RUN bash /build_scripts/install_gcc.sh gcc82 \&\& rm -rf /build_scripts \ + RUN cp gcc gcc.bak \&\& cp g++ g++.bak \&\& rm gcc \&\& rm g++ \ + RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/local/bin/gcc \ + RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/local/bin/g++ \ + RUN ln -s /usr/local/gcc-8.2/bin/gcc /usr/bin/gcc \ + RUN ln -s /usr/local/gcc-8.2/bin/g++ /usr/bin/g++ \ + ENV PATH=/usr/local/gcc-8.2/bin:$PATH #g' Dockerfile.tmp + else + sed -i 's##RUN apt-get update \ + WORKDIR /usr/bin \ + RUN apt install -y gcc-4.8 g++-4.8 \&\& cp gcc gcc.bak \&\& cp g++ g++.bak \&\& rm gcc \&\& rm g++ \&\& ln -s gcc-4.8 gcc \&\& ln -s g++-4.8 g++ #g' Dockerfile.tmp + fi +} + + + +function make_dockerfile(){ + sed "s//${docker_name}/g" tools/dockerfile/Dockerfile.ubuntu18 >Dockerfile.tmp +} + + +function main(){ + make_dockerfile + install_gcc + ref_whl + install_whl +} + +main $@ -- GitLab