From 02a524e5116b9109e20ad0a04616f447175ffec3 Mon Sep 17 00:00:00 2001 From: Wilber Date: Mon, 12 Jul 2021 19:42:11 +0800 Subject: [PATCH] [Docker Images] Add cuda10.2(11.1) + cudnn8.1 + trt7.2 images (#33468) --- tools/dockerfile/Dockerfile.centos | 2 +- tools/dockerfile/build_scripts/build_utils.sh | 4 +- .../dockerfile/build_scripts/install_cudnn.sh | 40 +++++++++++++++++++ tools/dockerfile/build_scripts/install_gcc.sh | 4 +- tools/dockerfile/build_scripts/install_trt.sh | 13 ++++-- tools/dockerfile/centos7_manylinux.sh | 34 ++++++++++++++++ 6 files changed, 88 insertions(+), 9 deletions(-) create mode 100644 tools/dockerfile/build_scripts/install_cudnn.sh diff --git a/tools/dockerfile/Dockerfile.centos b/tools/dockerfile/Dockerfile.centos index 813781b5e79..900ca9b7a97 100644 --- a/tools/dockerfile/Dockerfile.centos +++ b/tools/dockerfile/Dockerfile.centos @@ -34,7 +34,7 @@ ENV PATH=/usr/local/ssl:${GOROOT}/bin:${GOPATH}/bin:${PATH} ENV LIBRARY_PATH=/usr/local/ssl/lib:$LIBRARY_PATH # for paddle -RUN wget --no-check-certificate -qO- https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \ +RUN wget --no-check-certificate -qO- https://paddle-ci.gz.bcebos.com/go1.15.12.linux-amd64.tar.gz | \ tar -xz -C /usr/local && \ mkdir /root/gopath && \ mkdir /root/gopath/bin && \ diff --git a/tools/dockerfile/build_scripts/build_utils.sh b/tools/dockerfile/build_scripts/build_utils.sh index 8f4f88328aa..18dda5be460 100755 --- a/tools/dockerfile/build_scripts/build_utils.sh +++ b/tools/dockerfile/build_scripts/build_utils.sh @@ -151,8 +151,8 @@ function build_cpythons { curl -sLO $GET_PIP_URL build_cpython $py_ver done - rm get-pip.py - rm ez_setup.py + rm -f get-pip.py + rm -f ez_setup.py } diff --git a/tools/dockerfile/build_scripts/install_cudnn.sh b/tools/dockerfile/build_scripts/install_cudnn.sh new file mode 100644 index 00000000000..e90a0789a34 --- /dev/null +++ b/tools/dockerfile/build_scripts/install_cudnn.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Copyright (c) 2021 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. + +# Top-level build script called from Dockerfile + +# Stop at any error, show all commands +set -ex + +VERSION=$(nvcc --version | grep release | grep -oEi "release ([0-9]+)\.([0-9])"| sed "s/release //") + +if [[ "$1" == "cudnn811" && "$VERSION" == "11.1" ]]; then + wget -q https://paddle-ci.gz.bcebos.com/cudnn/cudnn-11.2-linux-x64-v8.1.1.33.tgz --no-check-certificate + tar -xzf cudnn-11.2-linux-x64-v8.1.1.33.tgz && \ + cd cuda && \ + cp -r include /usr && \ + cp -r lib64 /usr && cd ../ && \ + rm -f cudnn-11.2-linux-x64-v8.1.1.33.tgz && \ + rm -rf cuda +elif [[ "$1" == "cudnn811" && "$VERSION" == "10.2" ]]; then + wget -q https://paddle-ci.gz.bcebos.com/cudnn/cudnn-10.2-linux-x64-v8.1.1.33.tgz --no-check-certificate + tar -xzf cudnn-10.2-linux-x64-v8.1.1.33.tgz && \ + cd cuda && \ + cp -r include /usr && \ + cp -r lib64 /usr && cd ../ && \ + rm -f cudnn-10.2-linux-x64-v8.1.1.33.tgz && \ + rm -rf cuda +fi diff --git a/tools/dockerfile/build_scripts/install_gcc.sh b/tools/dockerfile/build_scripts/install_gcc.sh index e744e9ddac6..a95bc99a608 100644 --- a/tools/dockerfile/build_scripts/install_gcc.sh +++ b/tools/dockerfile/build_scripts/install_gcc.sh @@ -44,8 +44,8 @@ if [ "$1" == "gcc82" ]; then ln -s /usr/local/gcc-8.2/lib64/libstdc++.so.6 ${lib_so_6} && \ cp /usr/local/gcc-8.2/lib64/libstdc++.so.6.0.25 ${lib_path} elif [ "$1" == "gcc54" ]; then - wget -q http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-5.4.0/gcc-5.4.0.tar.bz2 - tar -xvf gcc-5.4.0.tar.bz2 && \ + wget -q https://paddle-ci.gz.bcebos.com/gcc-5.4.0.tar.gz + tar -xzf gcc-5.4.0.tar.gz && \ cd gcc-5.4.0 && \ unset LIBRARY_PATH CPATH C_INCLUDE_PATH PKG_CONFIG_PATH CPLUS_INCLUDE_PATH INCLUDE && \ ./contrib/download_prerequisites && \ diff --git a/tools/dockerfile/build_scripts/install_trt.sh b/tools/dockerfile/build_scripts/install_trt.sh index 1df8d0f4568..69552871211 100644 --- a/tools/dockerfile/build_scripts/install_trt.sh +++ b/tools/dockerfile/build_scripts/install_trt.sh @@ -26,16 +26,21 @@ elif [[ "$VERSION" == "11.2" ]];then tar -zxf TensorRT7-cuda11.1-cudnn8.1.tar.gz -C /usr/local cp -rf /usr/local/TensorRT-7.2.3.4/include/* /usr/include/ && cp -rf /usr/local/TensorRT-7.2.3.4/lib/* /usr/lib/ rm TensorRT7-cuda11.1-cudnn8.1.tar.gz +elif [[ "$VERSION" == "11.1" ]];then + wget -q https://paddle-ci.gz.bcebos.com/TRT/TensorRT-7.2.3.4.CentOS-7.9.x86_64-gnu.cuda-11.1.cudnn8.1.tar.gz --no-check-certificate + tar -zxf TensorRT-7.2.3.4.CentOS-7.9.x86_64-gnu.cuda-11.1.cudnn8.1.tar.gz -C /usr/local + cp -rf /usr/local/TensorRT-7.2.3.4/include/* /usr/include/ && cp -rf /usr/local/TensorRT-7.2.3.4/lib/* /usr/lib/ + rm -f TensorRT-7.2.3.4.CentOS-7.9.x86_64-gnu.cuda-11.1.cudnn8.1.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 https://paddle-ci.gz.bcebos.com/TRT/TensorRT7-cuda10.2-cudnn8.tar.gz --no-check-certificate - tar -zxf TensorRT7-cuda10.2-cudnn8.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 TensorRT7-cuda10.2-cudnn8.tar.gz + wget https://paddle-ci.gz.bcebos.com/TRT/TensorRT-7.2.3.4.CentOS-7.9.x86_64-gnu.cuda-10.2.cudnn8.1.tar.gz --no-check-certificate + tar -zxf TensorRT-7.2.3.4.CentOS-7.9.x86_64-gnu.cuda-10.2.cudnn8.1.tar.gz -C /usr/local + cp -rf /usr/local/TensorRT-7.2.3.4/include/* /usr/include/ && cp -rf /usr/local/TensorRT-7.2.3.4/lib/* /usr/lib/ + rm TensorRT-7.2.3.4.CentOS-7.9.x86_64-gnu.cuda-10.2.cudnn8.1.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 diff --git a/tools/dockerfile/centos7_manylinux.sh b/tools/dockerfile/centos7_manylinux.sh index 6ea2a8f836f..9710ec02320 100755 --- a/tools/dockerfile/centos7_manylinux.sh +++ b/tools/dockerfile/centos7_manylinux.sh @@ -47,11 +47,33 @@ function make_cuda102cudnn8() { 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_cuda102cudnn81gcc54 { + sed 's//10.2-cudnn8-devel-centos7/g' Dockerfile.centos >Dockerfile.tmp + sed -i "s#RUN bash build_scripts/build.sh#RUN bash build_scripts/install_gcc.sh gcc54 \nRUN mv /usr/bin/cc /usr/bin/cc.bak \&\& ln -s /usr/local/gcc-5.4/bin/gcc /usr/bin/cc \nENV PATH=/usr/local/gcc-5.4/bin:\$PATH \nRun yum remove -y libcudnn8-devel.x86_64 libcudnn8.x86_64 \nRun bash build_scripts/install_cudnn.sh cudnn811 \nENV CUDNN_VERSION=8.1.1 \nRUN bash build_scripts/build.sh#g" Dockerfile.tmp +} + +function make_cuda102cudnn81gcc82 { + sed 's//10.2-cudnn8-devel-centos7/g' Dockerfile.centos >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 yum remove -y libcudnn8-devel.x86_64 libcudnn8.x86_64 \nRun bash build_scripts/install_cudnn.sh cudnn811 \nENV CUDNN_VERSION=8.1.1 \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#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_cuda111cudnn81gcc54() { + sed 's//11.1-cudnn8-devel-centos7/g' Dockerfile.centos >Dockerfile.tmp + sed -i "s#RUN bash build_scripts/install_nccl2.sh#\n#g" Dockerfile.tmp + sed -i "s#RUN bash build_scripts/build.sh#RUN bash build_scripts/install_gcc.sh gcc54 \nRUN mv /usr/bin/cc /usr/bin/cc.bak \&\& ln -s /usr/local/gcc-5.4/bin/gcc /usr/bin/cc \nENV PATH=/usr/local/gcc-5.4/bin:\$PATH \nRun yum remove -y libcudnn8-devel.x86_64 libcudnn8.x86_64 \nRun bash build_scripts/install_cudnn.sh cudnn811 \nENV CUDNN_VERSION=8.1.1 \nRUN bash build_scripts/build.sh#g" Dockerfile.tmp +} + +function make_cuda111cudnn81gcc82() { + sed 's//11.1-cudnn8-devel-centos7/g' Dockerfile.centos >Dockerfile.tmp + sed -i "s#RUN bash build_scripts/install_nccl2.sh#\n#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 yum remove -y libcudnn8-devel.x86_64 libcudnn8.x86_64 \nRun bash build_scripts/install_cudnn.sh cudnn811 \nENV CUDNN_VERSION=8.1.1 \nRUN bash build_scripts/build.sh#g" Dockerfile.tmp +} + function make_cuda112cudnn8() { sed 's//11.2.1-cudnn8-devel-centos7/g' Dockerfile.centos >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 @@ -75,9 +97,21 @@ function main() { cuda102cudnn8) make_cuda102cudnn8 ;; + cuda102cudnn811gcc54) + make_cuda102cudnn81gcc54 + ;; + cuda102cudnn811gcc82) + make_cuda102cudnn81gcc82 + ;; cuda11cudnn8) make_cuda11cudnn8 ;; + cuda111cudnn81gcc54) + make_cuda111cudnn81gcc54 + ;; + cuda111cudnn81gcc82) + make_cuda111cudnn81gcc82 + ;; cuda112cudnn8) make_cuda112cudnn8 ;; -- GitLab