Refactoring after ROCm 1.0 release

ROCm installation paths have changed, and the 1.0 release created a
new installation heirarchy.
This commit is contained in:
Kent Knox
2016-04-22 18:18:42 -05:00
parent 58afacef99
commit 24318085b7
9 changed files with 65 additions and 84 deletions

View File

@@ -24,17 +24,17 @@ services:
volumes:
- ${rocr_volume}
hcc-isa:
hcc-lc:
depends_on:
- rocr
build:
context: ./hcc-isa
context: ./hcc-lc
dockerfile: Dockerfile
image: ${hcc_isa_name}
container_name: hcc-isa
image: ${hcc_lc_name}
container_name: hcc-lc
entrypoint: /bin/true
volumes:
- ${hcc_volume}
- ${hcc_lc_volume}
hcc-hsail:
depends_on:
@@ -46,7 +46,7 @@ services:
container_name: hcc-hsail
entrypoint: /bin/true
volumes:
- ${hcc_volume}
- ${hcc_hsail_volume}
# The following defines application containers, which depend on the data-only
# containers defiend above to provide their software layers
@@ -64,7 +64,7 @@ services:
volumes_from:
- roct:ro
- rocr:ro
- hcc-isa:ro
- hcc-lc:ro
rocm-project-hsail:
build:

View File

