-
Notifications
You must be signed in to change notification settings - Fork 71
/
dockerfile.cpu
76 lines (63 loc) · 2.3 KB
/
dockerfile.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
FROM ubuntu:18.04
ENV PYTORCH_VERSION=1.4.0
ENV TORCHVISION_VERSION=0.5.0
ARG python=3.7
ENV PYTHON_VERSION=${python}
# Set default shell to /bin/bash
SHELL ["/bin/bash", "-cu"]
RUN apt-get update && apt-get install -y --allow-downgrades --allow-change-held-packages --no-install-recommends \
build-essential \
cmake \
g++-4.8 \
git \
curl \
vim \
wget \
ca-certificates \
libjpeg-dev \
libpng-dev \
python${PYTHON_VERSION} \
python${PYTHON_VERSION}-dev \
librdmacm1 \
libibverbs1 \
ibverbs-providers
RUN if [[ "${PYTHON_VERSION}" == "3.7" ]]; then \
apt-get install -y python${PYTHON_VERSION}-distutils; \
fi
RUN ln -s /usr/bin/python${PYTHON_VERSION} /usr/bin/python
RUN curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
# Install Open MPI
RUN mkdir /tmp/openmpi && \
cd /tmp/openmpi && \
wget https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-4.0.0.tar.gz && \
tar zxf openmpi-4.0.0.tar.gz && \
cd openmpi-4.0.0 && \
./configure --enable-orterun-prefix-by-default && \
make -j $(nproc) all && \
make install && \
ldconfig && \
rm -rf /tmp/openmpi
# Install OpenSSH for MPI to communicate between containers
RUN 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
# Install PyTorch and Required Package
RUN pip install future typing
RUN pip install numpy matplotlib
RUN pip install torch==${PYTORCH_VERSION} torchvision==${TORCHVISION_VERSION}
# Pin Pillow<7.0: https://github.com/pytorch/vision/issues/1718
RUN pip install "Pillow<7.0" --no-deps
# Install Bluefog
RUN pip install bluefog
RUN mkdir /bluefog
RUN cd /bluefog && \
VERSION=`python -c "import bluefog; print(bluefog.__version__)"` && \
wget https://github.com/Bluefog-Lib/bluefog/releases/download/v$VERSION/examples.tar.gz && \
tar -zxv -f examples.tar.gz && \
rm examples.tar.gz
WORKDIR "bluefog"