Skip to content

Instantly share code, notes, and snippets.

@rueian
Created August 3, 2022 16:46
Show Gist options
  • Save rueian/d8a6b8e1a7fb81d2ad7e42499b747ab0 to your computer and use it in GitHub Desktop.
Save rueian/d8a6b8e1a7fb81d2ad7e42499b747ab0 to your computer and use it in GitHub Desktop.
# syntax=docker/dockerfile:experimental
FROM nvidia/cuda:11.4.0-cudnn8-devel-ubuntu20.04
ENV PATH /usr/local/bin:$PATH
# http://bugs.python.org/issue19846
# > At the moment, setting "LANG=C" on a Linux system *fundamentally breaks Python 3*, and that's not OK.
ENV LANG C.UTF-8
ENV DEBIAN_FRONTEND noninteractive
# runtime dependencies
RUN --mount=type=cache,target=/var/cache/apt \
set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends \
wget \
curl \
git \
vim \
rsync \
tmux \
libjemalloc-dev \
g++ \
zlib1g-dev \
openssh-client \
gnupg \
unzip \
libgl1-mesa-dev \
libgtk2.0-dev \
cmake \
ccache \
libsndfile1 \
build-essential \
ca-certificates \
cmake \
libsndfile1 \
libbluetooth-dev \
tk-dev \
uuid-dev \
; \
rm -rf /var/lib/apt/lists/*
RUN /usr/sbin/update-ccache-symlinks
RUN mkdir /opt/ccache && ccache --set-config=cache_dir=/opt/ccache
ENV PATH /opt/conda/bin:$PATH
RUN curl -fsSL -v -o ~/miniconda.sh -O https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
chmod +x ~/miniconda.sh && \
~/miniconda.sh -b -p /opt/conda && \
rm ~/miniconda.sh
RUN pip install --no-cache-dir \
ray[full] \
torch torchvision torchaudio
RUN HOROVOD_GPU_OPERATIONS=NCCL \
HOROVOD_WITH_PYTORCH=1 \
HOROVOD_WITHOUT_MPI=1 \
HOROVOD_WITHOUT_TENSORFLOW=1 \
HOROVOD_WITHOUT_MXNET=1 \
pip install --no-cache-dir horovod[pytorch] && \
horovodrun --check-build && \
python -c "import horovod.torch; horovod.torch.init()"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment