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