# A image for building paddle binaries # Use rocm-terminal base image for both rocm environment # When you modify it, please be aware of rocm version # # Build: ROCM 4.0.1 # cd Paddle/tools/dockerfile # docker build -f Dockerfile.rocm \ # -t paddlepaddle/paddle-centos-rocm401-dev:latest . # # docker run -it --device=/dev/kfd --device=/dev/dri \ # --security-opt seccomp=unconfined --group-add video \ # paddlepaddle/paddle-centos-rocm401-dev:latest /bin/bash FROM centos:7.8.2003 MAINTAINER PaddlePaddle Authors ENV LC_ALL en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US.UTF-8 RUN yum install -y epel-release deltarpm sudo openssh-server gettext-devel sqlite-devel \ zlib-devel openssl-devel pcre-devel vim tk-devel tkinter libtool xz graphviz wget curl-devel \ make bzip2 git patch unzip bison yasm diffutils automake which file kernel-headers kernel-devel \ net-tools numactl-devel chrpath screen initscripts # Install devtoolset-7 RUN yum install -y yum-utils centos-release-scl && \ yum-config-manager --enable rhel-server-rhscl-7-rpms && \ yum-config-manager --enable rhel-7-server-rpms && \ yum-config-manager --enable rhel-7-server-optional-rpms && \ INSTALL_PKGS="devtoolset-7-binutils devtoolset-7-gcc devtoolset-7-gcc-c++ devtoolset-7-gcc-gfortran devtoolset-7-gdb" && \ yum install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \ rpm -V $INSTALL_PKGS && \ yum -y clean all --enablerepo='*' ENV PATH=/opt/rh/devtoolset-7/root/usr/bin:$PATH ENV LD_LIBRARY_PATH=/opt/rh/devtoolset-7/root/usr/lib64:/opt/rh/devtoolset-7/root/usr/lib:$LD_LIBRARY_PATH RUN echo "source scl_source enable devtoolset-7" > "/etc/profile.d/devtoolset-7.sh" # cmake 3.16.0 WORKDIR /opt RUN wget -q https://cmake.org/files/v3.16/cmake-3.16.0-Linux-x86_64.tar.gz && \ tar -zxvf cmake-3.16.0-Linux-x86_64.tar.gz && rm cmake-3.16.0-Linux-x86_64.tar.gz && \ mv cmake-3.16.0-Linux-x86_64 cmake-3.16 ENV PATH=/opt/cmake-3.16/bin:${PATH} # ROCM RUN yum install -y kmod wget openblas-devel epel-release RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \ echo "name=ROCm" >> /etc/yum.repos.d/rocm.repo && \ echo "baseurl=http://repo.radeon.com/rocm/yum/4.0.1" >> /etc/yum.repos.d/rocm.repo && \ echo "enabled=1" >> /etc/yum.repos.d/rocm.repo && \ echo "gpgcheck=0" >> /etc/yum.repos.d/rocm.repo RUN yum install -y rocm-dev rocm-utils rocfft miopen-hip rocblas hipsparse rocrand rccl hipcub rocthrust rocprofiler-dev roctracer-dev # fix rocthrust RUN sed -i '21 a #include ' /opt/rocm/include/thrust/system/hip/detail/error.inl # export ROCM env ENV ROCM_PATH=/opt/rocm ENV HIP_PATH=/opt/rocm/hip ENV HIP_CLANG_PATH=/opt/rocm/llvm/bin ENV PATH=/opt/rocm/bin:$PATH ENV PATH=/opt/rocm/opencl/bin:$PATH ENV LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH # git 2.17.1 RUN cd /opt && 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 --prefix=/usr/local && \ make -j8 && make install && \ cd .. && rm -rf git-2.17.1.tar.gz && rm -rf git-2.17.1 ENV GOROOT=/usr/local/go ENV GOPATH=/root/gopath ENV PATH=${GOROOT}/bin:${GOPATH}/bin:${PATH} # go 1.8.1 RUN wget --no-check-certificate -qO- https://storage.googleapis.com/golang/go1.8.1.linux-amd64.tar.gz | \ tar -xz -C /usr/local && \ mkdir /root/gopath && \ mkdir /root/gopath/bin && \ mkdir /root/gopath/src # protobuf 3.6.1 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 && rm -rf protobuf-3.6.1 # conda ENV CONDA_FILE=Miniconda3-py37_4.9.2-Linux-x86_64.sh RUN cd /opt && wget https://repo.anaconda.com/miniconda/${CONDA_FILE} && chmod +x ${CONDA_FILE} RUN mkdir /opt/conda && ./${CONDA_FILE} -b -f -p "/opt/conda" && rm -rf ${CONDA_FILE} ENV PATH=/opt/conda/bin:${PATH} RUN conda init bash && conda install -n base jupyter jupyterlab # install pylint and pre-commit RUN /opt/conda/bin/pip install pre-commit pylint pytest astroid isort protocol PyGithub # install Paddle requirement RUN wget https://raw.githubusercontent.com/PaddlePaddle/Paddle/develop/python/requirements.txt -O /root/requirements.txt RUN /opt/conda/bin/pip install -r /root/requirements.txt && \ rm -rf /root/requirements.txt RUN wget https://raw.githubusercontent.com/PaddlePaddle/Paddle/develop/python/unittest_py/requirements.txt -O /root/requirements.txt RUN /opt/conda/bin/pip install -r /root/requirements.txt && rm -rf /root/requirements.txt # install PaddleClas requirement RUN wget https://raw.githubusercontent.com/PaddlePaddle/PaddleClas/develop/requirements.txt -O /root/requirements.txt RUN /opt/conda/bin/pip install -r /root/requirements.txt && rm -rf /root/requirements.txt # install PaddleDetection requirement RUN wget https://raw.githubusercontent.com/PaddlePaddle/PaddleDetection/develop/requirements.txt -O /root/requirements.txt RUN /opt/conda/bin/pip install -r /root/requirements.txt && rm -rf /root/requirements.txt # configure ssh RUN sed -i "s/^#PermitRootLogin/PermitRootLogin/" /etc/ssh/sshd_config && \ sed -i "s/^#PubkeyAuthentication/PubkeyAuthentication/" /etc/ssh/sshd_config && \ sed -i "s/^#RSAAuthentication/RSAAuthentication/" /etc/ssh/sshd_config # clang-format 3.8 RUN wget https://copr.fedorainfracloud.org/coprs/alonid/llvm-3.8.0/repo/epel-7/alonid-llvm-3.8.0-epel-7.repo -P /etc/yum.repos.d/ RUN yum install -y clang-3.8.0 ENV PATH=/opt/llvm-3.8.0/bin:${PATH} # patchelf RUN yum install -y patchelf && \ yum clean all && \ rm -rf /var/cache/yum && \ rm -rf /var/lib/yum/yumdb && \ rm -rf /var/lib/yum/history # swig 2.0.12 RUN wget -O /opt/swig-2.0.12.tar.gz https://sourceforge.net/projects/swig/files/swig/swig-2.0.12/swig-2.0.12.tar.gz/download && \ cd /opt && tar xzf swig-2.0.12.tar.gz && cd /opt/swig-2.0.12 && ./configure && make && make install && \ cd /opt && rm swig-2.0.12.tar.gz && rm -rf swig-2.0.12 # ccache 3.7.9 RUN cd /opt && 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 && \ cd .. && rm -rf ccache-3.7.9.tar.gz && rm -rf ccache-3.7.9 # configure ssh RUN sed -i "s/^#PermitRootLogin/PermitRootLogin/" /etc/ssh/sshd_config && \ sed -i "s/^#PubkeyAuthentication/PubkeyAuthentication/" /etc/ssh/sshd_config && \ sed -i "s/^#RSAAuthentication/RSAAuthentication/" /etc/ssh/sshd_config && \ sed -i "s/#UseDNS .*/UseDNS no/" /etc/ssh/sshd_config RUN ssh-keygen -A EXPOSE 22