1FROM nvidia/cuda:11.1-cudnn8-devel-ubuntu18.04 2 3MAINTAINER MindSpore Authors 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 ${PYTHON_ROOT_PATH}/bin:${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 libjpeg8-dev 40 41# Install the rest dependent tools 42RUN DEBIAN_FRONTEND=noninteractive apt install -y \ 43 libnuma-dev 44 45# Set bash 46RUN echo "dash dash/sh boolean false" | debconf-set-selections 47RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash 48 49# Install python (v3.7.5) 50RUN apt install -y libffi-dev libssl-dev zlib1g-dev libbz2-dev libncurses5-dev \ 51 libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libsqlite3-dev \ 52 && cd /tmp \ 53 && wget https://github.com/python/cpython/archive/v3.7.5.tar.gz \ 54 && tar -xvf v3.7.5.tar.gz \ 55 && cd /tmp/cpython-3.7.5 \ 56 && mkdir -p ${PYTHON_ROOT_PATH} \ 57 && ./configure --prefix=${PYTHON_ROOT_PATH} --enable-shared \ 58 && make -j4 \ 59 && make install -j4 \ 60 && rm -f /usr/local/bin/python \ 61 && rm -f /usr/local/bin/pip \ 62 && rm -f /usr/local/lib/libpython3.7m.so.1.0 \ 63 && ln -s ${PYTHON_ROOT_PATH}/bin/python3.7 /usr/local/bin/python \ 64 && ln -s ${PYTHON_ROOT_PATH}/bin/pip3.7 /usr/local/bin/pip \ 65 && ln -s ${PYTHON_ROOT_PATH}/lib/libpython3.7m.so.1.0 /usr/local/lib/libpython3.7m.so.1.0 \ 66 && ldconfig \ 67 && rm -rf /tmp/cpython-3.7.5 \ 68 && rm -f /tmp/v3.7.5.tar.gz 69 70# Set pip source 71RUN mkdir -pv /root/.pip \ 72 && echo "[global]" > /root/.pip/pip.conf \ 73 && echo "trusted-host=mirrors.aliyun.com" >> /root/.pip/pip.conf \ 74 && echo "index-url=http://mirrors.aliyun.com/pypi/simple/" >> /root/.pip/pip.conf 75 76# Install openmpi (v4.0.3) 77RUN cd /tmp \ 78 && wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz \ 79 && tar -xvf openmpi-4.0.3.tar.gz \ 80 && cd /tmp/openmpi-4.0.3 \ 81 && mkdir -p ${OMPI_ROOT_PATH} \ 82 && ./configure --prefix=${OMPI_ROOT_PATH} \ 83 && make -j4 \ 84 && make install -j4 \ 85 && rm -rf /tmp/openmpi-4.0.3 \ 86 && rm -f /tmp/openmpi-4.0.3.tar.gz 87 88# Install MindSpore cuda-11.1, MindInsight, Serving whl package 89RUN pip install --no-cache-dir https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.5.0/MindSpore/gpu/x86_64/cuda-11.1/mindspore_gpu-1.5.0-cp37-cp37m-linux_x86_64.whl \ 90 && pip install --no-cache-dir https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.5.0/MindInsight/any/mindinsight-1.5.0-py3-none-any.whl \ 91 && pip install --no-cache-dir https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.5.0/Serving/x86_64/mindspore_serving-1.5.0-cp37-cp37m-linux_x86_64.whl 92