Skip to content

Commit

Permalink
RHOAIENG-9853: fix(rocm): remove more files that instructlab also rem…
Browse files Browse the repository at this point in the history
…oves

Turns out we can remove the llvm installation if we do it forcibly, without removing dependencies.
Additionally, there are gfx files for all supported cards, so since we support less, we can remove many.

See https://github.com/tiran/instructlab-containers/blob/main/containers/rocm/Containerfile.c9s#L47
  • Loading branch information
jiridanek committed Aug 6, 2024
1 parent ec45de1 commit 07d48b1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion rocm/ubi9-python-3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ WORKDIR /opt/app-root/bin
ARG ROCM_VERSION=6.1
ARG AMDGPU_VERSION=6.1

# default: same targets and ROCm version as https://github.com/tiran/instructlab-containers/blob/main/containers/rocm/Containerfile.c9s#L47
ARG AMDGPU_TARGETS=gfx900;gfx906:xnack-;gfx908:xnack-;gfx90a:xnack-;gfx90a:xnack+;gfx942;gfx1030;gfx1100

# Enable epel-release repositories

# Install the ROCm rpms
Expand All @@ -33,7 +36,15 @@ RUN echo "[ROCm]" > /etc/yum.repos.d/rocm.repo && \
echo "enabled=1" >> /etc/yum.repos.d/amdgpu.repo && \
echo "gpgcheck=0" >> /etc/yum.repos.d/amdgpu.repo && \
yum install -y rocm && \
yum clean all && rm -rf /var/cache/yum
yum clean all && rm -rf /var/cache/yum && \
# force remove 'rocm-llvm' from runtime, saves 3.6 GB on disk
rpm -e --nodeps rocm-llvm && \
# remove gfx files for unused ISAs, saves about 1.7 GB on disk
# sed creates regular expression '.*\(gfx900\|gfx906\|...\).*'
find /opt/rocm/lib/ -type f \
-and -name '*gfx*' \
-and -not -regex '.*\('$(echo $AMDGPU_TARGETS | sed -e 's/;/\\|/g' -e 's/:xnack[-+]//g')'\).*' \
-print0 | xargs -0 rm -v

# Restore notebook user workspace
USER 1001
Expand Down

0 comments on commit 07d48b1

Please sign in to comment.