blob: e9974b05b3cab8ee637004c8a5ac6a50eb2cbec6 [file] [log] [blame]
# Dockerfile for ROCm RBE builds.
#
# To push a new version, run:
# $ docker build -f Dockerfile.local-toolchain-ubuntu18.04-manylinux2010 \
# --tag "local-toolchain-ubuntu18.04-manylinux2010" .
# $ docker build -f Dockerfile.rbe.rocm-ubuntu18.04-manylinux2010-multipython \
# --tag "gcr.io/tensorflow-testing/nosla-rocm-ubuntu18.04-manylinux2010-multipython" .
# $ docker push gcr.io/tensorflow-testing/nosla-rocm-ubuntu18.04-manylinux2010-multipython
FROM ubuntu:18.04
COPY --from=local-toolchain-ubuntu18.04-manylinux2010 /dt7 /dt7
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.0/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \
&& apt-get update && apt-get install -y --no-install-recommends \
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:
# - bsdmainutils (hexdump) for MLIR generated GPU kernels
# - dependencies to build Python from source
# - patchelf, as it is required by auditwheel
RUN apt-get update && apt-get install -y \
bsdmainutils \
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"
COPY install/install_pip_packages_by_version.sh /install/
RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.7"
RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.8"
RUN /install/install_pip_packages_by_version.sh "/usr/local/bin/pip3.9"
ENV CLANG_VERSION="r42cab985fd95ba4f3f290e7bb26b93805edb447d"
COPY install/install_latest_clang.sh /install/
RUN /install/install_latest_clang.sh