forked from microsoft/SuperScaler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile.test.CUDA
61 lines (47 loc) · 2.17 KB
/
Dockerfile.test.CUDA
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
55
56
57
58
59
60
61
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
# because 'docker build' cannot call GPU, so you need to run like this:
# $ docker build -t superscaler_test -f Dockerfile.test.CUDA .
# run test cases automately:
# $ docker run --runtime=nvidia --rm superscaler_test
# 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
# Install SuperScaler package
RUN python3 -m pip install .
CMD ./tools/run_test.sh && \
./tools/packaged_test.sh