update the Dockerfile to build with ROCm4.2; remove obsoleted hcc scripts

This commit is contained in:
sunway513
2021-05-12 15:19:35 +00:00
parent f8499ed75e
commit f01f263f35
11 changed files with 12 additions and 252 deletions

View File

@@ -1,7 +1,7 @@
FROM centos:7
LABEL maintainer=peng.sun@amd.com
ARG ROCM_VERSION=4.1.1
ARG ROCM_VERSION=4.2
# Base
RUN yum -y install git java-1.8.0-openjdk python; yum clean all

View File

@@ -1,7 +1,7 @@
FROM centos:7
LABEL maintainer=peng.sun@amd.com
ARG ROCM_VERSION=4.1.1
ARG ROCM_VERSION=4.2
# Base
RUN yum -y install git java-1.8.0-openjdk python; yum clean all

View File

@@ -5,10 +5,10 @@ FROM ubuntu:18.04
LABEL maintainer=peng.sun@amd.com
# Register the ROCM package repository, and install rocm-dev package
ARG ROCM_VERSION=4.1.1
ARG ROCM_VERSION=4.2
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl libnuma-dev gnupg \
&& curl -sL https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ xenial main" | tee /etc/apt/sources.list.d/rocm.list \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
libelf1 \

View File

@@ -5,10 +5,10 @@ FROM ubuntu:18.04
LABEL maintainer=peng.sun@amd.com
# Register the ROCM package repository, and install rocm-dev package
ARG ROCM_VERSION=4.1.1
ARG ROCM_VERSION=4.2
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl libnuma-dev gnupg \
&& curl -sL https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ xenial main" | tee /etc/apt/sources.list.d/rocm.list \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
libelf1 \

View File

@@ -5,10 +5,10 @@ FROM ubuntu:20.04
LABEL maintainer=peng.sun@amd.com
# Register the ROCM package repository, and install rocm-dev package
ARG ROCM_VERSION=4.1.1
ARG ROCM_VERSION=4.2
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl libnuma-dev gnupg \
&& curl -sL https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ xenial main" | tee /etc/apt/sources.list.d/rocm.list \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
libelf1 \

View File

@@ -5,10 +5,10 @@ FROM ubuntu:20.04
LABEL maintainer=peng.sun@amd.com
# Register the ROCM package repository, and install rocm-dev package
ARG ROCM_VERSION=4.1.1
ARG ROCM_VERSION=4.2
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl libnuma-dev gnupg \
&& curl -sL https://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ xenial main" | tee /etc/apt/sources.list.d/rocm.list \
&& printf "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
libelf1 \

View File

@@ -1,15 +0,0 @@
# Build this dockerfile with `docker build -f hcc-lc-release-dockerfile -t roc/hcc .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the hcc compiler, and depends on an already existing rocr-runtime to be found
FROM ${rocr_name}
MAINTAINER Kent Knox <kent.knox@amd>
# Following assumes that the apt-get update is already set up to pull from repo.radeon.com in base image
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
hsa-ext-rocr-dev \
hcc_hsail && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

View File

