|
| 1 | +# Multi-stage build |
| 2 | +# 1/Building apex with pytorch:1.6.0-cuda10.1-cudnn7-devel |
| 3 | +FROM pytorch/pytorch:1.6.0-cuda10.1-cudnn7-devel AS msdp-builder |
| 4 | + |
| 5 | +ARG ARG_TORCH_CUDA_ARCH_LIST="6.0;6.1;6.2;7.0;7.5" |
| 6 | +ENV TORCH_CUDA_ARCH_LIST=$ARG_TORCH_CUDA_ARCH_LIST |
| 7 | + |
| 8 | +# Install git |
| 9 | +RUN apt-get update && apt-get install -y --no-install-recommends git && \ |
| 10 | + rm -rf /var/lib/apt/lists/* |
| 11 | + |
| 12 | +# For pip --use-feature option |
| 13 | +RUN python -m pip install --upgrade pip |
| 14 | + |
| 15 | +# From https://github.com/microsoft/DeepSpeed/blob/master/docker/Dockerfile |
| 16 | +############################################################################## |
| 17 | +# DeepSpeed |
| 18 | +############################################################################## |
| 19 | +RUN git clone https://github.com/microsoft/DeepSpeed.git /tmp/DeepSpeed |
| 20 | +RUN cd /tmp/DeepSpeed && \ |
| 21 | + git checkout . && \ |
| 22 | + git checkout master && \ |
| 23 | + ./install.sh --allow_sudo |
| 24 | + |
| 25 | +# Build runtime image |
| 26 | +FROM pytorch/pytorch:1.6.0-cuda10.1-cudnn7-runtime |
| 27 | + |
| 28 | +# For building cpufeature wheel |
| 29 | +RUN apt-get update && apt-get install -y --no-install-recommends g++ gcc |
| 30 | + |
| 31 | +# Apex |
| 32 | +COPY --from=msdp-builder /tmp/DeepSpeed/third_party/apex/dist/apex-*.whl /apex/ |
| 33 | +RUN cd /apex && \ |
| 34 | + pip install --no-cache-dir apex-*.whl && \ |
| 35 | + rm -fr /apex |
| 36 | + |
| 37 | +# MSDeepSpeed |
| 38 | +COPY --from=msdp-builder /tmp/DeepSpeed/dist/deepspeed-*.whl /msdp/ |
| 39 | +RUN cd /msdp && \ |
| 40 | + pip install --no-cache-dir deepspeed-*.whl && \ |
| 41 | + rm -fr /msdp |
| 42 | + |
| 43 | +# Install tzdata / git |
| 44 | +RUN apt-get update && \ |
| 45 | + ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime && \ |
| 46 | + apt-get install -y tzdata && \ |
| 47 | + dpkg-reconfigure --frontend noninteractive tzdata && \ |
| 48 | + apt-get -y install --no-install-recommends git && \ |
| 49 | + rm -rf /var/lib/apt/lists/* |
| 50 | + |
| 51 | +# Ignite main dependencies |
| 52 | +RUN pip install --upgrade --no-cache-dir pytorch-ignite \ |
| 53 | + tensorboard \ |
| 54 | + tqdm |
| 55 | +# Checkout Ignite examples only |
| 56 | +RUN mkdir -p pytorch-ignite-examples && \ |
| 57 | + cd pytorch-ignite-examples && \ |
| 58 | + git init && \ |
| 59 | + git config core.sparsecheckout true && \ |
| 60 | + echo examples >> .git/info/sparse-checkout && \ |
| 61 | + git remote add -f origin https://github.com/pytorch/ignite.git && \ |
| 62 | + git pull origin master |
| 63 | + |
| 64 | +WORKDIR /workspace |
| 65 | + |
| 66 | +ENTRYPOINT ["/bin/bash"] |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | + |
0 commit comments