Skip to content

Commit 5110dab

Browse files
committed
Migrate ROCM build flags to llama-cpp docker file
Signed-off-by: Simon Redman <[email protected]>
1 parent df64b1b commit 5110dab

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

backend/Dockerfile.llama-cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ ARG CUDA_MINOR_VERSION
5858
ARG SKIP_DRIVERS=false
5959
ENV CUDA_MAJOR_VERSION=${CUDA_MAJOR_VERSION}
6060
ENV CUDA_MINOR_VERSION=${CUDA_MINOR_VERSION}
61+
ARG ROCM_MAJOR_VERSION=7
62+
ARG ROCM_MINOR_VERSION=1.1 # ROCm version to append to the major version, in the format of their apt repo (https://repo.radeon.com/rocm/apt/). Like `0_alpha` or `3.4`.
6163
ENV DEBIAN_FRONTEND=noninteractive
6264
ARG TARGETARCH
6365
ARG TARGETVARIANT
@@ -158,10 +160,29 @@ RUN if [ "${BUILD_TYPE}" = "clblas" ] && [ "${SKIP_DRIVERS}" = "false" ]; then \
158160
; fi
159161

160162
RUN if [ "${BUILD_TYPE}" = "hipblas" ] && [ "${SKIP_DRIVERS}" = "false" ]; then \
163+
# Setup for specific ROCm version as described here: https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/install-methods/package-manager/package-manager-ubuntu.html
164+
ROCM_VERSION="${ROCM_MAJOR_VERSION}.${ROCM_MINOR_VERSION}" && \
161165
apt-get update && \
162166
apt-get install -y --no-install-recommends \
163-
hipblas-dev \
164-
rocblas-dev && \
167+
gpg wget && \
168+
mkdir --parents --mode=0755 /etc/apt/keyrings && \
169+
wget -qO - https://repo.radeon.com/rocm/rocm.gpg.key | gpg --yes --dearmor --output /etc/apt/keyrings/rocm.gpg && \
170+
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/${ROCM_VERSION} jammy main" >> /etc/apt/sources.list.d/rocm.list && \
171+
if [ "${ROCM_MAJOR_VERSION}" -ge 7 ]; then \
172+
echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/graphics/${ROCM_VERSION}/ubuntu jammy main" >> /etc/apt/sources.list.d/rocm.list \
173+
; fi && \
174+
echo "Package: *" >> /etc/apt/preferences.d/rocm-pin-600 && \
175+
echo "Pin: release o=repo.radeon.com" >> /etc/apt/preferences.d/rocm-pin-600 && \
176+
echo "Pin-Priority: 600" >> /etc/apt/preferences.d/rocm-pin-600 && \
177+
# End setup steps for specific ROCm version
178+
apt-get update && \
179+
apt-get install -y --no-install-recommends \
180+
# Build dependencies
181+
rocm-developer-tools \
182+
rocm-hip-runtime-dev \
183+
rocm-hip-sdk \
184+
# Metapackage for the ROCm runtime + client tools
185+
rocm && \
165186
apt-get clean && \
166187
rm -rf /var/lib/apt/lists/* && \
167188
# I have no idea why, but the ROCM lib packages don't trigger ldconfig after they install, which results in local-ai and others not being able

0 commit comments

Comments
 (0)