@@ -1,61 +0,0 @@
# Build this dockerfile with `docker build -f hcc-release-dockerfile -t roc/hcc .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the hcc compiler, and depends on an already existing rocr-runtime to be found
# ubuntu:14.04.3, the native kernel is '3.19'
FROM ${rocr_name}
MAINTAINER Kent Knox <kent.knox@amd>
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Install dependencies required to build hcc
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
python \
libstdc++-4.8-dev \
libdwarf-dev \
libelf-dev \
libtinfo-dev \
libc6-dev-i386 \
gcc-multilib \
llvm-dev \
llvm-runtime \
libc++-dev \
libc++abi-dev \
re2c \
libncurses5-dev \
cmake \
git \
wget \
subversion && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HCC_BUILD_PATH=/usr/local/src/hcc-hsail
ENV PATH ${PATH}:${hcc_hsail_volume}/bin
# Build hcc, install to /usr/local
RUN mkdir -p ${HCC_BUILD_PATH} && \
cd ${HCC_BUILD_PATH} && \
git clone --depth=1 --branch=${repo_branch_hcc_hsail} https://github.com/RadeonOpenCompute/hcc.git ./ && \
mkdir -p build && \
cd build && \
ln -sr ${rocr_volume}/include ${rocr_volume}/include/hsa && \
cmake \
-DCMAKE_INSTALL_PREFIX=${hcc_hsail_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DROCM_ROOT=${rocr_volume} \
-DHSA_KMT_LIBRARY_DIR=${roct_volume}${lib64_install_dir} \
.. && \
make -j $(nproc) world && \
make install && \
git log -n 3 > ${hcc_hsail_volume}/git-stamp.log && \
${hcc_hsail_cleanup} \
echo "${hcc_hsail_volume}/lib" >> /etc/ld.so.conf.d/hcc.conf && \
ldconfig

View File

@@ -1,150 +0,0 @@
# Build this dockerfile with `docker build -f hcc-lc-release-dockerfile -t roc/hcc .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the hcc compiler, and depends on an already existing rocr-runtime to be found
FROM ${rocr_image_name_src}
MAINTAINER Kent Knox <kent.knox@amd>
# Install dependencies required to build hcc
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
build-essential \
git \
software-properties-common \
curl \
wget \
python \
rpm \
g++-multilib \
libncurses5-dev \
libelf-dev \
libc++abi-dev \
libc++-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Explicitely install a newer version of git, a minimum of 2.10.0, so we benefit from --shallow-submodules flag
#RUN add-apt-repository ppa:git-core/ppa && \
# apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
# git && \
# apt-get clean && \
# rm -rf /var/lib/apt/lists/*
# These are all extra packages needed to build cmake with --system-libs
# zlib1g-dev \
# libcurl4-openssl-dev \
# lzma-dev \
# libbz2-dev \
# libarchive-dev \
# lib64expat1-dev \
# libjsoncpp-dev \
# Download and install an up to date version of cmake, because compiling
# LLVM has implemented a requirement of cmake v3.4.4 or greater
ENV CMAKE_VER_MAJOR 3.7
ENV CMAKE_VER_MINOR ${CMAKE_VER_MAJOR}.1
ENV CMAKE_PREFIX /opt/cmake
# This installs the new cmake side-by-side with the old cmake using update-alternatives
RUN cd /usr/local/src && \
curl -L https://cmake.org/files/v${CMAKE_VER_MAJOR}/cmake-${CMAKE_VER_MINOR}.tar.gz -o cmake-${CMAKE_VER_MINOR}.tar.gz && \
tar -xf cmake-${CMAKE_VER_MINOR}.tar.gz && \
cd cmake-${CMAKE_VER_MINOR} && \
# ./bootstrap --prefix=${CMAKE_PREFIX} --system-libs && \
./bootstrap --prefix=${CMAKE_PREFIX} && \
make -j $(nproc) && \
make install && \
cd .. && rm -rf cmake-${CMAKE_VER_MINOR} && \
update-alternatives --install /usr/local/bin/cmake cmake ${CMAKE_PREFIX}/bin/cmake 80 --slave /usr/local/bin/ccmake ccmake ${CMAKE_PREFIX}/bin/ccmake --slave /usr/local/bin/cpack cpack ${CMAKE_PREFIX}/bin/cpack --slave /usr/local/bin/ctest ctest ${CMAKE_PREFIX}/bin/ctest --slave /usr/local/share/cmake-${CMAKE_VER_MAJOR} share-cmake-${CMAKE_VER_MAJOR} ${CMAKE_PREFIX}/share/cmake-${CMAKE_VER_MAJOR} # --slave /usr/local/bin/cmake-gui cmake-gui ${CMAKE_PREFIX}/bin/cmake-gui
# App specific environment variables; modify path to add hcc and repo commands
ENV HCC_BUILD_PATH=/usr/local/src/hcc-lc
# While working out build issues, it usually pays off to seperate the following build steps into multiple build statements
# to save time having to build each build component, if rebuilding the image multiple times
# It will result in about double the image size, and the final dockerfile should always build the compiler in 1 run statement
# Compiling hcc-lc requires a custom build tool
RUN mkdir -p ~/bin && \
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && \
chmod a+x ~/bin/repo
# Temporary libc++ fix for ubuntu 16.04 compilations
RUN curl -L http://ftp.us.debian.org/debian/pool/main/libc/libc++/libc++-dev_3.9.1-2_amd64.deb -o /tmp/libc++-dev_3.9.1-2_amd64.deb && \
curl -L http://ftp.us.debian.org/debian/pool/main/libc/libc++/libc++1_3.9.1-2_amd64.deb -o /tmp/libc++1_3.9.1-2_amd64.deb && \
dpkg -i /tmp/libc++1_3.9.1-2_amd64.deb && rm /tmp/libc++1_3.9.1-2_amd64.deb && \
dpkg -i /tmp/libc++-dev_3.9.1-2_amd64.deb && rm /tmp/libc++-dev_3.9.1-2_amd64.deb
# This is a long series of build steps, all listed under one RUN statement to keep image size down
# Build hcc-lc, install to /opt/rocm
RUN mkdir -p ${HCC_BUILD_PATH} && \
cd ${HCC_BUILD_PATH} && \
~/bin/repo init --depth=1 -u https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA.git -b ${tag} && \
~/bin/repo sync && \
# build amd-common LLVM/LLD/Clang
cd ${HCC_BUILD_PATH}/llvm && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" \
-DLLVM_APPEND_VC_REV=ON .. && \
make -j $(nproc) && \
# build ROCm-Device-Libs with amd-common Clang
cd ${HCC_BUILD_PATH}/ocml/ && \
mkdir -p build && \
cd build && \
CC=${HCC_BUILD_PATH}/llvm/build/bin/clang cmake \
-DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DAMDHSACOD=/opt/rocm/bin/amdhsacod \
-DLLVM_DIR="${HCC_BUILD_PATH}/llvm/build" \
.. && \
# make -j $(nproc) install && \
make -j $(nproc) package && \
dpkg -i rocm-device-libs-*.deb && \
# build HCC with ROCm-Device-Libs
# this deletes the code synced from repo, and uses git clone --recursive to get all dependent modules
cd ${HCC_BUILD_PATH} && \
rm -rf hcc && \
# git clone --recursive --depth 1 --shallow-submodules -b ${tag} https://github.com/RadeonOpenCompute/hcc.git && \
git clone --recursive --depth 1 -b ${tag} https://github.com/RadeonOpenCompute/hcc.git && \
cd hcc && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DHSA_AMDGPU_GPU_TARGET="gfx701;gfx803" \
.. && \
make -j $(nproc) && \
# make install && \
make package && \
dpkg -i hcc-*.deb && \
git log -n 3 > ${hcc_lc_volume}/git-stamp.log && \
# ln -sr ${hcc_lc_volume} ${rocm_volume}/hcc && \
# ln -sr ${hcc_lc_volume}/include/ ${rocm_volume}/include/hcc && \
# ln -sr ${hcc_lc_volume}bin/hcc ${rocm_volume}bin/hcc && \
# ln -sr ${hcc_lc_volume}bin/hcc-config ${rocm_volume}bin/hcc-config && \
${hcc_lc_cleanup}
# echo "${hcc_lc_volume}lib" >> /etc/ld.so.conf.d/hcc-lc.conf && \
# ldconfig
# The following downloads and builds the latest HiP using this new compiler
# Build hip, install to /opt/rocm
RUN mkdir -p /usr/local/src && cd /usr/local/src && \
git clone --depth 1 -b developer-preview https://github.com/GPUOpen-ProfessionalCompute-Tools/HIP.git && \
mkdir -p hip-build && cd hip-build && \
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-DDISABLE_COPY_EXT=1 ../HIP && \
make install && \
ln -sr ${rocm_volume}hip/bin/hipcc ${rocm_volume}bin/hipcc && \
ln -sr ${rocm_volume}hip/bin/hipconfig ${rocm_volume}bin/hipconfig && \
ln -sr ${rocm_volume}hip/bin/hipify ${rocm_volume}bin/hipify && \
cd .. && rm -rf hip-build && rm -rf HIP
ENV PATH=${PATH}:${rocm_volume}bin

View File

@@ -1,14 +0,0 @@
# Build this dockerfile with `docker build -f hcc-lc-release-dockerfile -t roc/hcc .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the hcc compiler, and depends on an already existing rocr-runtime to be found
FROM ${rocr_image_name_deb}
MAINTAINER Kent Knox <kent.knox@amd>
# Following assumes that the apt-get update is already set up to pull from repo.radeon.com in base image
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -y \
hcc_lc && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

View File

@@ -15,10 +15,10 @@ MAINTAINER Peng Sun <Peng.Sun@amd.com>
# Initialize the image
# Modify to pre-install dev tools and ROCm packages
ARG ROCM_VERSION=4.1.1
ARG ROCM_VERSION=4.2
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends curl gnupg && \
curl -sL http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add - && \
sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/$ROCM_VERSION/ xenial main > /etc/apt/sources.list.d/rocm.list' && \
sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/$ROCM_VERSION/ ubuntu main > /etc/apt/sources.list.d/rocm.list' && \
apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
libelf1 \