From 07d48b11b3ca36cf52e6ef698a15ff5fe9013fc6 Mon Sep 17 00:00:00 2001 From: Jiri Danek Date: Wed, 31 Jul 2024 18:06:19 +0200 Subject: [PATCH] RHOAIENG-9853: fix(rocm): remove more files that instructlab also removes 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 --- rocm/ubi9-python-3.9/Dockerfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rocm/ubi9-python-3.9/Dockerfile b/rocm/ubi9-python-3.9/Dockerfile index 82dbc9e8d..6574a821e 100644 --- a/rocm/ubi9-python-3.9/Dockerfile +++ b/rocm/ubi9-python-3.9/Dockerfile @@ -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 @@ -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