| # Dockerfile for ROCm RBE builds. |
| # |
| # To push a new version, run: |
| # $ docker build -f Dockerfile.local-toolchain-ubuntu20.04-manylinux2014 \ |
| # --tag "local-toolchain-ubuntu20.04-manylinux2014" . |
| # $ docker build -f Dockerfile.rbe.rocm-ubuntu20.04-manylinux2014-multipython \ |
| # --tag "gcr.io/tensorflow-testing/nosla-rocm-ubuntu20.04-manylinux2014-multipython" . |
| # $ docker push gcr.io/tensorflow-testing/nosla-rocm-ubuntu20.04-manylinux2014-multipython |
| |
| FROM ubuntu:20.04 |
| COPY --from=local-toolchain-ubuntu20.04-manylinux2014 /dt7 /dt7 |
| COPY --from=local-toolchain-ubuntu20.04-manylinux2014 /dt9 /dt9 |
| |
| ARG DEBIAN_FRONTEND=noninteractive |
| |
| # Install ROCm packages |
| RUN apt-get update && apt-get install -y --no-install-recommends \ |
| curl libnuma-dev gnupg sudo libelf1 build-essential \ |
| && curl -k -sL https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - \ |
| && printf "deb [arch=amd64] http://repo.radeon.com/rocm/apt/5.3/ ubuntu main" \ |
| | tee /etc/apt/sources.list.d/rocm.list \ |
| && apt-get update && apt-get install -y \ |
| rocm-dev rocm-libs rccl \ |
| && apt-get clean && rm -rf /var/lib/apt/lists/* |
| |
| # Set ROCm environment variables and paths. |
| # We use /opt/rocm without version suffix so that the toolchain configuration |
| # for builtin headers doesn't need to be adapted |
| ARG ROCM_PATH=/opt/rocm |
| ENV HCC_HOME=$ROCM_PATH/hcc |
| ENV HIP_PATH=$ROCM_PATH/hip |
| ENV OPENCL_ROOT=$ROCM_PATH/opencl |
| ENV PATH="$ROCM_PATH/bin:${PATH}" |
| ENV PATH="$HCC_HOME/bin:$HIP_PATH/bin:${PATH}" |
| ENV PATH="$OPENCL_ROOT/bin:${PATH}" |
| |
| # Set target file to help determine which device(s) to build for |
| RUN bash -c "ls -al /opt/roc*" |
| RUN bash -c "echo -e 'gfx900\ngfx906\ngfx908' > $ROCM_PATH/bin/target.lst" |
| |
| # Copy and run the install scripts. |
| COPY install/install_bootstrap_deb_packages.sh /install/ |
| RUN /install/install_bootstrap_deb_packages.sh |
| |
| COPY install/install_deb_packages.sh /install/ |
| RUN /install/install_deb_packages.sh |
| |
| # Install additional packages needed for this image: |
| # - dependencies to build Python from source |
| # - patchelf, as it is required by auditwheel |
| RUN apt-get update && apt-get install -y \ |
| libbz2-dev \ |
| libffi-dev \ |
| libgdbm-dev \ |
| libncurses5-dev \ |
| libnss3-dev \ |
| libreadline-dev \ |
| patchelf \ |
| && \ |
| rm -rf /var/lib/apt/lists/* |
| |
| # Install openjdk 11 |
| RUN yes "" | add-apt-repository ppa:openjdk-r/ppa |
| RUN apt-get update && apt-get install -y openjdk-11-jdk && \ |
| update-alternatives --auto java |
| |
| COPY install/install_bazel.sh /install/ |
| RUN /install/install_bazel.sh |
| |
| COPY install/build_and_install_python.sh /install/ |
| RUN /install/build_and_install_python.sh "3.7.7" |
| RUN /install/build_and_install_python.sh "3.8.2" |
| RUN /install/build_and_install_python.sh "3.9.4" |
| RUN /install/build_and_install_python.sh "3.10.0" |
| RUN /install/build_and_install_python.sh "3.11.0" |
| |
| COPY install/install_pip_packages_by_version.sh /install/ |
| RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.7" "nojax" |
| RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.8" "nojax" |
| RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.9" "nojax" |
| RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.10" "nojax" |
| RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.11" "nojax" |
| |
| ENV CLANG_VERSION="rf2b94bd7eaa83d853dc7568fac87b1f8bf4ddec6" |
| COPY install/install_latest_clang.sh /install/ |
| RUN /install/install_latest_clang.sh |