@@ -43,8 +43,8 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HCC_INSTALL_PATH=${hcc_volume} HCC_BUILD_PATH=/usr/local/src/hcc-hsail
ENV PATH ${PATH}:${HCC_INSTALL_PATH}/bin
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} && \
@@ -52,17 +52,16 @@ RUN mkdir -p ${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_INSTALL_PATH} \
-DCMAKE_INSTALL_PREFIX=${hcc_hsail_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DHSA_HEADER_DIR=${ROCR_INSTALL_PATH}/include \
-DHSA_LIBRARY_DIR=${ROCR_INSTALL_PATH}/lib \
-DHSA_KMT_LIBRARY_DIR=${HSATHK_INSTALL_PATH}/lib/x86_64-linux-gnu \
-DROCM_ROOT=${rocr_volume} \
-DHSA_KMT_LIBRARY_DIR=${roct_volume}/lib/x86_64-linux-gnu \
.. && \
make -j $(nproc) world && \
make install && \
git log -n 3 > ${hcc_hsail_volume}/git-stamp.log && \
${hcc_hsail_cleanup} \
echo "${HCC_INSTALL_PATH}/lib" >> /etc/ld.so.conf.d/hcc.conf && \
echo "${hcc_hsail_volume}/lib" >> /etc/ld.so.conf.d/hcc.conf && \
ldconfig
COPY setenv-hcc.sh ${HCC_INSTALL_PATH}

View File

@@ -1,4 +1,4 @@
# Build this dockerfile with `docker build -f hcc-isa-release-dockerfile -t roc/hcc .`
# 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
@@ -34,24 +34,24 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
rm -rf /var/lib/apt/lists/*
# App specific environment variables; modify path to add hcc and repo commands
ENV HCC_INSTALL_PATH=${hcc_volume} HCC_BUILD_PATH=/usr/local/src/hcc-isa
ENV PATH=${PATH}:${HCC_INSTALL_PATH}/bin:~/bin
ENV HCC_BUILD_PATH=/usr/local/src/hcc-lc
ENV PATH=${PATH}:${hcc_lc_volume}/bin:~/bin
# 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
# Build hcc-isa, install to /usr/local
# Build hcc-lc, install to /usr/local
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 ${repo_branch_hcc_isa} && \
~/bin/repo init --depth=1 -u https://github.com/RadeonOpenCompute/HCC-Native-GCN-ISA.git -b ${repo_branch_hcc_lc} && \
~/bin/repo sync && \
cd llvm && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=${HCC_INSTALL_PATH} \
-DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DLLVM_TARGETS_TO_BUILD="AMDGPU;X86" .. && \
make -j $(nproc) install && \
@@ -60,27 +60,27 @@ RUN mkdir -p ${HCC_BUILD_PATH} && \
mkdir -p build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=${HCC_INSTALL_PATH} \
-DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DHSA_ROOT=${ROCR_INSTALL_PATH} \
-DHSA_ROOT=${rocr_volume} \
-DLLVM_DIR="${HCC_BUILD_PATH}/llvm/build" .. && \
make -j $(nproc) install && \
cd ../../hcc && \
mkdir -p build && \
cd build && \
ln -sr ${rocr_volume}/include ${rocr_volume}/include/hsa && \
cmake \
-DCMAKE_INSTALL_PREFIX=${HCC_INSTALL_PATH} \
-DCMAKE_INSTALL_PREFIX=${hcc_lc_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
-DHSA_ROOT=${ROCR_INSTALL_PATH} \
-DHSA_LLVM_BIN_DIR=${HCC_INSTALL_PATH}/bin \
-DROCM_ROOT=${rocr_volume} \
-DHSA_LLVM_BIN_DIR=${hcc_lc_volume}/bin \
-DHSA_AMDGPU_GPU_TARGET=fiji \
-DAMDPHDRS_DIR=${HCC_INSTALL_PATH}/bin \
-DAMDPHDRS_DIR=${hcc_lc_volume}/bin \
-DHSA_USE_AMDGPU_BACKEND=ON .. && \
make -j $(nproc) world && \
make install && \
${hcc_isa_cleanup} \
echo "${HCC_INSTALL_PATH}/lib" >> /etc/ld.so.conf.d/hcc-isa.conf && \
git log -n 3 > ${hcc_lc_volume}/git-stamp.log && \
${hcc_lc_cleanup} \
echo "${hcc_lc_volume}/lib" >> /etc/ld.so.conf.d/hcc-lc.conf && \
ldconfig
COPY setenv-hcc.sh ${HCC_INSTALL_PATH}

View File

@@ -68,16 +68,16 @@ done
# hcc-hsail does not have a develop branch
export repo_branch_hcc_hsail="master"
# hcc-isa conforms to a non git-flow naming scheme, 'master' changes the most
export repo_branch_hcc_isa=
# hcc-lc conforms to a non git-flow naming scheme, 'master' changes the most
export repo_branch_hcc_lc=
export repo_branch=
if [ -n "${build_master}" ]; then
repo_branch="master"
repo_branch_hcc_isa="testing"
repo_branch_hcc_lc="testing"
else
repo_branch="dev"
repo_branch_hcc_isa="master"
repo_branch_hcc_lc="master"
fi
export build_config=
@@ -85,12 +85,12 @@ export build_config_roct=
export roct_cleanup=
export rocr_cleanup=
export hcc_hsail_cleanup=
export hcc_isa_cleanup=
export hcc_lc_cleanup=
export rock_name=
export roct_name=
export rocr_name=
export hcc_hsail_name=
export hcc_isa_name=
export hcc_lc_name=
rocm_prefix="rocm/"
if [ -n "${build_release}" ]; then
@@ -100,7 +100,7 @@ if [ -n "${build_release}" ]; then
roct_name="${rocm_prefix}roct-${repo_branch}"
rocr_name="${rocm_prefix}rocr-${repo_branch}"
hcc_hsail_name="${rocm_prefix}hcc-hsail-${repo_branch_hcc_hsail}"
hcc_isa_name="${rocm_prefix}hcc-isa-${repo_branch_hcc_isa}"
hcc_lc_name="${rocm_prefix}hcc-lc-${repo_branch_hcc_lc}"
# Custom commands to clean up build directories for each component
# This is to keep release images as small as possible
@@ -108,7 +108,7 @@ if [ -n "${build_release}" ]; then
roct_cleanup='cd ~ && rm -rf ${HSATHK_BUILD_PATH} &&'
rocr_cleanup='cd ~ && rm -rf ${ROCR_BUILD_PATH} &&'
hcc_hsail_cleanup='cd ~ && rm -rf ${HCC_BUILD_PATH} &&'
hcc_isa_cleanup='cd ~ && rm -rf ${HCC_BUILD_PATH} &&'
hcc_lc_cleanup='cd ~ && rm -rf ${HCC_BUILD_PATH} &&'
else
build_config='Debug'
@@ -118,18 +118,20 @@ else
roct_name="${rocm_prefix}roct-${repo_branch}-${build_config,}"
rocr_name="${rocm_prefix}rocr-${repo_branch}-${build_config,}"
hcc_hsail_name="${rocm_prefix}hcc-hsail-${repo_branch_hcc_hsail}-${build_config,}"
hcc_isa_name="${rocm_prefix}hcc-isa-${repo_branch_hcc_isa}-${build_config,}"
hcc_lc_name="${rocm_prefix}hcc-lc-${repo_branch_hcc_lc}-${build_config,}"
fi
export rock_volume='/opt/rocm/rock/'
export roct_volume='/opt/rocm/libhsakmt/'
export rocr_volume='/opt/rocm/hsa/'
export hcc_volume='/opt/rocm/hcc/'
export hcc_hsail_volume='/opt/rocm/hcc-hsail/'
export hcc_lc_volume='/opt/rocm/hcc-lc/'
# Uncomment below to print dockerfiles with template substitutions; debugging
cat rock/rock-deb-dockerfile.template | envsubst '${repo_branch}' > rock/Dockerfile
cat rock/rock-deb-dockerfile.template | envsubst '${repo_branch}:${rock_volume}' > rock/Dockerfile
cat roct/roct-thunk-dockerfile.template | envsubst '${rock_name}:${repo_branch}:${build_config_roct}:${roct_cleanup}:${roct_volume}' > roct/Dockerfile
cat rocr/rocr-make-dockerfile.template | envsubst '${roct_name}:${repo_branch}:${build_config}:${rocr_cleanup}:${rocr_volume}' > rocr/Dockerfile
cat hcc-hsail/hcc-hsail-dockerfile.template | envsubst '${rocr_name}:${repo_branch_hcc_hsail}:${build_config}:${hcc_hsail_cleanup}:${hcc_volume}' > hcc-hsail/Dockerfile
cat hcc-isa/hcc-isa-dockerfile.template | envsubst '${rocr_name}:${repo_branch_hcc_isa}:${build_config}:${hcc_isa_cleanup}:${hcc_volume}' > hcc-isa/Dockerfile
cat rocr/rocr-make-dockerfile.template | envsubst '${roct_name}:${repo_branch}:${build_config}:${rocr_cleanup}:${roct_volume}:${rocr_volume}' > rocr/Dockerfile
cat hcc-hsail/hcc-hsail-dockerfile.template | envsubst '${rocr_name}:${repo_branch_hcc_hsail}:${build_config}:${hcc_hsail_cleanup}:${roct_volume}:${rocr_volume}:${hcc_hsail_volume}' > hcc-hsail/Dockerfile
cat hcc-lc/hcc-lc-dockerfile.template | envsubst '${rocr_name}:${repo_branch_hcc_lc}:${build_config}:${hcc_lc_cleanup}:${roct_volume}:${rocr_volume}:${hcc_lc_volume}' > hcc-lc/Dockerfile
cat docker-compose.yml.template | envsubst '${hcc_isa_name}:${hcc_hsail_name}:${rocr_name}:${roct_name}:${hcc_volume}:${rocr_volume}:${roct_volume}' > docker-compose.yml
cat docker-compose.yml.template | envsubst '${hcc_lc_name}:${hcc_hsail_name}:${rocr_name}:${roct_name}:${hcc_hsail_volume}:${hcc_lc_volume}:${rocr_volume}:${roct_volume}' > docker-compose.yml

View File

@@ -1,21 +0,0 @@
## ROCK-Kernel-Driver docker build context
This directory is the docker build context of the ROC kernel and kernel modules. Building the docker container will download, optionally build and install the linux kernel with the appropriate kernel modules enabled.
This dockerfile serves as an example, how-to, or as an isolated environment for kernel hackers, as build files and artifacts are isolated in the scope of the docker container.
### The host is not modified
---
| file | description |
|-----|-----|-----|
| *rock-deb-dockerfile* | `docker build -f rock-deb-dockerfile -t roc/rock .` |
| *rock-make-dockerfile* | `docker build -f rock-make-dockerfile -t roc/rock .` |
| *rock.config* | used to seed the kernel configuration step |
| *rock.config.diff* | what kernel options changed from the default generated .config |
All dockerfiles contain a dependency on the ubuntu-14.04 image. The `deb` dockerfile installs the kernel through packages contained in the repository. The `make` dockerfiles compile the code.
flags.
---
Once the docker image has been built, you can run a shell inside of the container with:
`docker run -it --rm roc/rock`

View File

@@ -7,7 +7,7 @@
# This kfd has only been tested so far on linux-headers-generic-lts-vivid
# ubuntu:14.04.3, the native kernel is '3.19'
FROM ubuntu:14.04.3
FROM ubuntu:14.04
MAINTAINER Kent Knox <kent.knox@amd>
# Constant environment variables
@@ -39,5 +39,6 @@ RUN mkdir -p ${ROCK_BUILD_PATH} && \
git checkout ${repo_branch} -- packages/ubuntu && \
DEBIAN_FRONTEND=noninteractive dpkg -i packages/ubuntu/compute-*.deb && \
DEBIAN_FRONTEND=noninteractive dpkg -i packages/ubuntu/linux-*.deb && \
git log -n 3 > ${rock_volume}/git-stamp.log && \
cd ~ && rm -rf ${ROCK_BUILD_PATH} && \
echo "KERNEL==\"kfd\", MODE=\"0666\"" | sudo tee /etc/udev/rules.d/kfd.rules

View File

@@ -30,7 +30,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV ROCR_INSTALL_PATH=${rocr_volume} ROCR_BUILD_PATH=/usr/local/src/ROCR-Runtime/
ENV ROCR_BUILD_PATH=/usr/local/src/ROCR-Runtime/
# Configure, build and install the runtime
# HSAIL based tools need the finalizer libraries, provided in the included deb file
@@ -38,19 +38,17 @@ ENV ROCR_INSTALL_PATH=${rocr_volume} ROCR_BUILD_PATH=/usr/local/src/ROCR-Runtime
RUN mkdir -p ${ROCR_BUILD_PATH} && \
cd ${ROCR_BUILD_PATH} && \
git clone --depth=1 --branch=${repo_branch} https://github.com/RadeonOpenCompute/ROCR-Runtime.git ./ && \
dpkg --fsys-tarfile packages/ubuntu/*.deb | tar -xf - -C / --wildcards *.so* --exclude=libhsa-runtime64* && \
mkdir -p build && \
cd build && \
cmake \
-DHSATHK_BUILD_INC_PATH=${HSATHK_INSTALL_PATH}/include \
-DHSATHK_BUILD_LIB_PATH=${HSATHK_INSTALL_PATH}/lib/x86_64-linux-gnu \
-DCMAKE_INSTALL_PREFIX=${ROCR_INSTALL_PATH} \
-DHSATHK_BUILD_INC_PATH=${roct_volume}/include \
-DHSATHK_BUILD_LIB_PATH=${roct_volume}/lib/x86_64-linux-gnu \
-DCMAKE_INSTALL_PREFIX=${rocr_volume} \
-DCMAKE_BUILD_TYPE=${build_config} \
../src && \
make -j $(nproc) install && \
cp -r ../src/inc ${ROCR_INSTALL_PATH}/include && \
cp -r ../src/inc ${rocr_volume}/include && \
git log -n 3 > ${rocr_volume}/git-stamp.log && \
${rocr_cleanup} \
echo "${ROCR_INSTALL_PATH}lib" >> /etc/ld.so.conf.d/rocr.conf && \
echo "${rocr_volume}lib" >> /etc/ld.so.conf.d/hsa-rocr-dev.conf && \
ldconfig
COPY setenv-rocr.sh ${ROCR_INSTALL_PATH}

View File

@@ -27,16 +27,18 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HSATHK_INSTALL_PATH=${roct_volume} HSATHK_BUILD_PATH=/usr/local/src/ROCT-Thunk-Interface
ENV HSATHK_BUILD_PATH=/usr/local/src/ROCT-Thunk-Interface
COPY setenv-roct.sh ${HSATHK_INSTALL_PATH}
COPY setenv-roct.sh ${roct_volume}
RUN mkdir -p ${HSATHK_BUILD_PATH} && \
cd ${HSATHK_BUILD_PATH} && \
git clone --depth=1 --branch=${repo_branch} https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface.git ./ && \
make -j $(nproc) ${build_config_roct} all deb && \
mkdir -p ${HSATHK_INSTALL_PATH}/lib/x86_64-linux-gnu && \
cp -a include/ ${HSATHK_INSTALL_PATH} && \
cp -a build/lnx64a/lib*.so* ${HSATHK_INSTALL_PATH}/lib/x86_64-linux-gnu && \
mkdir -p ${roct_volume}/lib/x86_64-linux-gnu && \
cp -a include/ ${roct_volume} && \
cp -a build/lnx64a/lib*.so* ${roct_volume}/lib/x86_64-linux-gnu && \
git log -n 3 > ${roct_volume}/git-stamp.log && \
${roct_cleanup} \
${HSATHK_INSTALL_PATH}/setenv-roct.sh
echo "${roct_volume}lib/x86_64-linux-gnu" >> /etc/ld.so.conf.d/x86_64-libhsakmt.conf && \
ldconfig