diff --git a/base.dockerfile b/base.dockerfile index 854d047..9491726 100644 --- a/base.dockerfile +++ b/base.dockerfile @@ -1,16 +1,37 @@ -FROM ubuntu:22.04 -ARG ROCM_VERSION="5.7.1" +# > base stage +# Uses official ROCm packages +FROM ubuntu:22.04 AS base +ARG ROCM_VERSION="5.7.3" ARG ROCM_APT_CODE_NAME="jammy" ARG ROCBLAS_BRANCH="release/rocm-rel-5.7" +# gfx803 as single target may cause error +ARG ROCBLAS_ARCH="gfx803;gfx900" ARG DEBIAN_FRONTEND="noninteractive" # Install essentials -RUN < /etc/sudoers.d/sudo-nopasswd @@ -52,3 +60,32 @@ ENV PATH="${PATH}:/opt/rocm/bin" # Default to login shell CMD [ "bash", "-l" ] + +# > patched stage +# Uses patched rocblas and rocblas-dev +# (Others are official ROCm packages) +FROM base AS patched + +# Compile and install patched rocBLAS +USER root +WORKDIR /root +RUN git clone -b ${ROCBLAS_BRANCH} https://github.com/ROCmSoftwarePlatform/rocBLAS.git +WORKDIR /root/rocBLAS +RUN rm -rf library/src/blas3/Tensile/Logic/asm_full/r9nano/ +RUN sed -i -e 's/rmake.py --install/rmake.py -a="${ROCBLAS_ARCH}" --install/g' install.sh +RUN ./install.sh -d --cmake_install +WORKDIR /root/rocBLAS/build/release +COPY fix-rocblas.sh . +RUN </dev/null | grep Version | cut -d " " -f2 | tr -d '\n' +} + +get_filename() { + ls -l $1 | awk '{print $9}' | head -n1 | tr -d '\n' +} + +PKGS=("rocblas" "rocblas-dev") +for PKG in "${PKGS[@]}"; do + DIR="${PKG}-deb" + TARGET_VER=$(get_version $PKG) + FILENAME=$(get_filename "${PKG}_*.deb") + mkdir -p $DIR + rm -rf ${DIR}/* + dpkg-deb -R $FILENAME $DIR + sed -i "s/^Version: .*/Version: ${TARGET_VER}/" ${DIR}/DEBIAN/control + chmod 755 ${DIR}/DEBIAN/postinst + chmod 755 ${DIR}/DEBIAN/prerm + OUT_NAME="${PKG}_${TARGET_VER}_amd64.deb" + dpkg-deb -b $DIR $OUT_NAME + dpkg -i $OUT_NAME +done