未验证 提交 afcf6bd0 编写于 作者: P pangyoki 提交者: GitHub

[dockerfile] update go version and delete useless package in dockerfile (#36809)

* add cuda11.4 develop docker

* change default python from 2.7 to 3.7

* change base image for cpu docker

* fix gcc bug

* fix whl package name

* update go version and delete useless package in dockerfile

* fix release18 error

* fix wget sqlite problem

* update go version

* update go version in dev dockerfile

* fix CI error

* install zstd

* fix CI error

* add --no-check-certificate when install go

* python2.7 do not install requirements

* fix CI Coverage error

* coverage==5.5

* fix test_activation ut

* let numpy < 1.22 to pass test_activation_op unittest

* fix test_python_bf16_numpy_datatype unittest

* change paddle-bfloat==0.1.3

* recover version of paddle-bfloat
上级 37580838
PyGithub
coverage
coverage==5.5
pycrypto ; platform_system != "Windows"
mock
gym
......@@ -11,4 +11,4 @@ paddle2onnx>=0.8.2
scipy>=1.6
prettytable
distro
numpy>=1.20
numpy>=1.20,<1.22
......@@ -46,13 +46,14 @@ ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH
# Install Python3.7
RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \
RUN mkdir -p /root/python_build/ && wget -q https://paddle-ci.gz.bcebos.com/sqlite-autoconf-3250300.tar.gz && \
tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \
./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \
wget -q https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz && \
tar -xzf Python-3.7.0.tgz && cd Python-3.7.0 && \
CFLAGS="-Wformat" ./configure --prefix=/usr/local/python3.7.0 --enable-shared > /dev/null && \
make -j8 > /dev/null && make altinstall > /dev/null && ldconfig
make -j8 > /dev/null && make altinstall > /dev/null && ldconfig && \
cd ../ && rm -rf Python-3.7.0 Python-3.7.0.tgz
ENV PATH=/usr/local/python3.7.0/include:${PATH}
ENV PATH=/usr/local/python3.7.0/bin:${PATH}
......@@ -79,7 +80,7 @@ RUN rm setuptools-50.3.2.zip pip-20.0.1.tar.gz && \
# Install Go and glide
WORKDIR /home
RUN wget -qO- https://paddle-ci.cdn.bcebos.com/go1.8.1.linux-amd64.tar.gz | \
RUN wget -qO- https://paddle-ci.gz.bcebos.com/go1.17.2.linux-amd64.tar.gz | \
tar -xz -C /usr/local && \
mkdir /root/gopath && \
mkdir /root/gopath/bin && \
......@@ -146,7 +147,8 @@ RUN apt-get install libprotobuf-dev -y
# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa
# So install a newer version here.
RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \
dpkg -i patchelf_0.10-2_amd64.deb
dpkg -i patchelf_0.10-2_amd64.deb && \
rm -rf patchelf_0.10-2_amd64.deb
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
......@@ -157,7 +159,8 @@ RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \
tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \
./configure -prefix=/usr/local/ccache-3.7.9 && \
make -j8 && make install && \
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache && \
cd ../ && rm -rf ccache-3.7.9 ccache-3.7.9.tar.gz
EXPOSE 22
# A image for building paddle binaries
# Use cuda devel base image for both cpu and gpu environment
# When you modify it, please be aware of cudnn-runtime version
FROM nvidia/cuda:<baseimg>
FROM <baseimg>
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
# ENV variables
......@@ -11,7 +11,7 @@ ARG WITH_AVX
ENV WITH_GPU=${WITH_GPU:-ON}
ENV WITH_AVX=${WITH_AVX:-ON}
ENV DEBIAN_FRONTEND=noninteractive
ENV LD_LIBRARY_PATH=/usr/local/cuda-11.2/targets/x86_64-linux/lib:$LD_LIBRARY_PATH
<setcuda>
ENV HOME /root
# Add bash enhancements
......@@ -23,6 +23,7 @@ RUN apt-get update && \
apt-get install -y curl wget vim git unzip unrar tar xz-utils libssl-dev bzip2 gzip \
coreutils ntp language-pack-zh-hans python-qt4 libsm6 libxext6 libxrender-dev libgl1-mesa-glx \
bison graphviz libjpeg-dev zlib1g-dev automake locales swig net-tools libtool module-init-tools
<install_cpu_package>
# Downgrade gcc&&g++
WORKDIR /usr/bin
......@@ -72,7 +73,7 @@ RUN wget -q https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.gz && \
# Install Go and glide
RUN wget -qO- https://paddle-ci.cdn.bcebos.com/go1.8.1.linux-amd64.tar.gz | \
RUN wget -qO- https://paddle-ci.gz.bcebos.com/go1.17.2.linux-amd64.tar.gz | \
tar -xz -C /usr/local && \
mkdir /root/gopath && \
mkdir /root/gopath/bin && \
......@@ -103,7 +104,8 @@ RUN pip3.7 --no-cache-dir install -r /root/requirements.txt
# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa
# So install a newer version here.
RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \
dpkg -i patchelf_0.10-2_amd64.deb
dpkg -i patchelf_0.10-2_amd64.deb && \
rm -rf patchelf_0.10-2_amd64.deb
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
#RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
......@@ -114,7 +116,8 @@ RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \
tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \
./configure -prefix=/usr/local/ccache-3.7.9 && \
make -j8 && make install && \
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache && \
cd ../ && rm -rf ccache-3.7.9 ccache-3.7.9.tar.gz
# clang-form 3.8.0
RUN wget https://paddle-ci.cdn.bcebos.com/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz && \
......
......@@ -15,8 +15,9 @@ ENV HOME /root
# Add bash enhancements
COPY paddle/scripts/docker/root/ /root/
RUN chmod 777 /tmp
# Prepare packages for Python
RUN apt-get update && \
RUN apt-get update --allow-unauthenticated && \
apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev \
libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev
......@@ -45,7 +46,7 @@ RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && ta
ENV PATH=/home/cmake-3.16.0-Linux-x86_64/bin:$PATH
# Install Python3.6
RUN mkdir -p /root/python_build/ && wget -q https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz && \
RUN mkdir -p /root/python_build/ && wget -q https://paddle-ci.gz.bcebos.com/sqlite-autoconf-3250300.tar.gz && \
tar -zxf sqlite-autoconf-3250300.tar.gz && cd sqlite-autoconf-3250300 && \
./configure -prefix=/usr/local && make -j8 && make install && cd ../ && rm sqlite-autoconf-3250300.tar.gz && \
wget -q https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz && \
......@@ -123,7 +124,7 @@ RUN rm Python-$version.tgz setuptools-40.6.2.zip setuptools-50.3.2.zip pip-20.0.
# Install Go and glide
WORKDIR /home
RUN wget -qO- https://paddle-ci.gz.bcebos.com/go1.15.12.linux-amd64.tar.gz | \
RUN wget --no-check-certificate -qO- https://paddle-ci.gz.bcebos.com/go1.17.2.linux-amd64.tar.gz | \
tar -xz -C /usr/local && \
mkdir /root/gopath && \
mkdir /root/gopath/bin && \
......@@ -199,8 +200,7 @@ COPY ./python/requirements.txt /root/
RUN pip3.6 --no-cache-dir install -r /root/requirements.txt && \
pip3.7 --no-cache-dir install -r /root/requirements.txt && \
pip3.8 --no-cache-dir install -r /root/requirements.txt && \
pip3.9 --no-cache-dir install -r /root/requirements.txt && \
pip --no-cache-dir install -r /root/requirements.txt
pip3.9 --no-cache-dir install -r /root/requirements.txt
# To fix https://github.com/PaddlePaddle/Paddle/issues/1954, we use
# the solution in https://urllib3.readthedocs.io/en/latest/user-guide.html#ssl-py2
......@@ -229,7 +229,8 @@ RUN apt-get install libprotobuf-dev -y
# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa
# So install a newer version here.
RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \
dpkg -i patchelf_0.10-2_amd64.deb
dpkg -i patchelf_0.10-2_amd64.deb && \
rm -rf patchelf_0.10-2_amd64.deb
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
......@@ -240,7 +241,8 @@ RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \
tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \
./configure -prefix=/usr/local/ccache-3.7.9 && \
make -j8 && make install && \
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache && \
cd ../ && rm -rf ccache-3.7.9 ccache-3.7.9.tar.gz
EXPOSE 22
# A image for building paddle binaries
# Use cuda devel base image for both cpu and gpu environment
# When you modify it, please be aware of cudnn-runtime version
FROM nvidia/cuda:<baseimg>
FROM <baseimg>
MAINTAINER PaddlePaddle Authors <paddle-dev@baidu.com>
# ENV variables
......@@ -11,18 +11,20 @@ ARG WITH_AVX
ENV WITH_GPU=${WITH_GPU:-ON}
ENV WITH_AVX=${WITH_AVX:-ON}
ENV DEBIAN_FRONTEND=noninteractive
ENV LD_LIBRARY_PATH=/usr/local/cuda-11.2/targets/x86_64-linux/lib:$LD_LIBRARY_PATH
<setcuda>
ENV HOME /root
# Add bash enhancements
COPY paddle/scripts/docker/root/ /root/
RUN apt-get update && \
RUN chmod 777 /tmp
RUN apt-get update --allow-unauthenticated && \
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 libssl-dev bzip2 gzip \
coreutils ntp language-pack-zh-hans python-qt4 libsm6 libxext6 libxrender-dev libgl1-mesa-glx \
bison graphviz libjpeg-dev zlib1g-dev automake locales swig net-tools libtool module-init-tools
<install_cpu_package>
# Downgrade gcc&&g++
WORKDIR /usr/bin
......@@ -49,7 +51,7 @@ RUN apt-get update && \
python3.7 python3.7-dev \
python3.8 python3.8-dev python3.8-distutils \
python3.9 python3.9-dev python3.9-distutils && \
rm /usr/bin/python && ln -s /usr/bin/python2.7 /usr/bin/python && \
rm /usr/bin/python && ln -s /usr/bin/python3.7 /usr/bin/python && \
rm /usr/bin/python3 && ln -s /usr/bin/python3.7 /usr/bin/python3
......@@ -63,11 +65,11 @@ RUN python3.9 setup.py build && python3.9 setup.py install && \
WORKDIR /home
RUN wget https://files.pythonhosted.org/packages/b0/d1/8acb42f391cba52e35b131e442e80deffbb8d0676b93261d761b1f0ef8fb/setuptools-40.6.2.zip && apt-get -y install unzip && unzip setuptools-40.6.2.zip
WORKDIR /home/setuptools-40.6.2
RUN python setup.py build && python setup.py install
RUN python2.7 setup.py build && python2.7 setup.py install
WORKDIR /home
RUN wget https://files.pythonhosted.org/packages/28/af/2c76c8aa46ccdf7578b83d97a11a2d1858794d4be4a1610ade0d30182e8b/pip-20.0.1.tar.gz && tar -zxvf pip-20.0.1.tar.gz
WORKDIR pip-20.0.1
RUN python setup.py install && \
RUN python2.7 setup.py install && \
python3.9 setup.py install && \
python3.8 setup.py install && \
python3.7 setup.py install && \
......@@ -76,7 +78,7 @@ RUN python setup.py install && \
WORKDIR /home
RUN rm setuptools-40.6.2.zip setuptools-50.3.2.zip pip-20.0.1.tar.gz && \
rm -r setuptools-40.6.2 setuptools-50.3.2 pip-20.0.1
RUN rm /usr/local/bin/pip && ln -s /usr/local/bin/pip2.7 /usr/local/bin/pip && \
RUN rm /usr/local/bin/pip && ln -s /usr/local/bin/pip3.7 /usr/local/bin/pip && \
rm /usr/local/bin/pip3 && ln -s /usr/local/bin/pip3.7 /usr/local/bin/pip3
......@@ -88,7 +90,7 @@ RUN wget -q https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.gz && \
# Install Go and glide
RUN wget -qO- https://paddle-ci.cdn.bcebos.com/go1.8.1.linux-amd64.tar.gz | \
RUN wget --no-check-certificate -qO- https://paddle-ci.gz.bcebos.com/go1.17.2.linux-amd64.tar.gz | \
tar -xz -C /usr/local && \
mkdir /root/gopath && \
mkdir /root/gopath/bin && \
......@@ -113,29 +115,29 @@ RUN pip3.6 --no-cache-dir install pre-commit==1.10.4 ipython==5.3.0 && \
pip3.8 --no-cache-dir install ipykernel==4.6.0 wheel && \
pip3.9 --no-cache-dir install pre-commit==1.10.4 ipython==5.3.0 && \
pip3.9 --no-cache-dir install ipykernel==4.6.0 wheel && \
pip --no-cache-dir install pre-commit==1.10.4 ipython==5.3.0 && \
pip --no-cache-dir install ipykernel==4.6.0 wheel
pip2.7 --no-cache-dir install pre-commit==1.10.4 ipython==5.3.0 && \
pip2.7 --no-cache-dir install ipykernel==4.6.0 wheel
#For docstring checker
RUN pip3.6 --no-cache-dir install pylint pytest astroid isort && \
pip3.7 --no-cache-dir install pylint pytest astroid isort && \
pip3.8 --no-cache-dir install pylint pytest astroid isort && \
pip3.9 --no-cache-dir install pylint pytest astroid isort && \
pip --no-cache-dir install pylint pytest astroid isort
pip2.7 --no-cache-dir install pylint pytest astroid isort
COPY ./python/requirements.txt /root/
RUN pip3.6 --no-cache-dir install -r /root/requirements.txt && \
pip3.7 --no-cache-dir install -r /root/requirements.txt && \
pip3.8 --no-cache-dir install -r /root/requirements.txt && \
pip3.9 --no-cache-dir install -r /root/requirements.txt && \
pip --no-cache-dir install -r /root/requirements.txt
pip3.9 --no-cache-dir install -r /root/requirements.txt
# Older versions of patchelf limited the size of the files being processed and were fixed in this pr.
# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa
# So install a newer version here.
RUN wget -q https://paddle-ci.cdn.bcebos.com/patchelf_0.10-2_amd64.deb && \
dpkg -i patchelf_0.10-2_amd64.deb
dpkg -i patchelf_0.10-2_amd64.deb && \
rm -rf patchelf_0.10-2_amd64.deb
# Configure OpenSSH server. c.f. https://docs.docker.com/engine/examples/running_ssh_service
#RUN mkdir /var/run/sshd && echo 'root:root' | chpasswd && sed -ri 's/^PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config && sed -ri 's/UsePAM yes/#UsePAM yes/g' /etc/ssh/sshd_config
......@@ -146,7 +148,8 @@ RUN wget https://paddle-ci.gz.bcebos.com/ccache-3.7.9.tar.gz && \
tar xf ccache-3.7.9.tar.gz && mkdir /usr/local/ccache-3.7.9 && cd ccache-3.7.9 && \
./configure -prefix=/usr/local/ccache-3.7.9 && \
make -j8 && make install && \
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache
ln -s /usr/local/ccache-3.7.9/bin/ccache /usr/local/bin/ccache && \
cd ../ && rm -rf ccache-3.7.9 ccache-3.7.9.tar.gz
# clang-form 3.8.0
RUN wget https://paddle-ci.cdn.bcebos.com/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz && \
......
......@@ -38,7 +38,7 @@ if [ "$1" == "gcc82" ]; then
cd .. && mkdir temp_gcc82 && cd temp_gcc82 && \
../gcc-8.2.0/configure --prefix=/usr/local/gcc-8.2 --enable-threads=posix --disable-checking --disable-multilib && \
make -j8 && make install
cd .. && rm -rf temp_gcc82
cd .. && rm -rf temp_gcc82 gcc-8.2.0 gcc-8.2.0.tar.xz
cp ${lib_so_6} ${lib_so_6}.bak && rm -f ${lib_so_6} &&
ln -s /usr/local/gcc-8.2/lib64/libgfortran.so.5 ${lib_so_5} && \
ln -s /usr/local/gcc-8.2/lib64/libstdc++.so.6 ${lib_so_6} && \
......@@ -52,7 +52,7 @@ elif [ "$1" == "gcc54" ]; then
cd .. && mkdir temp_gcc54 && cd temp_gcc54 && \
../gcc-5.4.0/configure --prefix=/usr/local/gcc-5.4 --enable-checking=release --enable-languages=c,c++ --disable-multilib && \
make -j8 && make install
cd .. && rm -rf temp_gcc54
cd .. && rm -rf temp_gcc54 gcc-5.4.0 gcc-5.4.0.tar.gz
cp ${lib_so_6} ${lib_so_6}.bak && rm -f ${lib_so_6} &&
ln -s /usr/local/gcc-5.4/lib64/libgfortran.so.5 ${lib_so_5} && \
ln -s /usr/local/gcc-5.4/lib64/libstdc++.so.6 ${lib_so_6} && \
......
......@@ -21,7 +21,7 @@ function make_ubuntu_dockerfile(){
dockerfile_line=$(wc -l ${dockerfile_name}|awk '{print $1}')
sed -i "${dockerfile_line}i RUN wget --no-check-certificate -q https://paddle-edl.bj.bcebos.com/hadoop-2.7.7.tar.gz \&\& \
tar -xzf hadoop-2.7.7.tar.gz && mv hadoop-2.7.7 /usr/local/" ${dockerfile_name}
sed -i "${dockerfile_line}i RUN apt remove git -y \&\& apt install -y libcurl4-openssl-dev gettext \&\& wget -q https://paddle-ci.gz.bcebos.com/git-2.17.1.tar.gz \&\& \
sed -i "${dockerfile_line}i RUN apt remove git -y \&\& apt install -y libcurl4-openssl-dev gettext zstd \&\& wget -q https://paddle-ci.gz.bcebos.com/git-2.17.1.tar.gz \&\& \
tar -xvf git-2.17.1.tar.gz \&\& \
cd git-2.17.1 \&\& \
./configure --with-openssl --with-curl --prefix=/usr/local \&\& \
......@@ -61,7 +61,9 @@ function make_centos_dockerfile(){
function make_cinn_dockerfile(){
dockerfile_name="Dockerfile.cuda11_cudnn8_gcc82_ubuntu18_cinn"
sed "s/<baseimg>/11.2.0-cudnn8-devel-ubuntu18.04/g" ./Dockerfile.ubuntu18 >${dockerfile_name}
sed "s#<baseimg>#nvidia/cuda:11.2.0-cudnn8-devel-ubuntu18.04#g" ./Dockerfile.ubuntu18 >${dockerfile_name}
sed -i "s#<setcuda>#ENV LD_LIBRARY_PATH=/usr/local/cuda-11.2/targets/x86_64-linux/lib:\$LD_LIBRARY_PATH #g" ${dockerfile_name}
sed -i 's#<install_cpu_package>##g' ${dockerfile_name}
sed -i "7i ENV TZ=Asia/Beijing" ${dockerfile_name}
sed -i "8i RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone" ${dockerfile_name}
sed -i "9i RUN apt-get update && apt-get install -y liblzma-dev openmpi-bin openmpi-doc libopenmpi-dev" ${dockerfile_name}
......
......@@ -63,9 +63,9 @@ function ref_whl(){
elif [[ ${PADDLE_VERSION} == "develop" && ${WITH_GPU} != "ON" ]]; then
ref_paddle37_whl=paddlepaddle${install_gpu}-${ref_dev}-cp37-cp37m-linux_x86_64.whl
elif [[ ${PADDLE_VERSION} != "develop" && ${WITH_GPU} == "ON" ]]; then
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}${ref_version}-cp37-cp37m-linux_x86_64.whl
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION/-/}${ref_version}-cp37-cp37m-linux_x86_64.whl
else
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp37-cp37m-linux_x86_64.whl
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION/-/}-cp37-cp37m-linux_x86_64.whl
fi
}
......
......@@ -42,6 +42,8 @@ function ref_whl(){
ref_version=.post110
elif [[ ${ref_CUDA_MAJOR} == "11.2" ]];then
ref_version=.post112
elif [[ ${ref_CUDA_MAJOR} == "11.4" ]];then
ref_version=.post114
elif [[ ${ref_CUDA_MAJOR} == "10" ]];then
ref_version=.post100
elif [[ ${ref_CUDA_MAJOR} == "10.1" ]];then
......@@ -96,6 +98,25 @@ function install_whl(){
}
function set_cuda_env(){
if [[ ${WITH_GPU} == "ON" ]]; then
sed -i "s#<setcuda>#ENV LD_LIBRARY_PATH=/usr/local/cuda-${ref_CUDA_MAJOR}/targets/x86_64-linux/lib:\$LD_LIBRARY_PATH #g" Dockerfile.tmp
else
sed -i 's#<setcuda>##g' Dockerfile.tmp
fi
}
function install_package_for_cpu(){
if [[ ${WITH_GPU} != "ON" ]]; then
sed -i 's#<install_cpu_package>#RUN apt-get update \
RUN apt install -y make gcc g++ #g' Dockerfile.tmp
else
sed -i 's#<install_cpu_package>##g' Dockerfile.tmp
fi
}
function install_gcc(){
if [ "${gcc_version}" == "8.2.0" ];then
sed -i 's#<install_gcc>#WORKDIR /usr/bin \
......@@ -118,12 +139,18 @@ function install_gcc(){
function make_dockerfile(){
sed "s/<baseimg>/${docker_name}/g" tools/dockerfile/Dockerfile.ubuntu18 >Dockerfile.tmp
if [[ ${WITH_GPU} == "ON" ]]; then
sed "s#<baseimg>#nvidia/cuda:${docker_name}#g" tools/dockerfile/Dockerfile.ubuntu18 >Dockerfile.tmp
else
sed "s#<baseimg>#${docker_name}#g" tools/dockerfile/Dockerfile.ubuntu18 >Dockerfile.tmp
fi
}
function main(){
make_dockerfile
set_cuda_env
install_package_for_cpu
install_gcc
ref_whl
install_whl
......
......@@ -42,6 +42,8 @@ function ref_whl(){
ref_version=.post110
elif [[ ${ref_CUDA_MAJOR} == "11.2" ]];then
ref_version=.post112
elif [[ ${ref_CUDA_MAJOR} == "11.4" ]];then
ref_version=.post114
elif [[ ${ref_CUDA_MAJOR} == "10" ]];then
ref_version=.post100
elif [[ ${ref_CUDA_MAJOR} == "10.1" ]];then
......@@ -63,9 +65,9 @@ function ref_whl(){
elif [[ ${PADDLE_VERSION} == "develop" && ${WITH_GPU} != "ON" ]]; then
ref_paddle37_whl=paddlepaddle${install_gpu}-${ref_dev}-cp37-cp37m-linux_x86_64.whl
elif [[ ${PADDLE_VERSION} != "develop" && ${WITH_GPU} == "ON" ]]; then
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}${ref_version}-cp37-cp37m-linux_x86_64.whl
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION/-/}${ref_version}-cp37-cp37m-linux_x86_64.whl
else
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION}-cp37-cp37m-linux_x86_64.whl
ref_paddle37_whl=paddlepaddle${install_gpu}-${PADDLE_VERSION/-/}-cp37-cp37m-linux_x86_64.whl
fi
}
......@@ -76,6 +78,25 @@ function install_whl(){
}
function set_cuda_env(){
if [[ ${WITH_GPU} == "ON" ]]; then
sed -i "s#<setcuda>#ENV LD_LIBRARY_PATH=/usr/local/cuda-${ref_CUDA_MAJOR}/targets/x86_64-linux/lib:\$LD_LIBRARY_PATH #g" Dockerfile.tmp
else
sed -i 's#<setcuda>##g' Dockerfile.tmp
fi
}
function install_package_for_cpu(){
if [[ ${WITH_GPU} != "ON" ]]; then
sed -i 's#<install_cpu_package>#RUN apt-get update \
RUN apt install -y make gcc g++ #g' Dockerfile.tmp
else
sed -i 's#<install_cpu_package>##g' Dockerfile.tmp
fi
}
function install_gcc(){
if [ "${gcc_version}" == "8.2.0" ];then
sed -i 's#<install_gcc>#WORKDIR /usr/bin \
......@@ -96,12 +117,18 @@ function install_gcc(){
function make_dockerfile(){
sed "s/<baseimg>/${docker_name}/g" tools/dockerfile/Dockerfile.release18 >Dockerfile.tmp
if [[ ${WITH_GPU} == "ON" ]]; then
sed "s#<baseimg>#nvidia/cuda:${docker_name}#g" tools/dockerfile/Dockerfile.release18 >Dockerfile.tmp
else
sed "s#<baseimg>#${docker_name}#g" tools/dockerfile/Dockerfile.release18 >Dockerfile.tmp
fi
}
function main(){
make_dockerfile
set_cuda_env
install_package_for_cpu
install_gcc
ref_whl
install_whl
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册