Skip to content

Commit 0c0fe34

Browse files
committed
Add rocm63 container
1 parent 341c6b2 commit 0c0fe34

File tree

2 files changed

+141
-0
lines changed

2 files changed

+141
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
################################################################################
2+
FROM ubuntu:20.04
3+
################################################################################
4+
5+
ARG GPU_DEVICE_TARGETS="gfx90a gfx942"
6+
ENV GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS}
7+
8+
# Install build dependencies
9+
COPY setup.packages.sh setup.packages.sh
10+
COPY builder.packages.txt builder.packages.txt
11+
RUN /setup.packages.sh /builder.packages.txt
12+
13+
# Install ROCM
14+
ARG ROCM_VERSION=6.2.0
15+
ARG CUSTOM_INSTALL
16+
ARG ROCM_PATH=/opt/rocm-${ROCM_VERSION}
17+
ENV ROCM_PATH=${ROCM_PATH}
18+
COPY ${CUSTOM_INSTALL} /${CUSTOM_INSTALL}
19+
COPY setup.rocm.sh /setup.rocm.sh
20+
COPY devel.packages.rocm.txt /devel.packages.rocm.txt
21+
RUN /setup.rocm63.sh 6.3.0-14901
22+
23+
# Install various tools.
24+
# - bats: bash unit testing framework
25+
# - bazelisk: always use the correct bazel version
26+
# - buildifier: clean bazel build deps
27+
# - buildozer: clean bazel build deps
28+
# - gcloud SDK: communicate with Google Cloud Platform (GCP) for RBE, CI
29+
RUN git clone --branch v1.7.0 https://github.com/bats-core/bats-core.git && bats-core/install.sh /usr/local && rm -rf bats-core
30+
RUN wget https://github.com/bazelbuild/bazelisk/releases/download/v1.11.0/bazelisk-linux-amd64 -O /usr/local/bin/bazel && chmod +x /usr/local/bin/bazel
31+
RUN wget https://github.com/bazelbuild/buildtools/releases/download/3.5.0/buildifier -O /usr/local/bin/buildifier && chmod +x /usr/local/bin/buildifier
32+
RUN wget https://github.com/bazelbuild/buildtools/releases/download/3.5.0/buildozer -O /usr/local/bin/buildozer && chmod +x /usr/local/bin/buildozer
33+
RUN curl -sSL https://sdk.cloud.google.com > /tmp/gcloud && bash /tmp/gcloud --install-dir=~/usr/local/bin --disable-prompts
34+
35+
36+
# All lines past this point are reset when $CACHEBUSTER is set. We need this
37+
# for Python specifically because we install some nightly packages which are
38+
# likely to change daily.
39+
ARG CACHEBUSTER=0
40+
RUN echo $CACHEBUSTER
41+
42+
# Setup Python environment. PYTHON_VERSION is e.g. "python3.8"
43+
ARG PYTHON_VERSION
44+
COPY setup.python.sh /setup.python.sh
45+
COPY devel.requirements.txt /devel.requirements.txt
46+
RUN /setup.python.sh $PYTHON_VERSION devel.requirements.txt
47+
48+
ARG TF_WHEEL_URL
49+
RUN if [ -n "${TF_WHEEL_URL}" ]; then pip install "${TF_WHEEL_URL}"; fi
50+
ARG DWLD_TF_SRC_CMD
51+
RUN if [ -n "${DWLD_TF_SRC_CMD}" ]; then eval "${DWLD_TF_SRC_CMD}"; fi
52+
53+
# Setup build and environment
54+
COPY devel.usertools /usertools
55+
COPY devel.bashrc /root/.bashrc
56+
57+
# Setup ENV variables for tensorflow pip build
58+
ENV TF_NEED_ROCM=1
59+
ENV TF_ROCM_GCC=1
60+
ENV ROCM_TOOLKIT_PATH=${ROCM_PATH}
61+
62+
# Don't use the bazel cache when a new docker image is created.
63+
RUN echo build --action_env=DOCKER_CACHEBUSTER=$(date +%s%N)$RANDOM >> /etc/bazel.bazelrc
64+
RUN echo build --host_action_env=DOCKER_HOST_CACHEBUSTER=$(date +%s%N)$RANDOM >> /etc/bazel.bazelrc
65+
66+
ARG TF_TESTING_FL
67+
ENV TF_TESTING_FL=${TF_TESTING_FL}
68+
ARG CLONE_TEST_REPO
69+
COPY ${CLONE_TEST_REPO} /${CLONE_TEST_REPO}
70+
RUN if [ -n "${CLONE_TEST_REPO}" ]; then bash /${CLONE_TEST_REPO}; fi
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
# ==============================================================================
17+
#
18+
# setup.rocm.sh: Prepare the ROCM installation on the container.
19+
# Usage: setup.rocm.sh <ROCM_VERSION>
20+
set -x
21+
22+
# Add the ROCm package repo location
23+
ROCM_VERSION=$1 # e.g. 5.2.0
24+
ROCM_PATH=${ROCM_PATH:-/opt/rocm-${ROCM_VERSION}}
25+
ROCM_DEB_REPO_HOME=https://repo.radeon.com/rocm/apt/
26+
AMDGPU_DEB_REPO_HOME=https://repo.radeon.com/amdgpu/
27+
ROCM_BUILD_NAME=ubuntu
28+
ROCM_BUILD_NUM=main
29+
30+
# Adjust the ROCM repo location
31+
# Intial release don't have the trialing '.0'
32+
# For example ROCM 5.4.0 is at https://repo.radeon.com/rocm/apt/5.4/
33+
if [ ${ROCM_VERSION##*[^0-9]} -eq '0' ]; then
34+
ROCM_VERS=${ROCM_VERSION%.*}
35+
else
36+
ROCM_VERS=$ROCM_VERSION
37+
fi
38+
ROCM_DEB_REPO=${ROCM_DEB_REPO_HOME}${ROCM_VERS}/
39+
AMDGPU_DEB_REPO=${AMDGPU_DEB_REPO_HOME}${ROCM_VERS}/
40+
41+
# Add rocm repository
42+
chmod 1777 /tmp
43+
apt-get --allow-unauthenticated update && apt install -y wget software-properties-common
44+
apt-get clean all
45+
curl -fsSL https://compute-cdn.amd.com/artifactory/list/rocm-osdb-20.04-deb/dists/compute-rocm-dkms-no-npi-hipclang/Release.gpg | gpg --dearmor | apt-key add -
46+
echo "deb [arch=amd64 Signed-By=/etc/apt/trusted.gpg.d/rocm-internal.gpg] https://compute-cdn.amd.com/artifactory/list/rocm-osdb-20.04-deb compute-rocm-dkms-no-npi-hipclang 14901" > /etc/apt/sources.list.d/rocm.list
47+
wget http://artifactory-cdn.amd.com/artifactory/list/amdgpu-deb/amd-nonfree-radeon_20.04-1_all.deb
48+
apt install -y ./amd-nonfree-radeon_20.04-1_all.deb
49+
50+
GPU_DEVICE_TARGETS=${GPU_DEVICE_TARGETS:-"gfx90a gfx942"}
51+
52+
echo $ROCM_VERSION
53+
echo $ROCM_REPO
54+
echo $ROCM_PATH
55+
echo $GPU_DEVICE_TARGETS
56+
57+
# install rocm
58+
/setup.packages.sh /devel.packages.rocm.txt
59+
60+
apt-get update --allow-insecure-repositories
61+
MIOPENKERNELS=$( \
62+
apt-cache search --names-only miopen-hip-gfx | \
63+
awk '{print $1}' | \
64+
grep -F -v . || \
65+
true )
66+
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated ${MIOPENKERNELS}
67+
68+
# Ensure the ROCm target list is set up
69+
ls -l /opt
70+
printf '%s\n' ${GPU_DEVICE_TARGETS} | tee -a "$ROCM_PATH/bin/target.lst"
71+
touch "${ROCM_PATH}/.info/version"

0 commit comments

Comments
 (0)