1FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu18.04 2 3MAINTAINER leonwanghui <leon.wanghui@huawei.com> 4 5# Set env 6ENV PYTHON_ROOT_PATH /usr/local/python-3.7.5 7ENV OMPI_ROOT_PATH /usr/local/openmpi-4.0.3 8ENV PATH ${OMPI_ROOT_PATH}/bin:/usr/local/bin:$PATH 9ENV LD_LIBRARY_PATH ${OMPI_ROOT_PATH}/lib:$LD_LIBRARY_PATH 10 11# Install base tools 12RUN apt update \ 13 && DEBIAN_FRONTEND=noninteractive apt install -y \ 14 vim \ 15 wget \ 16 curl \ 17 xz-utils \ 18 net-tools \ 19 openssh-client \ 20 git \ 21 ntpdate \ 22 tzdata \ 23 tcl \ 24 sudo \ 25 bash-completion 26 27# Install compile tools 28RUN DEBIAN_FRONTEND=noninteractive apt install -y \ 29 gcc \ 30 g++ \ 31 zlibc \ 32 make \ 33 libgmp-dev \ 34 patch \ 35 autoconf \ 36 libtool \ 37 automake \ 38 flex 39 40# Install the rest dependent tools 41RUN DEBIAN_FRONTEND=noninteractive apt install -y \ 42 libnuma-dev 43 44# Set bash 45RUN echo "dash dash/sh boolean false" | debconf-set-selections 46RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash 47 48# Install python (v3.7.5) 49RUN apt install -y libffi-dev libssl-dev zlib1g-dev libbz2-dev libncurses5-dev \ 50 libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libsqlite3-dev \ 51 && cd /tmp \ 52 && wget https://github.com/python/cpython/archive/v3.7.5.tar.gz \ 53 && tar -xvf v3.7.5.tar.gz \ 54 && cd /tmp/cpython-3.7.5 \ 55 && mkdir -p ${PYTHON_ROOT_PATH} \ 56 && ./configure --prefix=${PYTHON_ROOT_PATH} \ 57 && make -j4 \ 58 && make install -j4 \ 59 && rm -f /usr/local/bin/python \ 60 && rm -f /usr/local/bin/pip \ 61 && ln -s ${PYTHON_ROOT_PATH}/bin/python3.7 /usr/local/bin/python \ 62 && ln -s ${PYTHON_ROOT_PATH}/bin/pip3.7 /usr/local/bin/pip \ 63 && rm -rf /tmp/cpython-3.7.5 \ 64 && rm -f /tmp/v3.7.5.tar.gz 65 66# Set pip source 67RUN mkdir -pv /root/.pip \ 68 && echo "[global]" > /root/.pip/pip.conf \ 69 && echo "trusted-host=mirrors.aliyun.com" >> /root/.pip/pip.conf \ 70 && echo "index-url=http://mirrors.aliyun.com/pypi/simple/" >> /root/.pip/pip.conf 71 72# Install openmpi (v4.0.3) 73RUN cd /tmp \ 74 && wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz \ 75 && tar -xvf openmpi-4.0.3.tar.gz \ 76 && cd /tmp/openmpi-4.0.3 \ 77 && mkdir -p ${OMPI_ROOT_PATH} \ 78 && ./configure --prefix=${OMPI_ROOT_PATH} \ 79 && make -j4 \ 80 && make install -j4 \ 81 && rm -rf /tmp/openmpi-4.0.3 \ 82 && rm -f /tmp/openmpi-4.0.3.tar.gz 83 84# Install MindSpore cuda-10.1 whl package 85RUN pip install --no-cache-dir https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.1.0/MindSpore/gpu/ubuntu_x86/cuda-10.1/mindspore_gpu-1.1.0-cp37-cp37m-linux_x86_64.whl 86