1FROM nvidia/cuda:10.1-cudnn7-runtime-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-3.1.5 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 libnccl2=2.4.8-1+cuda10.1 \ 40 libnccl-dev=2.4.8-1+cuda10.1 41 42# Set bash 43RUN echo "dash dash/sh boolean false" | debconf-set-selections 44RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash 45 46# Install python (v3.7.5) 47RUN apt install -y libffi-dev libssl-dev zlib1g-dev libbz2-dev libncurses5-dev \ 48 libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libsqlite3-dev \ 49 && cd /tmp \ 50 && wget https://github.com/python/cpython/archive/v3.7.5.tar.gz \ 51 && tar -xvf v3.7.5.tar.gz \ 52 && cd /tmp/cpython-3.7.5 \ 53 && mkdir -p ${PYTHON_ROOT_PATH} \ 54 && ./configure --prefix=${PYTHON_ROOT_PATH} \ 55 && make -j4 \ 56 && make install -j4 \ 57 && rm -f /usr/local/bin/python \ 58 && rm -f /usr/local/bin/pip \ 59 && ln -s ${PYTHON_ROOT_PATH}/bin/python3.7 /usr/local/bin/python \ 60 && ln -s ${PYTHON_ROOT_PATH}/bin/pip3.7 /usr/local/bin/pip \ 61 && rm -rf /tmp/cpython-3.7.5 \ 62 && rm -f /tmp/v3.7.5.tar.gz 63 64# Set pip source 65RUN mkdir -pv /root/.pip \ 66 && echo "[global]" > /root/.pip/pip.conf \ 67 && echo "trusted-host=mirrors.aliyun.com" >> /root/.pip/pip.conf \ 68 && echo "index-url=http://mirrors.aliyun.com/pypi/simple/" >> /root/.pip/pip.conf 69 70# Install openmpi (v3.1.5) 71RUN cd /tmp \ 72 && wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.5.tar.gz \ 73 && tar -xvf openmpi-3.1.5.tar.gz \ 74 && cd /tmp/openmpi-3.1.5 \ 75 && mkdir -p ${OMPI_ROOT_PATH} \ 76 && ./configure --prefix=${OMPI_ROOT_PATH} \ 77 && make -j4 \ 78 && make install -j4 \ 79 && rm -rf /tmp/openmpi-3.1.5 \ 80 && rm -f /tmp/openmpi-3.1.5.tar.gz 81 82# Install MindSpore cuda-10.1 whl package 83RUN pip install --no-cache-dir https://ms-release.obs.cn-north-4.myhuaweicloud.com/0.2.0-alpha/MindSpore/gpu/cuda-10.1/mindspore_gpu-0.2.0-cp37-cp37m-linux_x86_64.whl 84