Previously, we were using ROCm 1.6.2 as there were issues with some of the machine learning applications that weren't present on 1.6.2. However, after re-running them we've found that they, and all other applications previously tested, run to completion. Additionally, there have been patches to enable BLIT kernels which made it so we no longer need to build HIP and MIOpen differently for APU and DGPU code. This allows us to install HIP directly from the .deb packages instead of from source. Installing from the .deb packages also avoid the hipDeviceSynchronize() bug. Finally, this makes it so most GPU programs can be run as-is without modifications to remove hipMalloc/hipMemcpy calls as was done previously. Change-Id: Ic61b09ed200b19f759d891487cde874abd607537 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/37675 Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu> Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu> Tested-by: kokoro <noreply+kokoro@google.com>
166 lines
5.9 KiB
Docker
166 lines
5.9 KiB
Docker
FROM ubuntu:16.04
|
|
|
|
# Needed for add-apt-repository
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
software-properties-common
|
|
|
|
# Ubuntu 16.04 does not have a python package new enough for gem5, use a PPA
|
|
RUN add-apt-repository ppa:deadsnakes/ppa && apt-get update
|
|
|
|
# Should be minimal needed packages
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
findutils \
|
|
file \
|
|
libunwind8 \
|
|
libunwind-dev \
|
|
pkg-config \
|
|
build-essential \
|
|
gcc-multilib \
|
|
g++-multilib \
|
|
git \
|
|
ca-certificates \
|
|
m4 \
|
|
zlib1g \
|
|
zlib1g-dev \
|
|
libprotobuf-dev \
|
|
protobuf-compiler \
|
|
libprotoc-dev \
|
|
libgoogle-perftools-dev \
|
|
python-yaml \
|
|
python3.9 \
|
|
python3.9-dev \
|
|
python3.9-distutils \
|
|
wget \
|
|
libpci3 \
|
|
libelf1 \
|
|
libelf-dev \
|
|
cmake \
|
|
openssl \
|
|
libssl-dev \
|
|
libboost-filesystem-dev \
|
|
libboost-system-dev \
|
|
libboost-dev \
|
|
libpng12-dev
|
|
|
|
# Use python 3.9 by default
|
|
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
|
|
|
|
# Setuptools is needed for cmake for ROCm build. Install using pip.
|
|
# Instructions to install PIP from https://pypi.org/project/pip/
|
|
RUN wget https://bootstrap.pypa.io/get-pip.py -qO get-pip.py
|
|
RUN python3 get-pip.py
|
|
RUN pip install -U setuptools scons==3.1.2 six
|
|
|
|
ARG gem5_dist=http://dist.gem5.org/dist/develop
|
|
|
|
# Install ROCm 1.6 binaries
|
|
RUN wget -qO- ${gem5_dist}/apt_1.6.4.tar.bz2 \
|
|
| tar -xjv \
|
|
&& cd apt_1.6.4/pool/main/ \
|
|
&& dpkg -i h/hsakmt-roct-dev/* \
|
|
&& dpkg -i h/hsa-ext-rocr-dev/* \
|
|
&& dpkg -i h/hsa-rocr-dev/* \
|
|
&& dpkg -i r/rocm-utils/* \
|
|
&& dpkg -i h/hcc/* \
|
|
&& dpkg -i r/rocm-opencl/* \
|
|
&& dpkg -i r/rocm-opencl-dev/* \
|
|
&& dpkg -i h/hip_base/* \
|
|
&& dpkg -i h/hip_hcc/*
|
|
|
|
# Get ROCm libraries we need to compile from source (and ROCm-profiler)
|
|
RUN git clone --single-branch https://github.com/ROCmSoftwarePlatform/hipBLAS/ && \
|
|
git clone --single-branch https://github.com/ROCmSoftwarePlatform/rocBLAS/ && \
|
|
git clone --single-branch https://github.com/ROCmSoftwarePlatform/MIOpenGEMM/ && \
|
|
git clone --single-branch https://github.com/ROCmSoftwarePlatform/MIOpen/ && \
|
|
git clone --single-branch https://github.com/RadeonOpenCompute/rocm-cmake/ && \
|
|
git clone --single-branch https://github.com/rocmarchive/ROCm-Profiler.git
|
|
|
|
# Apply patches to various repos
|
|
RUN mkdir -p /patch && cd /patch && \
|
|
wget ${gem5_dist}/rocm_patches/hipBLAS.patch && \
|
|
wget ${gem5_dist}/rocm_patches/miopen-conv.patch && \
|
|
wget ${gem5_dist}/rocm_patches/rocBLAS.patch
|
|
|
|
RUN git -C /hipBLAS/ checkout ee57787e && git -C /hipBLAS/ apply /patch/hipBLAS.patch && \
|
|
git -C /rocBLAS/ checkout cbff4b4e && git -C /rocBLAS/ apply /patch/rocBLAS.patch && \
|
|
git -C /rocm-cmake/ checkout 12670acb && \
|
|
git -C /MIOpenGEMM/ checkout 9547fb9e && \
|
|
git -C /MIOpen/ checkout 01d6ca55c && git -C /MIOpen/ apply /patch/miopen-conv.patch
|
|
|
|
ENV ROCM_PATH /opt/rocm
|
|
ENV HCC_HOME ${ROCM_PATH}/hcc
|
|
ENV HSA_PATH ${ROCM_PATH}/hsa
|
|
ENV HIP_PATH ${ROCM_PATH}/hip
|
|
ENV HIP_PLATFORM hcc
|
|
ENV PATH ${ROCM_PATH}/bin:${HCC_HOME}/bin:${HSA_PATH}/bin:${HIP_PATH}/bin:${PATH}
|
|
ENV HCC_AMDGPU_TARGET gfx801
|
|
|
|
# Create build dirs for machine learning ROCm installs
|
|
RUN mkdir -p /rocBLAS/build && \
|
|
mkdir -p /hipBLAS/build && \
|
|
mkdir -p /rocm-cmake/build && \
|
|
mkdir -p /MIOpenGEMM/build && \
|
|
mkdir -p /MIOpen/build
|
|
|
|
# Do the builds, empty build dir to trim image size
|
|
WORKDIR /rocBLAS/build
|
|
RUN CXX=/opt/rocm/bin/hcc cmake -DCMAKE_CXX_FLAGS="--amdgpu-target=gfx801" .. && \
|
|
make -j$(nproc) && make install && rm -rf *
|
|
|
|
WORKDIR /hipBLAS/build
|
|
RUN CXX=/opt/rocm/bin/hcc cmake -DCMAKE_CXX_FLAGS="--amdgpu-target=gfx801" .. && \
|
|
make -j$(nproc) && make install && rm -rf *
|
|
|
|
WORKDIR /rocm-cmake/build
|
|
RUN cmake .. && cmake --build . --target install && rm -rf *
|
|
|
|
WORKDIR /MIOpenGEMM/build
|
|
RUN cmake .. && make miopengemm && make install && rm -rf *
|
|
|
|
# Should link this in as a volume if at all possible
|
|
RUN mkdir -p /.cache/miopen && chmod 777 /.cache/miopen
|
|
|
|
# Un-set default c++ version for MIOpen compilation
|
|
# As MIOpen 1.7 requires c++14 or higher
|
|
RUN sed -i 's/INTERFACE_COMPILE_OPTIONS "-std=c++amp;-fPIC;-gline-tables-only"/#&/' /opt/rocm/hcc-1.0/lib/cmake/hcc/hcc-targets.cmake && \
|
|
sed -i 's/INTERFACE_COMPILE_OPTIONS "-hc"/#&/' /opt/rocm/hcc-1.0/lib/cmake/hcc/hcc-targets.cmake
|
|
|
|
WORKDIR /MIOpen
|
|
# Half is required; This is the version that MIOpen would download
|
|
RUN wget https://github.com/pfultz2/half/archive/1.12.0.tar.gz && \
|
|
tar -xzf 1.12.0.tar.gz
|
|
|
|
WORKDIR /MIOpen/build
|
|
RUN CXX=/opt/rocm/hcc/bin/hcc cmake \
|
|
-DCMAKE_BUILD_TYPE=Debug \
|
|
-DCMAKE_INSTALL_PREFIX=/opt/rocm \
|
|
-DMIOPEN_BACKEND=HIP \
|
|
-DCMAKE_PREFIX_PATH="/opt/rocm/hip;/opt/rocm/hcc;/opt/rocm/rocdl;/opt/rocm/miopengemm;/opt/rocm/hsa" \
|
|
-DMIOPEN_CACHE_DIR=/.cache/miopen \
|
|
-DMIOPEN_AMDGCN_ASSEMBLER_PATH=/opt/rocm/opencl/bin \
|
|
-DHALF_INCLUDE_DIR=/MIOpen/half-1.12.0/include \
|
|
-DCMAKE_CXX_FLAGS="-isystem /usr/include/x86_64-linux-gnu -DDGPU" .. && \
|
|
make -j$(nproc) && make install && rm -rf *
|
|
|
|
# Re-set defaults
|
|
RUN sed -i 's/#\(INTERFACE_COMPILE_OPTIONS "-std=c++amp;-fPIC;-gline-tables-only"\)/\1/' /opt/rocm/hcc-1.0/lib/cmake/hcc/hcc-targets.cmake && \
|
|
sed -i 's/#\(INTERFACE_COMPILE_OPTIONS "-hc"\)/\1/' /opt/rocm/hcc-1.0/lib/cmake/hcc/hcc-targets.cmake
|
|
|
|
# Create performance DB for gfx801.
|
|
WORKDIR /opt/rocm/miopen/share/miopen/db
|
|
RUN cp gfx803_64.cd.pdb.txt gfx801_4.cd.pdb.txt && \
|
|
cp gfx803_64.cd.pdb.txt gfx801_8.cd.pdb.txt && \
|
|
cp gfx803_64.cd.pdb.txt gfx801_16.cd.pdb.txt && \
|
|
cp gfx803_64.cd.pdb.txt gfx801_32.cd.pdb.txt && \
|
|
cp gfx803_64.cd.pdb.txt gfx801_64.cd.pdb.txt
|
|
|
|
# Install profiler from .deb file, works for 1.6.2
|
|
WORKDIR /ROCm-Profiler
|
|
RUN dpkg -i package/rocm-profiler_4.0.6036_amd64.deb
|
|
|
|
# Always use python3 and create a link to config command for gem5 to find
|
|
RUN ln -sf /usr/bin/python3 /usr/bin/python
|
|
RUN ln -sf /usr/bin/python3.9-config /usr/bin/python3-config
|
|
|
|
WORKDIR /
|