Skip to content

Instantly share code, notes, and snippets.

@AmosLewis
Created September 20, 2025 04:43
Show Gist options
  • Save AmosLewis/ed05d6a6fbf99480de2f11957059e207 to your computer and use it in GitHub Desktop.
Save AmosLewis/ed05d6a6fbf99480de2f11957059e207 to your computer and use it in GitHub Desktop.
FROM rocm/7.0:rocm7.0_ubuntu_22.04_sgl-dev-v0.5.2-rocm7.0-mi35x-20250915
# ######################################################
# # Install MLPerf+Shark reference implementation
# ######################################################
ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-c"]
# apt dependencies
RUN apt-get --fix-broken install -y && apt-get update && apt-get install -y \
ffmpeg libsm6 libxext6 git wget unzip \
software-properties-common git \
build-essential curl cmake ninja-build clang lld vim nano \
gfortran pkg-config libopenblas-dev libssl-dev openssl && \
apt-get clean && rm -rf /var/lib/apt/lists/*
RUN git clone https://github.com/pyenv/pyenv.git /root/.pyenv
ENV PYENV_ROOT="/root/.pyenv"
ENV PATH="${PYENV_ROOT}/bin:${PYENV_ROOT}/shims:${PATH}"
RUN source "$PYENV_ROOT/completions/pyenv.bash" && \
pyenv install 3.11.13 && \
pyenv global 3.11.13 && \
pyenv rehash
RUN pip install --upgrade pip setuptools wheel && \
pip install pybind11 'nanobind<2' numpy==1.* pandas && \
pip install hip-python hip-python-as-cuda -i https://test.pypi.org/simple
# install loadgen
RUN mkdir /mlperf/ && cd /mlperf && \
git clone --recursive https://github.com/mlcommons/inference.git inference && \
cd inference/loadgen && \
pip install -r requirements.txt && \
CFLAGS="-std=c++14" python setup.py install
RUN mkdir -p /mlperf/shark_reference/ && cp -r /mlperf/inference/language/llama3.1-405b/* /mlperf/shark_reference/ && cp /mlperf/inference/mlperf.conf /mlperf/shark_reference/
RUN cd /mlperf/shark_reference/ && pip install transformers
######################################################
# Install iree tools
######################################################
# Disable apt-key parse waring
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
# Checkout and build IREE
RUN git clone https://github.com/iree-org/iree.git /iree \
&& cd /iree \
&& git checkout 77daeb096bf8e8b8da4ec2bf5d261533aaa9e819 \
&& git submodule update --init \
&& pip install --force-reinstall -r runtime/bindings/python/iree/runtime/build_requirements.txt \
&& pip uninstall -y numpy \
&& pip install numpy==1.* \
&& cmake -G Ninja -B build-release -S . \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER=`which clang` \
-DCMAKE_CXX_COMPILER=`which clang++` \
-DIREE_BUILD_PYTHON_BINDINGS=ON \
-DPython3_EXECUTABLE="$(which python)" \
-DIREE_TARGET_BACKEND_ROCM=ON \
-DIREE_TARGET_BACKEND_CUDA=OFF \
-DIREE_HAL_DRIVER_HIP=ON \
-DIREE_HAL_DRIVER_CUDA=OFF \
&& cmake --build build-release/ --target tools/all \
&& cmake --build build-release/ --target install
# Make IREE tools discoverable in PATH
ENV PATH=/iree/build-release/tools:$PATH
ENV PYTHONPATH=/iree/build-release/runtime/bindings/python:/iree/build-release/compiler/bindings/python
######################################################
# Install shark-ai
######################################################
RUN git clone https://github.com/nod-ai/shark-ai.git /shark-ai \
&& cd /shark-ai \
&& git checkout 4e1818573e88879b5e42170198557055f0e85b13 \
&& pip install -r pytorch-cpu-requirements.txt \
&& pip install -r requirements.txt -e sharktank/ -e shortfin/ \
&& pip install -r requirements-iree-unpinned.txt \
&& pip uninstall iree-base-compiler iree-base-runtime torchvision -y
ENV GLIBC_TUNABLES=glibc.rtld.optional_static_tls=2048
ENV HF_HOME=/models/huggingface/
# enable RPD
RUN git clone https://github.com/ROCm/rocmProfileData.git /rocmProfileData \
&& cd /rocmProfileData \
&& apt-get update && ./install.sh \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
ENV HF_HOME=/models/huggingface/
# enable bandwith test and numa
RUN git clone https://github.com/ROCm/rocm_bandwidth_test --depth 1 /rocm_bandwidth_test \
&& cd /rocm_bandwidth_test \
&& mkdir build && cd build \
&& cmake -DCMAKE_PREFIX_PATH="/opt/rocm/" .. \
&& make -j && make install \
&& pip install py-libnuma
# copy the harness code to the docker image
COPY LLAMA_inference /mlperf/harness/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment