Skip to content

Commit 8c51d2f

Browse files
authored
Merge branch 'microsoft:main' into wenqinglan/refine-gpu-stream
2 parents 5cec42c + 932d9f6 commit 8c51d2f

3 files changed

Lines changed: 167 additions & 1 deletion

File tree

.github/workflows/build-image.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ jobs:
2323
contents: read
2424
packages: write
2525
strategy:
26-
fail-fast: true
26+
# Do not cancel sibling image builds when one matrix entry fails. The ROCm
27+
# entries run on self-hosted runners and can fail transiently; we don't
28+
# want a flaky ROCm build to abort all CUDA images.
29+
fail-fast: false
2730
matrix:
2831
include:
2932
- name: cuda13.0-arm64
@@ -86,6 +89,11 @@ jobs:
8689
# platforms: linux/amd64
8790
# runner: [self-hosted, linux/amd64, rocm]
8891
# build_args: "NUM_MAKE_JOBS=16"
92+
- name: rocm6.3
93+
dockerfile: rocm6.3.x
94+
tags: superbench/main:rocm6.3
95+
platforms: linux/amd64
96+
runner: [self-hosted, linux/amd64, rocm]
8997
steps:
9098
- name: Checkout
9199
uses: actions/checkout@v2
@@ -183,6 +191,7 @@ jobs:
183191
run: echo ${{ steps.docker_build.outputs.digest }}
184192
docker-merge:
185193
needs: docker-build
194+
if: ${{ !cancelled() }}
186195
name: Docker merge ${{ matrix.name }}
187196
runs-on: self-hosted
188197
timeout-minutes: 300

dockerfile/rocm6.3.x.dockerfile

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
ARG BASE_IMAGE=rocm/pytorch-training:v25.6
2+
3+
FROM ${BASE_IMAGE}
4+
5+
# Base image: rocm/pytorch-training:v25.6
6+
# Pre-installed by base image:
7+
# - Ubuntu: 22.04
8+
# - Python: 3.10
9+
# - ROCm: 6.3.4
10+
# - openmpi: 4.0.7rc2
11+
# - torch: 2.8.0a0+git7d205b2
12+
# - rccl: 2.21.5.60304-76
13+
# - hipblaslt: 0.15.0-8c69191d
14+
# - transformer_engine: 1.14.0+2f85f5f2
15+
# - flash_attention: 3.0.0.post1
16+
# - cmake: 3.18.5
17+
# - rocm-cmake: 0.14.0.60304-76
18+
# - amd-smi: 25.1.0+8dc45db
19+
# Added by this Dockerfile:
20+
# - Docker Client: 27.5.1
21+
# - mlc: v3.12
22+
# - OFED: 24.10-1.1.4.0 LTS
23+
24+
# Fix base image botocore/urllib3 incompatibility:
25+
# Base image ships botocore 1.22.12 (expects urllib3 1.x) with urllib3 2.6.3,
26+
# causing "cannot import name 'DEFAULT_CIPHERS' from 'urllib3.util.ssl_'".
27+
# Upgrade botocore/boto3 to specific versions compatible with urllib3 2.x.
28+
RUN python3 -m pip install --no-cache-dir "botocore==1.35.98" "boto3==1.35.98"
29+
30+
LABEL maintainer="SuperBench"
31+
32+
ENV DEBIAN_FRONTEND=noninteractive
33+
RUN apt-get update && \
34+
apt-get -q install -y --no-install-recommends \
35+
autoconf \
36+
automake \
37+
bc \
38+
build-essential \
39+
curl \
40+
dmidecode \
41+
git \
42+
hipify-clang \
43+
iproute2 \
44+
jq \
45+
libaio-dev \
46+
libboost-program-options-dev \
47+
libcap2 \
48+
libcurl4-openssl-dev \
49+
libnuma-dev \
50+
libpci-dev \
51+
libssl-dev \
52+
libtinfo5 \
53+
libtool \
54+
lshw \
55+
net-tools \
56+
numactl \
57+
openssh-client \
58+
openssh-server \
59+
pciutils \
60+
python3-mpi4py \
61+
rsync \
62+
sudo \
63+
util-linux \
64+
vim \
65+
wget \
66+
&& \
67+
rm -rf /tmp/*
68+
69+
# Install Docker
70+
ENV DOCKER_VERSION=27.5.1
71+
RUN cd /tmp && \
72+
wget -q https://download.docker.com/linux/static/stable/x86_64/docker-${DOCKER_VERSION}.tgz -O docker.tgz && \
73+
tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \
74+
rm docker.tgz
75+
76+
# Update system config
77+
RUN mkdir -p /root/.ssh && \
78+
touch /root/.ssh/authorized_keys && \
79+
mkdir -p /var/run/sshd && \
80+
sed -i "s/[# ]*PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \
81+
sed -i "s/[# ]*PermitUserEnvironment no/PermitUserEnvironment yes/" /etc/ssh/sshd_config && \
82+
sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \
83+
echo "* soft nofile 1048576\n* hard nofile 1048576" >> /etc/security/limits.conf && \
84+
echo "root soft nofile 1048576\nroot hard nofile 1048576" >> /etc/security/limits.conf
85+
86+
87+
# Install OFED
88+
ENV OFED_VERSION=24.10-1.1.4.0
89+
# Check if ofed_info command is present; install OFED if missing
90+
RUN if ! command -v ofed_info >/dev/null 2>&1; then \
91+
echo "OFED not found. Installing OFED..."; \
92+
UBUNTU_VERSION=$(lsb_release -r -s); \
93+
cd /tmp && \
94+
wget -q https://content.mellanox.com/ofed/MLNX_OFED-${OFED_VERSION}/MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu${UBUNTU_VERSION}-x86_64.tgz && \
95+
tar xzf MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu${UBUNTU_VERSION}-x86_64.tgz && \
96+
PATH=/usr/bin:${PATH} MLNX_OFED_LINUX-${OFED_VERSION}-ubuntu${UBUNTU_VERSION}-x86_64/mlnxofedinstall --user-space-only --without-fw-update --force --all && \
97+
rm -rf MLNX_OFED_LINUX-${OFED_VERSION}* ; \
98+
fi
99+
100+
ENV ROCM_PATH=/opt/rocm
101+
102+
# Target GPU architectures for ROCm builds (space-separated).
103+
# Override at build time with: --build-arg AMDGPU_TARGETS="gfx90a gfx942 gfx950".
104+
ARG AMDGPU_TARGETS="gfx908 gfx90a gfx942"
105+
ENV AMDGPU_TARGETS="${AMDGPU_TARGETS}"
106+
107+
# Note: unlike rocm6.0/6.2 dockerfiles, RCCL is NOT rebuilt from source here
108+
# and LD_PRELOAD is not set. The base image (rocm/pytorch-training:v25.6) ships
109+
# rccl 2.21.5.60304-76 which is what we use at runtime.
110+
111+
# Use pre-installed OpenMPI from base image at /opt/ompi
112+
ENV MPI_HOME=/opt/ompi
113+
114+
# Install Intel MLC
115+
RUN cd /tmp && \
116+
wget -q https://downloadmirror.intel.com/866182/mlc_v3.12.tgz -O mlc.tgz && \
117+
tar xzf mlc.tgz Linux/mlc && \
118+
cp ./Linux/mlc /usr/local/bin/ && \
119+
rm -rf ./Linux mlc.tgz
120+
121+
ENV PATH="/opt/ompi/bin:/opt/superbench/bin:/usr/local/bin/:/opt/rocm/hip/bin/:/opt/rocm/bin/:${PATH}" \
122+
LD_LIBRARY_PATH="/opt/ompi/lib:/usr/lib/x86_64-linux-gnu/:/usr/local/lib/:/opt/rocm/lib:${LD_LIBRARY_PATH}" \
123+
SB_HOME=/opt/superbench \
124+
SB_MICRO_PATH=/opt/superbench \
125+
ANSIBLE_DEPRECATION_WARNINGS=FALSE \
126+
ANSIBLE_COLLECTIONS_PATH=/usr/share/ansible/collections
127+
128+
RUN echo PATH="$PATH" > /etc/environment && \
129+
echo LD_LIBRARY_PATH="$LD_LIBRARY_PATH" >> /etc/environment && \
130+
echo SB_MICRO_PATH="$SB_MICRO_PATH" >> /etc/environment
131+
132+
RUN python3 -m pip install --upgrade pip wheel setuptools==65.7
133+
134+
RUN python3 -c "import pkg_resources" || python3 -m pip install setuptools
135+
136+
WORKDIR ${SB_HOME}
137+
138+
ADD third_party third_party
139+
140+
RUN make RCCL_HOME=/opt/rocm ROCBLAS_BRANCH=release-staging/rocm-rel-6.3 HIPBLASLT_BRANCH=release-staging/rocm-rel-6.3 ROCM_VER=rocm-5.5.0 -C third_party rocm -o cpu_hpl -o cpu_stream -o megatron_lm -o rocm_megatron_lm
141+
142+
ADD . .
143+
ENV USE_HIP_DATATYPE=1
144+
ENV USE_HIPBLAS_COMPUTETYPE=1
145+
RUN python3 -m pip install --no-build-isolation .[amdworker] && \
146+
CXX=/opt/rocm/bin/hipcc make cppbuild && \
147+
make postinstall && \
148+
rm -rf .git

third_party/Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,17 @@ ifneq (,$(wildcard fio/Makefile))
134134
endif
135135

136136
# Build rccl-tests from commit 46375b1 of default branch.
137+
# If AMDGPU_TARGETS env var is set (space-separated, e.g. "gfx908 gfx90a gfx942"),
138+
# explicit --offload-arch flags and include paths are used.
139+
# Otherwise, the original build command is used (relies on hipcc auto-detection).
140+
ROCM_OFFLOAD_ARCH_FLAGS := $(foreach arch,$(AMDGPU_TARGETS),--offload-arch=$(arch))
137141
rocm_rccl_tests: sb_micro_path
138142
ifneq (, $(wildcard rccl-tests/Makefile))
143+
ifneq ($(strip $(AMDGPU_TARGETS)),)
144+
cd ./rccl-tests && make MPI=1 MPI_HOME=$(MPI_HOME) HIPCUFLAGS="-std=c++14 -O3 $(ROCM_OFFLOAD_ARCH_FLAGS) -I$(ROCM_PATH)/include -I$(ROCM_PATH)/include/rccl -I$(ROCM_PATH)/include/hip -DMPI_SUPPORT -I$(MPI_HOME)/include -I$(MPI_HOME)/include/mpi" -j
145+
else
139146
cd ./rccl-tests && make MPI=1 MPI_HOME=$(MPI_HOME) -j
147+
endif
140148
cp -v -r ./rccl-tests/build/* $(SB_MICRO_PATH)/bin/
141149
endif
142150

@@ -168,6 +176,7 @@ rocm_hipblaslt: sb_micro_path
168176
# Build hipBusBandwidth.
169177
# HIP is released with rocm, like rocm-4.2.0 and so on.
170178
# The version we use is the released tag which is consistent with the rocm version in the environment or docker.
179+
171180
rocm_bandwidthTest: sb_micro_path
172181
git clone -b ${ROCM_VER} https://github.com/ROCm-Developer-Tools/HIP.git
173182
cd ./HIP/samples/1_Utils/hipBusBandwidth/ && mkdir -p build && cd build && cmake .. && make

0 commit comments

Comments
 (0)