forked from pytorch/ignite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.hvd-base
64 lines (51 loc) · 2.1 KB
/
Dockerfile.hvd-base
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
# Multi-stage build
# Dockerfile.hvd-base
ARG PTH_VERSION
FROM pytorch/pytorch:${PTH_VERSION}-devel as builder
ARG HVD_VERSION
# Build Horovod
RUN apt-get update && apt-get install -y git && \
git clone --recursive --depth 1 --branch ${HVD_VERSION} https://github.com/horovod/horovod.git /horovod && \
conda install -y cmake nccl -c conda-forge && \
cd /horovod && \
HOROVOD_GPU_OPERATIONS=NCCL HOROVOD_NCCL_LINK=SHARED HOROVOD_WITHOUT_MPI=1 HOROVOD_WITH_PYTORCH=1 pip wheel --no-cache-dir . && \
rm -rf /var/lib/apt/lists/*
# Build runtime image
FROM pytorch/pytorch:${PTH_VERSION}-runtime
# Install tzdata / git
RUN apt-get update && \
ln -fs /usr/share/zoneinfo/Europe/Paris /etc/localtime && \
apt-get -y install --no-install-recommends tzdata git && \
dpkg-reconfigure --frontend noninteractive tzdata && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*
# Ignite main dependencies
RUN pip install --upgrade --no-cache-dir pytorch-ignite \
tensorboard \
tqdm \
fire
# Replace pillow with pillow-simd
RUN apt-get update && apt-get -y install --no-install-recommends g++ && \
pip uninstall -y pillow && \
CC="cc -mavx2" pip install --upgrade --no-cache-dir --force-reinstall pillow-simd && \
apt-get remove -y g++ && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
# Checkout Ignite examples only
RUN mkdir -p pytorch-ignite-examples && \
cd pytorch-ignite-examples && \
git init && \
git config core.sparsecheckout true && \
echo examples >> .git/info/sparse-checkout && \
git remote add -f origin https://github.com/pytorch/ignite.git && \
git pull origin master && \
# rm very large .git folder
rm -rf .git
# Horovod
RUN conda install -y nccl -c conda-forge
ENV LD_LIBRARY_PATH=/opt/conda/lib:$LD_LIBRARY_PATH
COPY --from=builder /horovod/horovod-*.whl /horovod/
RUN cd /horovod && \
pip install --no-cache-dir horovod-*.whl && \
rm -fr /horovod