Skip to content

Instantly share code, notes, and snippets.

@lazykyama
Last active September 15, 2019 08:14
Show Gist options
  • Save lazykyama/92b235b8fe0f71ed7d000c9cbfee5732 to your computer and use it in GitHub Desktop.
Save lazykyama/92b235b8fe0f71ed7d000c9cbfee5732 to your computer and use it in GitHub Desktop.
Dockerfile to build a Chainer container with OpenMPI and NVIDIA DALI.
# To make a container including chainer, OpenMPI and DALI.
FROM nvcr.io/nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
# Install global dependencies.
RUN apt-get update && apt-get install -y vim git wget python3-pip
# Install OpenMPI, mpi4py and DALI.
WORKDIR /opt
RUN wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.gz \
&& tar xf openmpi-3.1.4.tar.gz
RUN cd openmpi-3.1.4/ && ./configure --with-cuda \
&& make -j $(nproc) && make install
RUN ldconfig
RUN pip3 install mpi4py
# NOTE: Usually, you can install prebuilt DALI via pypi,
# but now, pip install failed due to 404 error...
# The following commands are workaround.
# See details: https://docs.nvidia.com/deeplearning/sdk/dali-developer-guide/docs/installation.html#installing-prebuilt-dali-packages
RUN wget http://developer.download.nvidia.com/compute/redist/cuda/10.0/nvidia-dali/nvidia_dali-0.12.0-819496-cp36-cp36m-manylinux1_x86_64.whl
RUN pip3 install nvidia_dali-0.12.0-819496-cp36-cp36m-manylinux1_x86_64.whl
# Install other required modules.
RUN pip3 install chainer==6.3.0 cupy-cuda100==6.3.0 pillow
WORKDIR /
# To make a container including chainer, OpenMPI and DALI.
FROM nvcr.io/nvidia/cuda:10.0-cudnn7-devel-ubuntu18.04
# Install global dependencies.
RUN apt-get update && apt-get install -y vim git wget python3-pip
# Install OpenMPI, mpi4py and DALI.
WORKDIR /opt
RUN wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.4.tar.gz \
&& tar xf openmpi-3.1.4.tar.gz
RUN cd openmpi-3.1.4/ && ./configure --with-cuda \
&& make -j $(nproc) && make install
RUN ldconfig
RUN pip3 install mpi4py
# NOTE: Usually, you can install prebuilt DALI via pypi,
# but now, pip install failed due to 404 error...
# The following commands are workaround.
# See details: https://docs.nvidia.com/deeplearning/sdk/dali-developer-guide/docs/installation.html#installing-prebuilt-dali-packages
RUN wget http://developer.download.nvidia.com/compute/redist/cuda/10.0/nvidia-dali/nvidia_dali-0.12.0-819496-cp36-cp36m-manylinux1_x86_64.whl
RUN pip3 install nvidia_dali-0.12.0-819496-cp36-cp36m-manylinux1_x86_64.whl
# Install other required modules.
RUN pip3 install chainer==7.0.0b3 cupy-cuda100==7.0.0b3 pillow
WORKDIR /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment