-
Notifications
You must be signed in to change notification settings - Fork 5
/
Dockerfile
143 lines (122 loc) · 4.43 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
ARG UBUNTU_VERSION="noble"
FROM ubuntu:${UBUNTU_VERSION}
ARG ROCM_URL="https://repo.radeon.com/amdgpu-install/6.2.4/ubuntu/noble/amdgpu-install_6.2.60204-1_all.deb"
ARG UCX_BRANCH="v1.17.0"
ARG UCC_BRANCH="v1.3.0"
ARG OMPI_BRANCH="v5.0.5"
ARG APT_GET_APPS=""
ARG GPU_TARGET="gfx908,gfx90a,gfx942"
# Update and Install basic Linux development tools
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
ca-certificates \
git \
ssh \
make \
vim \
nano \
libtinfo-dev\
initramfs-tools \
libelf-dev \
numactl \
curl \
wget \
tmux \
build-essential \
autoconf \
automake \
libtool \
pkg-config \
libnuma-dev \
gfortran \
flex \
hwloc \
libstdc++-12-dev \
libxml2-dev \
python3-dev \
python3-pip \
unzip ${APT_GET_APPS}\
&& apt-get clean
RUN wget -qO- https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor | tee /etc/apt/trusted.gpg.d/rocm.gpg \
&& wget -O rocm.deb ${ROCM_URL} \
&& apt install -y ./rocm.deb \
&& amdgpu-install --usecase=rocm,hiplibsdk --no-dkms -y
RUN bash -c """IFS=',' read -r -a ARCH <<<${GPU_TARGET} \
&& for gpu_arch in \${ARCH[@]}; do \
echo \$gpu_arch >> /opt/rocm/bin/target.lst; \
done""" \
&& chmod a+r /opt/rocm/bin/target.lst
# # Requires cmake > 3.22
RUN mkdir -p /opt/cmake \
&& wget --no-check-certificate --quiet -O - https://cmake.org/files/v3.30/cmake-3.30.5-linux-x86_64.tar.gz | tar --strip-components=1 -xz -C /opt/cmake
ENV ROCM_PATH=/opt/rocm \
UCX_PATH=/opt/ucx \
UCC_PATH=/opt/ucc \
OMPI_PATH=/opt/ompi \
GPU_TARGET=${GPU_TARGET}
# Adding rocm/cmake to the Environment
ENV PATH=$ROCM_PATH/bin:/opt/cmake/bin:$PATH \
LD_LIBRARY_PATH=$ROCM_PATH/lib:$ROCM_PATH/lib64:$ROCM_PATH/llvm/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=$ROCM_PATH/lib:$ROCM_PATH/lib64:$LIBRARY_PATH \
C_INCLUDE_PATH=$ROCM_PATH/include:$C_INCLUDE_PATH \
CPLUS_INCLUDE_PATH=$ROCM_PATH/include:$CPLUS_INCLUDE_PATH \
CMAKE_PREFIX_PATH=$ROCM_PATH/lib/cmake:$CMAKE_PREFIX_PATH
WORKDIR /tmp
# Install UCX
RUN git clone https://github.com/openucx/ucx.git -b ${UCX_BRANCH} \
&& cd ucx \
&& ./autogen.sh \
&& mkdir build \
&& cd build \
&& ../contrib/configure-release --prefix=$UCX_PATH \
--with-rocm=$ROCM_PATH \
--without-knem \
--without-xpmem \
--without-cuda \
--enable-optimizations \
--disable-logging \
--disable-debug \
--disable-examples \
&& make -j $(nproc) \
&& make install
# Install UCC
RUN git clone -b ${UCC_BRANCH} https://github.com/openucx/ucc \
&& cd ucc \
&& ./autogen.sh \
&& sed -i 's/memoryType/type/g' ./src/components/mc/rocm/mc_rocm.c \
# offload-arch=native builds the local architecutre, which may not be present at build time for a container.
&& sed -i 's/--offload-arch=native//g' ./cuda_lt.sh \
&& mkdir build \
&& cd build \
&& ../configure --prefix=${UCC_PATH} --with-rocm=${ROCM_PATH} --with-ucx=${UCX_PATH} --with-rccl=no \
&& make -j $(nproc) \
&& make install
# Install OpenMPI
RUN git clone --recursive https://github.com/open-mpi/ompi.git -b ${OMPI_BRANCH} \
&& cd ompi \
&& ./autogen.pl \
&& mkdir build \
&& cd build \
&& ../configure --prefix=$OMPI_PATH --with-ucx=$UCX_PATH \
--with-ucc=${UCC_PATH} \
--enable-mca-no-build=btl-uct \
--without-verbs \
--with-pmix=internal \
--enable-mpi \
--enable-mpi-fortran=yes \
--disable-man-pages \
--disable-debug \
&& make -j $(nproc) \
&& make install
# Adding OpenMPI, UCX, and UCC to Environment
ENV PATH=$OMPI_PATH/bin:$UCX_PATH/bin:$UCC_PATH/bin:$PATH \
LD_LIBRARY_PATH=$OMPI_PATH/lib:$UCX_PATH/lib:$UCC_PATH/lib:$LD_LIBRARY_PATH \
LIBRARY_PATH=$OMPI_PATH/lib:$UCX_PATH/lib:$UCC_PATH/lib:$LIBRARY_PATH \
C_INCLUDE_PATH=$OMPI_PATH/include:$UCX_PATH/include:$UCC_PATH/include:$C_INCLUDE_PATH \
CPLUS_INCLUDE_PATH=$OMPI_PATH/include:$UCX_PATH/include:$UCC_PATH/include:$CPLUS_INCLUDE_PATH \
PKG_CONFIG_PATH=$OMPI_PATH/lib/pkgconfig:$UCX_PATH/lib/pkgconfig/:$PKG_CONFIG_PATH \
OMPI_ALLOW_RUN_AS_ROOT=1 \
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 \
UCX_WARN_UNUSED_ENV_VARS=n
# Install Additional Apps Below
CMD ["/bin/bash"]