Merge pull request #1 from kknox/master

dockerfile refactoring and documentation 👍
This commit is contained in:
Kent Knox 2016-02-15 16:02:04 -06:00
commit b0cd54fe7e
21 changed files with 4351 additions and 77 deletions

View File

@ -1,2 +1,50 @@
# ROCP-docker
Dockerfiles for the various software layers defined in the Radeon Open Compute Platform
### Radeon Open Compute Platform for docker
This repository contains dockerfiles for the various software layers defined in the Radeon Open Compute Platform. Installation instructions for how to install docker on [Ubuntu systems](https://docs.docker.com/v1.8/installation/ubuntulinux/) and [Fedora systems](https://docs.docker.com/v1.8/installation/fedora/) is available.
A bash script `./roc-setup` is provided as a convenience to build the various ROC images. It builds release variants of the software stack, but debug variants can be built manually. See the instructions inside of each build context (directory). After completion, the following images should be present on your system
```bash
kknox@machine:~/src/github/ROCP-docker
[master % u=] $ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
roc/hcblas latest 8f9f0448139c 2 days ago 2.435 GB
roc/hcc latest 202ce25086d9 2 days ago 2.43 GB
roc/rocr latest b90850967834 3 days ago 1.009 GB
roc/roct latest 427885fa30bc 3 days ago 933.5 MB
roc/rock latest 742644f01f50 3 days ago 819.1 MB
ubuntu 14.04.3 3876b81b5a81 3 weeks ago 187.9 MB
```
A roc/rock image is built, which contains the required linux kernel and ROC kernel modules, but the files are isolated into the image and the other software layers on top of it in layers. *In order for the runtime and compilers to function properly*, **the ROC kernel has to be installed manually on the host machine.**
### Installing ROCK on the host machine.
A [sequence of instructions](https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver#installing-and-configuring-the-kernel) in bash:
1. `cd /usr/local/src`
2. `git clone --no-checkout --depth=1 https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver.git`
3. `cd ROCK-Kernel-Driver`
4. `git checkout master -- packages/ubuntu`
5. `dpkg -i packages/ubuntu/*.deb`
6. `echo "KERNEL==\"kfd\", MODE=\"0666\"" | sudo tee /etc/udev/rules.d/kfd.rules`
7. `sudo reboot`
### Running an application in the docker stack
If you wish to create a custom docker container for your application, the `hcblas` dockerfile can serve as a template to modify for your own applications. You run the container, and optionally map host directories (for shared source code, for instance) like so:
```bash
docker run -it --rm -v ~/host-src/project:~/container-src/project user-name/app-name
```
| Docker command reference | |
|-----|-----|
| docker | docker executable|
| run | docker sub-command |
| -it | attach console to container |
| --rm | when exiting container, delete it |
| -v ~/host-src/project:~/container-src/project | map host directory into container |
| user-name/app-name | unique name for container |
### Todo:
1. Create a proper method to load each software component as a [data-only container](https://docs.docker.com/engine/userguide/containers/dockervolumes/#mount-a-host-directory-as-a-data-volume)

15
hcblas/README.md Normal file
View File

@ -0,0 +1,15 @@
## hcBLAS docker build context
This directory is the docker build context for the hcBLAS library. Building the docker container downloads, builds and installs the library. This dockerfile is an isolated environment.
### The host is not modified
| dockerfile | Invoke |
|-----|-----|-----|
| *hcblas-release-dockerfile* | `docker build -f hcblas-release-dockerfile -t roc/hcblas .` |
| *hcblas-debug-dockerfile* | `docker build -f hcblas-debug-dockerfile -t roc/hcblas-debug .` |
Both files contains a dependency on the roc/rocr image to be present. The debug dockerfile builds the compiler with debug flags.
---
Once the docker images has been built, you can run a shell inside of the container with
`docker run -it --rm roc/hcblas`

View File

@ -0,0 +1,42 @@
# Build this dockerfile with `docker build -f hcblas-dockerfile -t roc/hcblas .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# ubuntu:14.04.3, the native kernel is '3.19'
FROM roc/hcc
MAINTAINER Kent Knox <kent.knox@amd>
# Global environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git \
cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HCBLAS_INSTALL_PATH /usr/local
RUN cd /usr/local/src && \
git clone --depth=1 https://bitbucket.org/multicoreware/hcblas.git && \
mkdir -p hcblas/build && \
cd hcblas/build && \
cmake \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_INSTALL_PREFIX=${HCBLAS_INSTALL_PATH} \
-DCMAKE_C_COMPILER=${HCC_INSTALL_PATH}/bin/clang \
-DCMAKE_CXX_COMPILER=${HCC_INSTALL_PATH}/bin/clang++ \
-DCMAKE_CXX_FLAGS="-fPIC" \
.. && \
make -j $(nproc) install

View File

@ -1,16 +1,14 @@
# Build this dockerfile with `docker build -f hcblas-dockerfile -t hcblas:master .`
# Build this dockerfile with `docker build -f hcblas-dockerfile -t roc/hcblas .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# 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 hcc:master
FROM roc/hcc
MAINTAINER Kent Knox <kent.knox@amd>
# Constant environment variables
# Global environment variables
ENV WORKPATH /root
ENV HCBLAS_INSTALL_PATH /usr/local
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
@ -27,15 +25,19 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HCBLAS_INSTALL_PATH /usr/local
RUN cd /usr/local/src && \
git clone https://bitbucket.org/multicoreware/hcblas.git && \
git clone --depth=1 https://bitbucket.org/multicoreware/hcblas.git && \
mkdir -p hcblas/build && \
cd hcblas/build && \
cmake \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=${HCBLAS_INSTALL_PATH} \
-DCMAKE_C_COMPILER=${HCC_INSTALL_PATH}/bin/clang \
-DCMAKE_CXX_COMPILER=${HCC_INSTALL_PATH}/bin/clang++ \
-DCMAKE_CXX_FLAGS="-fPIC" \
.. && \
make -j `nproc` install && \
make -j $(nproc) install && \
cd .. && rm -rf build

15
hcc/README.md Normal file
View File

@ -0,0 +1,15 @@
## HCC docker build context
This directory is the docker build context for the HCC ROC compiler. Building the docker container downloads, builds and installs the compiler. This dockerfile is an isolated environment.
### The host is not modified
| dockerfile | Invoke |
|-----|-----|-----|
| *hcc-release-dockerfile* | `docker build -f hcc-release-dockerfile -t roc/hcc .` |
| *hcc-debug-dockerfile* | `docker build -f hcc-debug-dockerfile -t roc/hcc-debug .` |
Both files contains a dependency on the roc/rocr image to be present. The debug dockerfile builds the compiler with debug flags.
---
Once the docker images has been built, you can run a shell inside of the container with
`docker run -it --rm roc/hcc`

66
hcc/hcc-debug-dockerfile Normal file
View File

@ -0,0 +1,66 @@
# Build this dockerfile with `docker build -f hcc-debug-dockerfile -t roc/hcc-debug .`
# 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 roc/rocr
MAINTAINER Kent Knox <kent.knox@amd>
# Global environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# 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 \
llvm-dev \
llvm-runtime \
libc++1 \
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_INSTALL_PATH /opt/hcc
ENV PATH ${PATH}:${HCC_INSTALL_PATH}/bin
# Build hcc, install to /usr/local
RUN cd /usr/local/src && \
git clone --depth=1 https://bitbucket.org/multicoreware/hcc.git && \
mkdir -p hcc/build && \
cd hcc/build && \
cmake \
-DCMAKE_INSTALL_PREFIX=${HCC_INSTALL_PATH} \
-DCMAKE_BUILD_TYPE=Debug \
-DHSA_HEADER_DIR=${ROCR_INSTALL_PATH}/include \
-DHSA_LIBRARY_DIR=${ROCR_INSTALL_PATH}/lib \
-DHSA_KMT_LIBRARY_DIR=${HSATHK_INSTALL_PATH} \
.. && \
make -j $(nproc) world && \
make install && \
echo "${HCC_INSTALL_PATH}/lib" >> /etc/ld.so.conf.d/hcc.conf && \
ldconfig

View File

@ -1,22 +1,16 @@
# Build this dockerfile with `docker build -f hcc-dockerfile -t hcc:master .`
# 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
# This builds the hcc compiler, and depends on an already existing rocr-runtime to be found
# 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 rocr:master
FROM roc/rocr
MAINTAINER Kent Knox <kent.knox@amd>
# Constant environment variables
# Global environment variables
ENV WORKPATH /root
ENV HCC_INSTALL_PATH /opt/hcc
ENV LD_LIBRARY_PATH ${LD_LIBRARY_PATH}:${HCC_INSTALL_PATH}/lib
ENV PATH ${PATH}:${HCC_INSTALL_PATH}/bin
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
@ -50,9 +44,13 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HCC_INSTALL_PATH /opt/hcc
ENV PATH ${PATH}:${HCC_INSTALL_PATH}/bin
# Build hcc, install to /usr/local
RUN cd /usr/local/src && \
git clone https://bitbucket.org/multicoreware/hcc.git && \
git clone --depth=1 https://bitbucket.org/multicoreware/hcc.git && \
mkdir -p hcc/build && \
cd hcc/build && \
cmake \
@ -60,8 +58,10 @@ RUN cd /usr/local/src && \
-DCMAKE_BUILD_TYPE=Release \
-DHSA_HEADER_DIR=${ROCR_INSTALL_PATH}/include \
-DHSA_LIBRARY_DIR=${ROCR_INSTALL_PATH}/lib \
-DHSA_KMT_LIBRARY_DIR=${ROCR_INSTALL_PATH}/lib \
-DHSA_KMT_LIBRARY_DIR=${HSATHK_INSTALL_PATH} \
.. && \
make -j `nproc` world && \
make -j $(nproc) world && \
make install && \
cd .. && rm -rf build
cd .. && rm -rf build && \
echo "${HCC_INSTALL_PATH}/lib" >> /etc/ld.so.conf.d/hcc.conf && \
ldconfig

19
roc-setup.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Series of steps to build layers of containers, each container housing 1 softare component
( cd rock; docker build -f rock-deb-dockerfile -t roc/rock . )
( cd roct; docker build -f roct-thunk-release-dockerfile -t roc/roct . )
( cd rocr; docker build -f rocr-make-release-dockerfile -t roc/rocr . )
( cd hcc; docker build -f hcc-release-dockerfile -t roc/hcc . )
( cd hcblas; docker build -f hcblas-dockerfile -t roc/hcblas . )
echo ""
echo "The host machine needs to be configured with the proper ROC Kernel modules"
echo "example sequence below:"
echo ""
echo "cd /usr/local/src"
echo "git clone --no-checkout --depth=1 https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver.git"
echo "cd ROCK-Kernel-Driver"
echo "git checkout master -- packages/ubuntu"
echo "DEBIAN_FRONTEND=noninteractive dpkg -i packages/ubuntu/*.deb"
echo "echo \"KERNEL==\"kfd\", MODE=\"0666\"\" | sudo tee /etc/udev/rules.d/kfd.rules"

21
rock/README.md Normal file
View File

@ -0,0 +1,21 @@
## 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`

39
rock/rock-deb-dockerfile Normal file
View File

@ -0,0 +1,39 @@
# Build this dockerfile with `docker build -f rock-deb-dockerfile -t roc/rock .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute kernel and kernel modules
# 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
MAINTAINER Kent Knox <kent.knox@amd>
# Constant environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize image with debian package dependencies, cleanup to keep image small
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
crda \
wireless-crda \
git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Clone as small of a repository as we can, unpack and install ubuntu packages only
# Keep the cloned repository as record of what was compiled into the container, but it does make the container size bigger
RUN cd /usr/local/src && \
git clone --no-checkout --depth=1 https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver.git && \
cd ROCK-Kernel-Driver && \
git checkout master -- packages/ubuntu && \
DEBIAN_FRONTEND=noninteractive dpkg -i packages/ubuntu/*.deb && \
rm -rf packages && \
echo "KERNEL==\"kfd\", MODE=\"0666\"" | sudo tee /etc/udev/rules.d/kfd.rules

51
rock/rock-make-dockerfile Normal file
View File

@ -0,0 +1,51 @@
# Build this dockerfile with `docker build -f rock-make-dockerfile -t roc/rock .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute kernel and kernel modules
# 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
MAINTAINER Kent Knox <kent.knox@amd>
# Constant environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
crda \
wireless-crda \
build-essential \
bc \
git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN cd /usr/local/src && \
git clone --depth=1 https://github.com/RadeonOpenCompute/ROCK-Kernel-Driver.git && \
cd ROCK-Kernel-Driver && \
make mrproper && \
echo "KERNEL==\"kfd\", MODE=\"0666\"" | sudo tee /etc/udev/rules.d/kfd.rules
# Copy a pre-configured kernel config that enables amdkfd & amdgpu
# 'device drivers' \ 'IOMMU Hardware support' \ 'amd_iommu_v2'
# 'device drivers' \ 'graphics support' \ 'direct rendering manager' \ 'AMD GPU'
# 'device drivers' \ 'graphics support' \ 'direct rendering manager' \ 'HSA kernel driver'
COPY rock.config /usr/local/src/ROCK-Kernel-Driver/.config
RUN cd /usr/local/src/ROCK-Kernel-Driver && \
make olddefconfig && \
make -j $(nproc) && \
make modules_install install && \
DEBIAN_FRONTEND=noninteractive dpkg -i packages/ubuntu/compute-firmware*.deb
# VOLUME ["/usr/share/doc/compute-firmware"]

3745
rock/rock.config Normal file

File diff suppressed because it is too large Load Diff

10
rock/rock.config.diff Normal file
View File

@ -0,0 +1,10 @@
AMD_IOMMU_V2 n -> m
DRM_AMDGPU n -> m
+DRM_AMDGPU_CIK n
+DRM_AMDGPU_USERPTR n
+DRM_AMD_DAL n
+DRM_AMD_GNB_BUS m
+DRM_AMD_POWERPLAY n
+DRM_TTM m
+HSA_AMD m
+MMU_NOTIFIER y

18
rocr/README.md Normal file
View File

@ -0,0 +1,18 @@
## ROCR-Runtime docker build context
This directory is the docker build context of the ROC runtime libraries. Building the docker container will download, build and install the runtime, isolated in the scope of the docker container.
### The host is not modified
---
| dockerfile | Invoke |
|-----|-----|-----|
| *rocr-deb-dockerfile* | `docker build -f rocr-deb-dockerfile -t roc/rocr .` |
| *rocr-make-release-dockerfile* | `docker build -f rocr-make-release-dockerfile -t roc/rocr .` |
| *rocr-make-debug-dockerfile* | `docker build -f rocr-make-debug-dockerfile -t roc/rocr-debug .` |
All dockerfiles contain a dependency on the roc/roct image to be present. The `deb` dockerfile installs the runtime through packages contained in the repository. The `make` dockerfiles compile the code, either with or without debug flags.
---
Once the docker images has been built, you can run a shell inside of the container with:
`docker run -it --rm roc/rocr`

40
rocr/rocr-deb-dockerfile Normal file
View File

@ -0,0 +1,40 @@
# Build this dockerfile with `docker build -f rocr-deb-dockerfile -t roc/rocr .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute runtime
# ubuntu:14.04.3, the native kernel is '3.19'
FROM roc/roct
MAINTAINER Kent Knox <kent.knox@amd>
# Global environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
git \
cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV ROCR_INSTALL_PATH /opt/hsa
# Install from ubuntu packages
RUN cd /usr/local/src && \
git clone --no-checkout --depth=1 https://github.com/RadeonOpenCompute/ROCR-Runtime.git && \
cd ROCR-Runtime && \
git checkout master -- packages/ubuntu && \
DEBIAN_FRONTEND=noninteractive dpkg -i packages/ubuntu/*.deb && \
rm -rf packages && \
echo "${ROCR_INSTALL_PATH}/lib" >> /etc/ld.so.conf.d/rocr.conf && \
ldconfig

View File

@ -1,55 +0,0 @@
# Build this dockerfile with `docker build -f rocr-dockerfile -t rocr:master .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute runtime
# 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
MAINTAINER Kent Knox <kent.knox@amd>
# Constant environment variables
ENV WORKPATH /root
ENV ROCR_INSTALL_PATH /opt/hsa
ENV LD_LIBRARY_PATH ${ROCR_INSTALL_PATH}/lib
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
libc6-dev-i386 \
libelf-dev \
git \
cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Build can't find hsakmt.h yet, possibly located in ROCK
#RUN cd /usr/local/src && \
# git clone https://github.com/RadeonOpenCompute/ROCR-Runtime.git && \
# mkdir -p ROCR-Runtime/build && \
# cd ROCR-Runtime/build && \
# cmake \
# -DCMAKE_INSTALL_PREFIX=${ROCR_INSTALL_PATH} \
# -DCMAKE_BUILD_TYPE=Release \
# ../src && \
# make -j `nproc` install && \
# cd .. && rm -rf build
RUN cd /usr/local/src && \
git clone https://github.com/RadeonOpenCompute/ROCR-Runtime.git && \
cd ROCR-Runtime/packages/ubuntu && \
dpkg -i *.deb
# The runtime has a dependency on a library from the kfd; needs to be copied into
# the same directory as the dockerfile
COPY libhsakmt.so.1 /opt/hsa/lib

View File

@ -0,0 +1,49 @@
# Build this dockerfile with `docker build -f rocr-make-debug-dockerfile -t roc/rocr-debug .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute runtime
# ubuntu:14.04.3, the native kernel is '3.19'
FROM roc/roct
MAINTAINER Kent Knox <kent.knox@amd>
# Global environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
libc6-dev-i386 \
libelf-dev \
git \
cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV ROCR_INSTALL_PATH /opt/hsa
# Configure, build and install
RUN cd /usr/local/src && \
git clone --depth=1 https://github.com/RadeonOpenCompute/ROCR-Runtime.git && \
mkdir -p ROCR-Runtime/build && \
cd ROCR-Runtime/build && \
HSATHK_BUILD_INC_PATH=${HSATHK_SRC_PATH}/include \
HSATHK_BUILD_LIB_PATH=${HSATHK_INSTALL_PATH} \
cmake \
-DCMAKE_INSTALL_PREFIX=${ROCR_INSTALL_PATH} \
-DCMAKE_BUILD_TYPE=Debug \
../src && \
make -j $(nproc) install && \
cp -r ../src/inc ${ROCR_INSTALL_PATH}/include && \
echo "${ROCR_INSTALL_PATH}/lib" >> /etc/ld.so.conf.d/rocr.conf && \
ldconfig

View File

@ -0,0 +1,50 @@
# Build this dockerfile with `docker build -f rocr-make-release-dockerfile -t roc/rocr .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute runtime
# ubuntu:14.04.3, the native kernel is '3.19'
FROM roc/roct
MAINTAINER Kent Knox <kent.knox@amd>
# Global environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
libc6-dev-i386 \
libelf-dev \
git \
cmake && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV ROCR_INSTALL_PATH /opt/hsa
# Configure, build and install
RUN cd /usr/local/src && \
git clone --depth=1 https://github.com/RadeonOpenCompute/ROCR-Runtime.git && \
mkdir -p ROCR-Runtime/build && \
cd ROCR-Runtime/build && \
HSATHK_BUILD_INC_PATH=${HSATHK_SRC_PATH}/include \
HSATHK_BUILD_LIB_PATH=${HSATHK_INSTALL_PATH} \
cmake \
-DCMAKE_INSTALL_PREFIX=${ROCR_INSTALL_PATH} \
-DCMAKE_BUILD_TYPE=Release \
../src && \
make -j $(nproc) install && \
cp -r ../src/inc ${ROCR_INSTALL_PATH}/include && \
cd .. && rm -rf build && \
echo "${ROCR_INSTALL_PATH}/lib" >> /etc/ld.so.conf.d/rocr.conf && \
ldconfig

18
roct/README.md Normal file
View File

@ -0,0 +1,18 @@
## ROCT-Thunk-Interface docker build context
This directory is the docker build context of the ROC thunk interface. Building the docker container downloads, builds and installs the radeon compute user-mode API interfaces.
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
---
| dockerfile | Invoke |
|-----|-----|-----|
| *roct-thunk-release-dockerfile* | `docker build -f roct-thunk-release-dockerfile -t roc/roct .` |
| *roct-thunk-debug-dockerfile* | `docker build -f roct-thunk-release-dockerfile -t roc/roct .` |
Both files contains a dependency on the roc/rock image to be present. The debug dockerfile builds the thunk layer with debug flags.
---
Once the docker images has been built, you can run a shell inside of the container with
`docker run -it --rm roc/roct`

View File

@ -0,0 +1,40 @@
# Build this dockerfile with `docker build -f roct-thunk-debug-dockerfile -t roc/roct-debug .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute kernel thunk
# ubuntu:14.04.3, the native kernel is '3.19'
FROM roc/rock
MAINTAINER Kent Knox <kent.knox@amd>
# Global environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HSATHK_SRC_PATH /usr/local/src/ROCT-Thunk-Interface
ENV HSATHK_INSTALL_PATH /usr/lib/x86_64-linux-gnu
RUN cd /usr/local/src && \
git clone --depth=1 https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface.git && \
cd ${HSATHK_SRC_PATH} && \
make -j $(nproc) all deb && \
rm -f ${HSATHK_INSTALL_PATH}/libhsakmt.* && \
cp build/lnx64a/lib*.so.1 ${HSATHK_INSTALL_PATH} && \
ln -s ${HSATHK_INSTALL_PATH}/libhsakmt.so.1 ${HSATHK_INSTALL_PATH}/libhsakmt.so && \
ldconfig

View File

@ -0,0 +1,41 @@
# Build this dockerfile with `docker build -f roct-thunk-release-dockerfile -t roc/roct .`
# To reduce container rebuild time, place commands least likely to change at top to
# most changing at bottom
# This builds the radeon open compute kernel thunk
# ubuntu:14.04.3, the native kernel is '3.19'
FROM roc/rock
MAINTAINER Kent Knox <kent.knox@amd>
# Global environment variables
ENV WORKPATH /root
# Set working directory to be root's home directory
WORKDIR ${WORKPATH}
# Default to a login shell
ENTRYPOINT ["/bin/bash"]
CMD ["-l"]
# Initialize the image we are working with
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
build-essential \
git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# App specific environment variables
ENV HSATHK_SRC_PATH /usr/local/src/ROCT-Thunk-Interface
ENV HSATHK_INSTALL_PATH /usr/lib/x86_64-linux-gnu
RUN cd /usr/local/src && \
git clone --depth=1 https://github.com/RadeonOpenCompute/ROCT-Thunk-Interface.git && \
cd ${HSATHK_SRC_PATH} && \
make -j $(nproc) REL=1 all deb && \
rm -f ${HSATHK_INSTALL_PATH}/libhsakmt.* && \
cp build/lnx64a/lib*.so.1 ${HSATHK_INSTALL_PATH} && \
ln -s ${HSATHK_INSTALL_PATH}/libhsakmt.so.1 ${HSATHK_INSTALL_PATH}/libhsakmt.so && \
make clean && \
ldconfig