Skip to content

Commit

Permalink
Add Dockerfiles (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
chhwang authored Jul 10, 2023
1 parent 56bdbc2 commit 2b98333
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
54 changes: 54 additions & 0 deletions docker/base-cuda12.1.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
FROM nvidia/cuda:12.1.1-devel-ubuntu20.04

LABEL maintainer="MSCCL++"
LABEL org.opencontainers.image.source https://github.com/microsoft/mscclpp

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
libcap2 \
libnuma-dev \
openssh-client \
openssh-server \
python3-dev \
python3-pip \
python3-setuptools \
python3-wheel \
sudo \
wget \
&& \
apt-get autoremove && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/*

# Install OFED
ENV OFED_VERSION=5.2-2.2.3.0
RUN cd /tmp && \
wget -q https://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 && \
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}*

# Install OpenMPI
ENV OPENMPI_VERSION=4.1.5
RUN cd /tmp && \
export ompi_v_parsed="$(echo ${OPENMPI_VERSION} | sed -E 's/^([0-9]+)\.([0-9]+)\..*/\1.\2/')" && \
wget -q https://download.open-mpi.org/release/open-mpi/v${ompi_v_parsed}/openmpi-${OPENMPI_VERSION}.tar.gz && \
tar xzf openmpi-${OPENMPI_VERSION}.tar.gz && \
cd openmpi-${OPENMPI_VERSION} && \
./configure --prefix=/usr/local/mpi && \
make -j && \
make install && \
cd .. && \
rm -rf /tmp/openmpi-${OPENMPI_VERSION}*

ENV PATH="${PATH}:/usr/local/mpi/bin" \
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/local/mpi/lib:/usr/local/cuda-12.1/compat:/usr/local/cuda-12.1/lib64"

RUN echo PATH="${PATH}" > /etc/environment && \
echo LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" >> /etc/environment
32 changes: 32 additions & 0 deletions docker/release-cuda12.1.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
FROM ghcr.io/microsoft/mscclpp/mscclpp:base-cuda12.1

LABEL maintainer="MSCCL++"
LABEL org.opencontainers.image.source https://github.com/microsoft/mscclpp

ENV MSCCLPP_HOME="/usr/local/mscclpp" \
MSCCLPP_SRC_DIR="/tmp/mscclpp" \
CMAKE_VERSION="3.26.4"

# Download cmake 3.26.4
ENV CMAKE_HOME="/tmp/cmake-${CMAKE_VERSION}-linux-x86_64" \
CMAKE_URL="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz"
RUN curl -L ${CMAKE_URL} -o ${CMAKE_HOME}.tar.gz && \
tar xzf ${CMAKE_HOME}.tar.gz -C /tmp

# Install MSCCL++
ADD . ${MSCCLPP_SRC_DIR}
WORKDIR ${MSCCLPP_SRC_DIR}
RUN rm -rf build && \
mkdir build && \
cd build && \
${CMAKE_HOME}/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${MSCCLPP_HOME} .. && \
make -j mscclpp && \
make install/fast && \
strip ${MSCCLPP_HOME}/lib/libmscclpp.so.[0-9]*.[0-9]*.[0-9]*

ENV LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${MSCCLPP_HOME}/lib"
RUN echo LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" >> /etc/environment

# Cleanup
WORKDIR /
RUN rm -rf ${CMAKE_HOME}* ${MSCCLPP_SRC_DIR}

0 comments on commit 2b98333

Please sign in to comment.