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 CMAKE_ROOT_PATH /usr/local/cmake-3.14.1 8ENV OMPI_ROOT_PATH /usr/local/openmpi-4.0.3 9ENV PATH ${OMPI_ROOT_PATH}/bin:${PYTHON_ROOT_PATH}/bin:${CMAKE_ROOT_PATH}/bin:/usr/local/bin:$PATH 10ENV LD_LIBRARY_PATH ${OMPI_ROOT_PATH}/lib::${PYTHON_ROOT_PATH}/lib 11 12# Install base tools 13RUN apt update \ 14 && DEBIAN_FRONTEND=noninteractive apt install -y \ 15 vim \ 16 wget \ 17 curl \ 18 xz-utils \ 19 net-tools \ 20 openssh-client \ 21 git \ 22 ntpdate \ 23 tzdata \ 24 tcl \ 25 sudo \ 26 bash-completion 27 28# Install compile tools 29RUN DEBIAN_FRONTEND=noninteractive apt install -y \ 30 gcc \ 31 g++ \ 32 zlibc \ 33 make \ 34 libgmp-dev \ 35 patch \ 36 autoconf \ 37 libtool \ 38 automake \ 39 flex \ 40 libjpeg8-dev 41 42# Install the rest dependent tools 43RUN DEBIAN_FRONTEND=noninteractive apt install -y \ 44 libnuma-dev 45 46# Configure cuDNN (v7.6.5) 47RUN ln -s /usr/lib/x86_64-linux-gnu/libcudnn.so.8.0.5 /usr/local/cuda/lib64/libcudnn.so 48 49# Set bash 50RUN echo "dash dash/sh boolean false" | debconf-set-selections 51RUN DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash 52 53# Install python (v3.7.5) 54RUN apt install -y libffi-dev libssl-dev zlib1g-dev libbz2-dev libncurses5-dev \ 55 libgdbm-dev libgdbm-compat-dev liblzma-dev libreadline-dev libsqlite3-dev \ 56 && cd /tmp \ 57 && wget https://github.com/python/cpython/archive/v3.7.5.tar.gz \ 58 && tar -xvf v3.7.5.tar.gz \ 59 && cd /tmp/cpython-3.7.5 \ 60 && mkdir -p ${PYTHON_ROOT_PATH} \ 61 && ./configure --prefix=${PYTHON_ROOT_PATH} --enable-shared \ 62 && make -j4 \ 63 && make install -j4 \ 64 && rm -f /usr/local/bin/python \ 65 && rm -f /usr/local/bin/pip \ 66 && rm -f /usr/local/lib/libpython3.7m.so.1.0 \ 67 && ln -s ${PYTHON_ROOT_PATH}/bin/python3.7 /usr/local/bin/python \ 68 && ln -s ${PYTHON_ROOT_PATH}/bin/pip3.7 /usr/local/bin/pip \ 69 && ln -s ${PYTHON_ROOT_PATH}/lib/libpython3.7m.so.1.0 /usr/local/lib/libpython3.7m.so.1.0 \ 70 && ldconfig \ 71 && rm -rf /tmp/cpython-3.7.5 \ 72 && rm -f /tmp/v3.7.5.tar.gz 73 74# Set pip source 75RUN mkdir -pv /root/.pip \ 76 && echo "[global]" > /root/.pip/pip.conf \ 77 && echo "trusted-host=mirrors.aliyun.com" >> /root/.pip/pip.conf \ 78 && echo "index-url=http://mirrors.aliyun.com/pypi/simple/" >> /root/.pip/pip.conf \ 79 && pip install --no-cache-dir wheel 80 81# Install cmake (v3.14.1) 82RUN cd /tmp \ 83 && wget https://github.com/Kitware/CMake/releases/download/v3.14.1/cmake-3.14.1-Linux-x86_64.sh \ 84 && mkdir -p ${CMAKE_ROOT_PATH} \ 85 && bash ./cmake-3.14.1-Linux-x86_64.sh --prefix=${CMAKE_ROOT_PATH} --exclude-subdir --skip-license \ 86 && rm -f /tmp/cmake-3.14.1-Linux-x86_64.sh 87 88# Install openmpi (v4.0.3) 89RUN cd /tmp \ 90 && wget https://download.open-mpi.org/release/open-mpi/v4.0/openmpi-4.0.3.tar.gz \ 91 && tar -xvf openmpi-4.0.3.tar.gz \ 92 && cd /tmp/openmpi-4.0.3 \ 93 && mkdir -p ${OMPI_ROOT_PATH} \ 94 && ./configure --prefix=${OMPI_ROOT_PATH} \ 95 && make -j4 \ 96 && make install -j4 \ 97 && rm -rf /tmp/openmpi-4.0.3 \ 98 && rm -f /tmp/openmpi-4.0.3.tar.gz 99 100# Install nodejs 101RUN cd /tmp \ 102 && wget https://mirrors.huaweicloud.com/nodejs/v12.18.4/node-v12.18.4-linux-x64.tar.gz \ 103 && tar -zxf node-v12.18.4-linux-x64.tar.gz \ 104 && rm -rf /usr/local/nodejs \ 105 && mkdir -p /usr/local/nodejs \ 106 && mv /tmp/node-v12.18.4-linux-x64 /usr/local/nodejs/ \ 107 && chmod 755 -R /usr/local/nodejs \ 108 && ln -sf /usr/local/nodejs/node-v12.18.4-linux-x64/bin/node /usr/bin/node \ 109 && ln -sf /usr/local/nodejs/node-v12.18.4-linux-x64/bin/npm /usr/bin/npm \ 110 && npm config set registry https://registry.npm.taobao.org/ \ 111 && rm -f /tmp/node-v12.18.4-linux-x64.tar.gz