forked from microsoft/SuperScaler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.test.CPU
54 lines (42 loc) · 1.93 KB
/
Dockerfile.test.CPU
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
FROM ubuntu:18.04
# run test cases (skip gpu parts) automately:
# $ docker build -f Dockerfile.test.CPU .
# python version is related to tensorflow version
ARG python=3.7
ENV PYTHON_VERSION=${python}
# install the dependencies
RUN apt-get update && apt-get install --no-install-recommends --allow-downgrades -y \
build-essential \
git \
wget \
rsync \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
python3-pip
RUN wget -qO- "https://cmake.org/files/v3.18/cmake-3.18.2-Linux-x86_64.tar.gz" | \
tar --strip-components=1 -xz -C /usr/local
# set softlink of python3 and python
RUN ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
ln -sf /usr/bin/python3 /usr/bin/python
# Install python packages
COPY requirements.txt /
RUN python3 -m pip install --upgrade pip && \
python3 -m pip install setuptools && \
python3 -m pip install flake8 && \
python3 -m pip install --no-cache-dir -r requirements.txt
# Install MPI.
RUN wget --progress=dot:mega -O /tmp/openmpi-3.0.0-bin.tar.gz https://github.com/horovod/horovod/files/1596799/openmpi-3.0.0-bin.tar.gz && \
cd /usr/local && tar -zxf /tmp/openmpi-3.0.0-bin.tar.gz && ldconfig && \
echo "mpirun -allow-run-as-root -np 2 -H localhost:2 -bind-to none -map-by slot -mca mpi_abort_print_stack 1" > /mpirun_command;
# Install OpenSSH for MPI to communicate between containers
RUN apt-get update && apt-get install -y --no-install-recommends openssh-client openssh-server && \
mkdir -p /var/run/sshd
# Allow OpenSSH to talk to containers without asking for confirmation
RUN cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new && \
echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new && \
mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config
COPY . /SuperScaler
WORKDIR /SuperScaler
RUN /SuperScaler/tools/run_test.sh