Fixing ROCm remote config repo.

Adding ROCm dockerfile for RBE.
This is in preparation for testing ROCm builds.

PiperOrigin-RevId: 255163717
This commit is contained in:
A. Unique TensorFlower 2019-06-26 04:50:08 -07:00 committed by TensorFlower Gardener
parent a6989c95e3
commit 5677a06169
2 changed files with 111 additions and 12 deletions

View File

@ -0,0 +1,93 @@
# $ docker build -f Dockerfile.rbe.rocm-ubuntu16.04 \
# --tag "gcr.io/tensorflow-testing/nosla-rocm-ubuntu16.04" .
# $ docker push gcr.io/tensorflow-testing/nosla-rocm-ubuntu16.04
FROM launcher.gcr.io/google/rbe-ubuntu16-04:r327695
MAINTAINER Jeff Poznanovic <jeffrey.poznanovic@amd.com>
ARG DEB_ROCM_REPO=http://repo.radeon.com/rocm/apt/debian/
ARG ROCM_PATH=/opt/rocm
ENV DEBIAN_FRONTEND noninteractive
ENV TF_NEED_ROCM 1
ENV HOME /root/
RUN apt update && apt install -y wget software-properties-common
# Add rocm repository
RUN apt-get clean all
RUN wget -qO - $DEB_ROCM_REPO/rocm.gpg.key | apt-key add -
RUN sh -c "echo deb [arch=amd64] $DEB_ROCM_REPO xenial main > /etc/apt/sources.list.d/rocm.list"
# Install misc pkgs
RUN apt-get update --allow-insecure-repositories && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
clang-3.8 \
clang-format-3.8 \
clang-tidy-3.8 \
cmake \
cmake-qt-gui \
ssh \
curl \
apt-utils \
pkg-config \
g++-multilib \
git \
libunwind-dev \
libfftw3-dev \
libelf-dev \
libncurses5-dev \
libpthread-stubs0-dev \
vim \
gfortran \
libboost-program-options-dev \
libssl-dev \
libboost-dev \
libboost-system-dev \
libboost-filesystem-dev \
rpm \
libnuma-dev \
pciutils \
virtualenv \
python-pip \
python3-pip \
libxml2 \
libxml2-dev \
wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install rocm pkgs
RUN apt-get update --allow-insecure-repositories && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
rocm-dev rocm-libs rocm-utils rocm-cmake \
rocfft miopen-hip miopengemm rocblas hipblas rocrand \
rocm-profiler cxlactivitylogger && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
ENV HCC_HOME=$ROCM_PATH/hcc
ENV HIP_PATH=$ROCM_PATH/hip
ENV OPENCL_ROOT=$ROCM_PATH/opencl
ENV PATH="$HCC_HOME/bin:$HIP_PATH/bin:${PATH}"
ENV PATH="$ROCM_PATH/bin:${PATH}"
ENV PATH="$OPENCL_ROOT/bin:${PATH}"
# Add target file to help determine which device(s) to build for
RUN bash -c 'echo -e "gfx803\ngfx900\ngfx906" >> /opt/rocm/bin/target.lst'
# Copy and run the install scripts.
COPY install/*.sh /install/
ARG DEBIAN_FRONTEND=noninteractive
RUN /install/install_bootstrap_deb_packages.sh
RUN add-apt-repository -y ppa:openjdk-r/ppa && \
add-apt-repository -y ppa:george-edison55/cmake-3.x
RUN /install/install_deb_packages.sh
RUN /install/install_pip_packages.sh
RUN /install/install_bazel.sh
RUN /install/install_golang.sh
# Set up the master bazelrc configuration file.
COPY install/.bazelrc /etc/bazel.bazelrc
# Configure the build for our CUDA configuration.
ENV TF_NEED_ROCM 1

View File

@ -772,7 +772,7 @@ def _create_local_rocm_repository(repository_ctx):
"-DTENSORFLOW_COMPILER_IS_HIP_CLANG=1",
]))
rocm_defines["%{host_compiler_path}"] = "clang/bin/crosstool_wrapper_driver_rocm"
rocm_defines["%{host_compiler_path}"] = "clang/bin/crosstool_wrapper_driver_is_not_gcc"
# # Enable a few more warnings that aren't part of -Wall.
# compiler_flag: "-Wunused-but-set-parameter"
@ -785,7 +785,7 @@ def _create_local_rocm_repository(repository_ctx):
rocm_defines["%{cxx_builtin_include_directories}"] = to_list_of_strings(host_compiler_includes +
_rocm_include_path(repository_ctx, rocm_config))
rocm_defines["%{linker_files}"] = "clang/bin/crosstool_wrapper_driver_rocm"
rocm_defines["%{linker_files}"] = "clang/bin/crosstool_wrapper_driver_is_not_gcc"
rocm_defines["%{win_linker_files}"] = ":empty"
@ -825,6 +825,7 @@ def _create_local_rocm_repository(repository_ctx):
["\"%s\"" % c for c in rocm_config.amdgpu_targets],
),
},
out = "crosstool/clang/bin/crosstool_wrapper_driver_is_not_gcc",
)
# Set up rocm_config.h, which is used by
@ -849,21 +850,26 @@ def _create_remote_rocm_repository(repository_ctx, remote_config_repo):
{
"%{rocm_is_configured}": "True",
"%{rocm_extra_copts}": _compute_rocm_extra_copts(
repository_ctx, #_compute_capabilities(repository_ctx)
repository_ctx,
[], #_compute_capabilities(repository_ctx)
),
},
)
_tpl(
repository_ctx,
"rocm:remote.BUILD",
{
"%{remote_rocm_repo}": remote_config_repo,
},
repository_ctx.template(
"rocm/BUILD",
Label(remote_config_repo + "/rocm:BUILD"),
{},
)
repository_ctx.template(
"rocm/build_defs.bzl",
Label(remote_config_repo + "/rocm:build_defs.bzl"),
{},
)
repository_ctx.template(
"rocm/rocm/rocm_config.h",
Label(remote_config_repo + "/rocm:rocm/rocm_config.h"),
{},
)
_tpl(repository_ctx, "crosstool:remote.BUILD", {
"%{remote_rocm_repo}": remote_config_repo,
}, "crosstool/BUILD")
def _rocm_autoconf_impl(repository_ctx):
"""Implementation of the rocm_autoconf repository rule."""