Unverified Commit 25ec3a7c authored by Yifan Xiong's avatar Yifan Xiong Committed by GitHub
Browse files

Dockerfile - Update CUDA 11.1.1 Dockerfile (#96)

Update packages and add build cache for CUDA 11.1.1 Dockerfile:

* Remove duplicate cmake and ompi, which are already in base image
* Add hpcx and sharp lib
* Add cache for gitmodules build
* Sort apt-get packages
parent ddbc51a1
# SuperBench # SuperBench
outputs outputs/
*.tar.gz *.tar.gz
# Python # Python
__pycache__ **/__pycache__
*.pyc *.pyc
*.pyo *.pyo
*.pyd *.pyd
# Git # Git
.git **/.git
.github **/.gitmodules
**/.dockerignore
.github/
.azure-pipelines/
...@@ -13,6 +13,10 @@ jobs: ...@@ -13,6 +13,10 @@ jobs:
name: Docker build name: Docker build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- name: Free disk space - name: Free disk space
run: | run: |
mkdir /tmp/emptydir mkdir /tmp/emptydir
...@@ -33,7 +37,7 @@ jobs: ...@@ -33,7 +37,7 @@ jobs:
CACHE_FROM="type=registry,ref=${DOCKER_IMAGE}:${IMAGE_TAG}" CACHE_FROM="type=registry,ref=${DOCKER_IMAGE}:${IMAGE_TAG}"
CACHE_TO="" CACHE_TO=""
if [ "${{ github.event_name }}" = "push" ]; then if [ "${{ github.event_name }}" = "push" ]; then
CACHE_TO="type=inline" CACHE_TO="type=inline,mode=max"
fi fi
echo ::set-output name=dockerfile::${DOCKERFILE} echo ::set-output name=dockerfile::${DOCKERFILE}
...@@ -55,6 +59,7 @@ jobs: ...@@ -55,6 +59,7 @@ jobs:
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
platforms: linux/amd64 platforms: linux/amd64
context: .
file: ${{ steps.metadata.outputs.dockerfile }} file: ${{ steps.metadata.outputs.dockerfile }}
push: ${{ github.event_name == 'push' }} push: ${{ github.event_name == 'push' }}
tags: ${{ steps.metadata.outputs.tags }} tags: ${{ steps.metadata.outputs.tags }}
......
FROM nvcr.io/nvidia/pytorch:20.12-py3 FROM nvcr.io/nvidia/pytorch:20.12-py3
# OS:
# - Ubuntu: 20.04
# NVIDIA:
# - CUDA: 11.1.1
# - cuDNN: 8.0.5
# - NCCL: bootstrap_tag
# Mellanox:
# - OFED: 5.2-2.2.3.0
# - HPC-X: v2.8.3
# - NCCL RDMA SHARP plugins: 7cccbc1
LABEL maintainer="SuperBench" LABEL maintainer="SuperBench"
ARG DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
autoconf \
automake \
build-essential \ build-essential \
jq \
vim \
git \
curl \ curl \
wget \
lshw \
dmidecode \ dmidecode \
util-linux \ git \
automake \ jq \
autoconf \ libaio-dev \
libcap2 \
libpci-dev \
libtinfo5 \
libtool \ libtool \
lshw \
net-tools \ net-tools \
openssh-client \ openssh-client \
openssh-server \ openssh-server \
pciutils \ pciutils \
libpci-dev \ util-linux \
libaio-dev \ vim \
libcap2 \ wget \
libtinfo5 && \
apt-get autoremove && \
# Install CMake apt-get clean && \
RUN wget -q https://github.com/Kitware/CMake/releases/download/v3.17.1/cmake-3.17.1-Linux-x86_64.sh \ rm -rf /var/lib/apt/lists/* /tmp/* /opt/cmake-3.14.6-Linux-x86_64
-O /tmp/cmake-install.sh && \
chmod +x /tmp/cmake-install.sh && \
mkdir /usr/local/cmake && \
/tmp/cmake-install.sh --skip-license --prefix=/usr/local/cmake && \
rm /tmp/cmake-install.sh
# Configure SSH # Configure SSH
RUN mkdir -p /root/.ssh && \ RUN mkdir -p /root/.ssh && \
...@@ -42,52 +49,63 @@ RUN mkdir -p /root/.ssh && \ ...@@ -42,52 +49,63 @@ RUN mkdir -p /root/.ssh && \
sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \ sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
# Install OpenMPI
ARG OMPI_VERSION=4.0.5
RUN cd /tmp && \
wget -q https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-${OMPI_VERSION}.tar.gz && \
tar xzf openmpi-${OMPI_VERSION}.tar.gz && \
cd openmpi-${OMPI_VERSION} && \
./configure --enable-orterun-prefix-by-default && \
make -j all && \
make install && \
ldconfig && \
rm -rf /tmp/openmpi-${OMPI_VERSION}*
# Install OFED # Install OFED
ARG OFED_VERSION=5.2-1.0.4.0 ENV OFED_VERSION=5.2-2.2.3.0
RUN cd /tmp && \ RUN cd /tmp && \
wget -q http://content.mellanox.com/ofed/MLNX_OFED-${OFED_VERSION}/MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64.tgz && \ wget -q http://content.mellanox.com/ofed/MLNX_OFED-${OFED_VERSION}/MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64.tgz && \
tar xzf MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64.tgz && \ tar xzf MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64.tgz && \
MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64/mlnxofedinstall --user-space-only --without-fw-update --force --all && \ MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64/mlnxofedinstall --user-space-only --without-fw-update --force --all && \
rm -rf /tmp/MLNX_OFED_LINUX-${OFED_VERSION}* rm -rf /tmp/MLNX_OFED_LINUX-${OFED_VERSION}*
# Install OFED perftest # Install HPC-X
RUN cd /opt && \
wget -q https://azhpcstor.blob.core.windows.net/azhpc-images-store/hpcx-v2.8.3-gcc-MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64.tbz && \
tar xf hpcx-v2.8.3-gcc-MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64.tbz && \
ln -s hpcx-v2.8.3-gcc-MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64 hpcx && \
rm hpcx-v2.8.3-gcc-MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu20.04-x86_64.tbz
# Install NCCL RDMA SHARP plugins
RUN cd /tmp && \
git clone https://github.com/Mellanox/nccl-rdma-sharp-plugins.git && \
cd nccl-rdma-sharp-plugins && \
git reset --hard 7cccbc1 && \
./autogen.sh && \
./configure --prefix=/usr/local --with-cuda=/usr/local/cuda && \
make -j && \
make install && \
cd /tmp && \
rm -rf nccl-rdma-sharp-plugins
# Install NCCL patch
RUN cd /tmp && \
git clone -b bootstrap_tag https://github.com/NVIDIA/nccl.git && \
cd nccl && \
make -j src.build && \
make install && \
cd /tmp && \
rm -rf nccl
# TODO: move to gitmodules
RUN git clone -b v4.5-0.2 https://github.com/linux-rdma/perftest.git /usr/local/perftest && \ RUN git clone -b v4.5-0.2 https://github.com/linux-rdma/perftest.git /usr/local/perftest && \
cd /usr/local/perftest && \ cd /usr/local/perftest && \
./autogen.sh && \ ./autogen.sh && \
./configure CUDA_H_PATH=/usr/local/cuda/include/cuda.h && \ ./configure CUDA_H_PATH=/usr/local/cuda/include/cuda.h && \
make -j && \ make -j && \
make install make install
# Install NCCL
RUN git clone -b v2.8.4-1 https://github.com/NVIDIA/nccl /usr/local/nccl && \
cd /usr/local/nccl && \
make -j src.build && \
make install
RUN git clone https://github.com/nvidia/nccl-tests /usr/local/nccl-tests && \ RUN git clone https://github.com/nvidia/nccl-tests /usr/local/nccl-tests && \
cd /usr/local/nccl-tests && \ cd /usr/local/nccl-tests && \
make MPI=1 MPI_HOME=/usr/local/mpi/ -j make MPI=1 MPI_HOME=/usr/local/mpi/ -j
ENV PATH="${PATH}:/usr/local/cmake/bin:/usr/local/nccl-tests/build" \ ENV PATH="/usr/local/nccl-tests/build:${PATH}" \
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/lib" \ LD_LIBRARY_PATH="/usr/local/lib:${LD_LIBRARY_PATH}" \
SB_HOME="/opt/superbench" \ SB_HOME="/opt/superbench" \
SB_MICRO_PATH="/opt/superbench" SB_MICRO_PATH="/opt/superbench"
WORKDIR ${SB_HOME} WORKDIR ${SB_HOME}
ADD . .
RUN cd ${SB_HOME} && \ ADD third_party third_party
python3 -m pip install .[nvidia,torch] && \ RUN make -j -C third_party
make cppbuild && \
make thirdparty ADD . .
\ No newline at end of file RUN python3 -m pip install .[nvidia,torch] && \
make cppbuild
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment