1# Dockerfile for ROCm RBE builds. 2# 3# To push a new version, run: 4# $ docker build -f Dockerfile.local-toolchain-ubuntu18.04-manylinux2010 \ 5# --tag "local-toolchain-ubuntu18.04-manylinux2010" . 6# $ docker build -f Dockerfile.rbe.rocm-ubuntu18.04-manylinux2010-multipython \ 7# --tag "gcr.io/tensorflow-testing/nosla-rocm-ubuntu18.04-manylinux2010-multipython" . 8# $ docker push gcr.io/tensorflow-testing/nosla-rocm-ubuntu18.04-manylinux2010-multipython 9 10FROM ubuntu:18.04 11COPY --from=local-toolchain-ubuntu18.04-manylinux2010 /dt7 /dt7 12 13ARG DEBIAN_FRONTEND=noninteractive 14 15# Install ROCm packages 16RUN apt-get update && apt-get install -y --no-install-recommends \ 17 curl libnuma-dev gnupg sudo libelf1 build-essential \ 18 && curl -k -sL https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - \ 19 && printf "deb [arch=amd64] http://repo.radeon.com/rocm/apt/5.0/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \ 20 && apt-get update && apt-get install -y --no-install-recommends \ 21 rocm-dev rocm-libs rccl \ 22 && apt-get clean && rm -rf /var/lib/apt/lists/* 23 24# Set ROCm environment variables and paths. 25# We use /opt/rocm without version suffix so that the toolchain configuration 26# for builtin headers doesn't need to be adapted 27ARG ROCM_PATH=/opt/rocm 28ENV HCC_HOME=$ROCM_PATH/hcc 29ENV HIP_PATH=$ROCM_PATH/hip 30ENV OPENCL_ROOT=$ROCM_PATH/opencl 31ENV PATH="$ROCM_PATH/bin:${PATH}" 32ENV PATH="$HCC_HOME/bin:$HIP_PATH/bin:${PATH}" 33ENV PATH="$OPENCL_ROOT/bin:${PATH}" 34 35# Set target file to help determine which device(s) to build for 36RUN bash -c "ls -al /opt/roc*" 37RUN bash -c "echo -e 'gfx900\ngfx906\ngfx908' > $ROCM_PATH/bin/target.lst" 38 39# Copy and run the install scripts. 40COPY install/install_bootstrap_deb_packages.sh /install/ 41RUN /install/install_bootstrap_deb_packages.sh 42 43COPY install/install_deb_packages.sh /install/ 44RUN /install/install_deb_packages.sh 45 46# Install additional packages needed for this image: 47# - bsdmainutils (hexdump) for MLIR generated GPU kernels 48# - dependencies to build Python from source 49# - patchelf, as it is required by auditwheel 50RUN apt-get update && apt-get install -y \ 51 bsdmainutils \ 52 libbz2-dev \ 53 libffi-dev \ 54 libgdbm-dev \ 55 libncurses5-dev \ 56 libnss3-dev \ 57 libreadline-dev \ 58 patchelf \ 59 && \ 60 rm -rf /var/lib/apt/lists/* 61 62# Install openjdk 11 63RUN yes "" | add-apt-repository ppa:openjdk-r/ppa 64RUN apt-get update && apt-get install -y openjdk-11-jdk && \ 65 update-alternatives --auto java 66 67COPY install/install_bazel.sh /install/ 68RUN /install/install_bazel.sh 69 70COPY install/build_and_install_python.sh /install/ 71RUN /install/build_and_install_python.sh "3.7.7" 72RUN /install/build_and_install_python.sh "3.8.2" 73RUN /install/build_and_install_python.sh "3.9.4" 74 75COPY install/install_pip_packages_by_version.sh /install/ 76RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.7" 77RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.8" 78RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.9" 79 80ENV CLANG_VERSION="r42cab985fd95ba4f3f290e7bb26b93805edb447d" 81COPY install/install_latest_clang.sh /install/ 82RUN /install/install_latest_clang.sh 83