mirror of
https://github.com/RadeonOpenCompute/ROCm-docker.git
synced 2023-04-23 17:53:00 +03:00
Refactored rocm-project to use amd apt-get packages repo
In the docker-compose yaml file, a new target to launch rocm-project without mapping any volumes is available. This target only uses the binary bits availalbe from the amd apt-get repo. The old targets were merged into a new one, and now map the built from source bits on top of the amd apt repo data, hiding it. License changed to MIT
This commit is contained in:
40
LICENSE
40
LICENSE
@@ -1,27 +1,21 @@
|
|||||||
Copyright (c) 2016, Advanced Micro Devices, Inc.
|
The MIT License (MIT)
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without modification,
|
Copyright (c) 2016 Advanced Micro Devices, Inc.
|
||||||
are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
list of conditions and the following disclaimer.
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
The above copyright notice and this permission notice shall be included in all
|
||||||
this list of conditions and the following disclaimer in the documentation
|
copies or substantial portions of the Software.
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
3. Neither the name of the copyright holder nor the names of its contributors
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
may be used to endorse or promote products derived from this software without
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
specific prior written permission.
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
SOFTWARE.
|
||||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|||||||
17
README.md
17
README.md
@@ -20,12 +20,23 @@ Without explicit parameters, `./roc-setup` default flags are --master && --relea
|
|||||||
|
|
||||||
`./roc-setup` generates Dockerfiles to be consumed by the docker build engine. Each sub-directory of this repository corresponds to a docker 'build context' responsible for a software layer in the ROCm stack. After running the script each directory contains a generated 'Dockerfile'. The parameters to the script control which flavor of the components to build, for instance: debug builds of the /develop branches.
|
`./roc-setup` generates Dockerfiles to be consumed by the docker build engine. Each sub-directory of this repository corresponds to a docker 'build context' responsible for a software layer in the ROCm stack. After running the script each directory contains a generated 'Dockerfile'. The parameters to the script control which flavor of the components to build, for instance: debug builds of the /develop branches.
|
||||||
|
|
||||||
|
**What are the individual ROCm software components**
|
||||||
|
|
||||||
| ROC component | |
|
| ROC component | |
|
||||||
|-----|-----|
|
|-----|-----|
|
||||||
| hcc-isa | the compiler that generates GPU ISA from the backend |
|
|
||||||
| hcc-hsail | the compiler that generates HSAIL IL from the backend |
|
|
||||||
| rocr | the runtime |
|
|
||||||
| roct | the kernel thunk library |
|
| roct | the kernel thunk library |
|
||||||
|
| rocr | the runtime |
|
||||||
|
| hcc-hsail | the compiler that generates HSAIL IL from the backend |
|
||||||
|
| hcc-lc | the compiler that generates GPU ISA from the backend |
|
||||||
|
|
||||||
|
**What repo branches are built with roc-setup flags**
|
||||||
|
|
||||||
|
|| --master | --develop |
|
||||||
|
|------|-----|-----|
|
||||||
|
|roct| master | dev |
|
||||||
|
|rocr| master | dev |
|
||||||
|
|hcc-hsail| master | develop |
|
||||||
|
|hcc-lc| testing | master |
|
||||||
|
|
||||||
The ROCm component that can not be used in a docker image is the ROCK-Kernel-Driver<sup>[1](#ROCK)</sup>. In order for the docker framework to function, **the ROCm kernel must be installed on the host machine.** This is a design constraint of docker; the linux kernel is not resident in the container. All containers share the host linux kernel, so the ROCK-Kernel-Driver component must be installed on the host linux kernel.
|
The ROCm component that can not be used in a docker image is the ROCK-Kernel-Driver<sup>[1](#ROCK)</sup>. In order for the docker framework to function, **the ROCm kernel must be installed on the host machine.** This is a design constraint of docker; the linux kernel is not resident in the container. All containers share the host linux kernel, so the ROCK-Kernel-Driver component must be installed on the host linux kernel.
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
# #################################################
|
||||||
|
# Copyright (c) 2016 Advanced Micro Devices, Inc.
|
||||||
|
# #################################################
|
||||||
|
|
||||||
version: '2'
|
version: '2'
|
||||||
services:
|
services:
|
||||||
# The following defines data-only containers
|
# The following defines data-only containers
|
||||||
@@ -51,13 +55,24 @@ services:
|
|||||||
# The following defines application containers, which depend on the data-only
|
# The following defines application containers, which depend on the data-only
|
||||||
# containers defiend above to provide their software layers
|
# containers defiend above to provide their software layers
|
||||||
# These should be run with `docker-compose run --rm <application-service>`
|
# These should be run with `docker-compose run --rm <application-service>`
|
||||||
rocm-project-isa:
|
rocm:
|
||||||
build:
|
build:
|
||||||
context: ./rocm-project
|
context: ./rocm-project
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
devices:
|
devices:
|
||||||
- "/dev/kfd"
|
- "/dev/kfd"
|
||||||
image: rocm/rocm-project-isa
|
image: rocm/rocm
|
||||||
|
# volumes is used to map host directories into the container
|
||||||
|
volumes:
|
||||||
|
- ~:/usr/local/src/host-home
|
||||||
|
|
||||||
|
rocm-source:
|
||||||
|
build:
|
||||||
|
context: ./rocm-project
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
devices:
|
||||||
|
- "/dev/kfd"
|
||||||
|
image: rocm/rocm-source
|
||||||
# volumes is used to map host directories into the container
|
# volumes is used to map host directories into the container
|
||||||
volumes:
|
volumes:
|
||||||
- ~:/usr/local/src/host-home
|
- ~:/usr/local/src/host-home
|
||||||
@@ -65,18 +80,4 @@ services:
|
|||||||
- roct:ro
|
- roct:ro
|
||||||
- rocr:ro
|
- rocr:ro
|
||||||
- hcc-lc:ro
|
- hcc-lc:ro
|
||||||
|
|
||||||
rocm-project-hsail:
|
|
||||||
build:
|
|
||||||
context: ./rocm-project
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
devices:
|
|
||||||
- "/dev/kfd"
|
|
||||||
image: rocm/rocm-project-hsail
|
|
||||||
# volumes is used to map host directories into the container
|
|
||||||
volumes:
|
|
||||||
- ~:/usr/local/src/host-home
|
|
||||||
volumes_from:
|
|
||||||
- roct:ro
|
|
||||||
- rocr:ro
|
|
||||||
- hcc-hsail:ro
|
- hcc-hsail:ro
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
# #################################################
|
||||||
|
# Copyright (c) 2016 Advanced Micro Devices, Inc.
|
||||||
|
# #################################################
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Set reasonable defaults for dockerfile builds
|
# Set reasonable defaults for dockerfile builds
|
||||||
@@ -65,18 +68,18 @@ while :; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
# hcc-hsail does not have a develop branch
|
|
||||||
export repo_branch_hcc_hsail="master"
|
|
||||||
|
|
||||||
# hcc-lc conforms to a non git-flow naming scheme, 'master' changes the most
|
# hcc-lc conforms to a non git-flow naming scheme, 'master' changes the most
|
||||||
export repo_branch_hcc_lc=
|
export repo_branch_hcc_lc=
|
||||||
|
export repo_branch_hcc_hsail=
|
||||||
|
|
||||||
export repo_branch=
|
export repo_branch=
|
||||||
if [ -n "${build_master}" ]; then
|
if [ -n "${build_master}" ]; then
|
||||||
repo_branch="master"
|
repo_branch="master"
|
||||||
|
repo_branch_hcc_hsail="master"
|
||||||
repo_branch_hcc_lc="testing"
|
repo_branch_hcc_lc="testing"
|
||||||
else
|
else
|
||||||
repo_branch="dev"
|
repo_branch="dev"
|
||||||
|
repo_branch_hcc_hsail="develop"
|
||||||
repo_branch_hcc_lc="master"
|
repo_branch_hcc_lc="master"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +1,35 @@
|
|||||||
# This is a template dockerfile meant to be personalized for application development.
|
# This dockerfile meant to be personalized for application development.
|
||||||
# Copy this dockerfile into a new build context (directory) and modify to taste.
|
# Copy this dockerfile into a new build context (directory) and modify to taste.
|
||||||
|
|
||||||
# After a new build context is created, build with
|
# It is recommended to control docker containers through 'docker-compose' https://docs.docker.com/compose/
|
||||||
# `docker build -t <user-name>/<project-name> .`
|
# Docker compose depends on a .yml file to control container sets
|
||||||
|
# roc-setup.sh can generate a useful docker-compose .yml file
|
||||||
# Run the container to start up a development environment. Optionally, map host
|
# `docker-compose run --rm <rocm-project>`
|
||||||
# directories into the container with -v for development convenience, which is
|
|
||||||
# especially nice for source code to persist after the container closes.
|
|
||||||
# The following maps the host directory into the container 'read only'
|
|
||||||
|
|
||||||
|
# If running the container manually through the docker command-line, the following is an example
|
||||||
# 'docker run -it --rm -v [host/directory]:[container/directory]:ro <user-name>/<project-name>'.
|
# 'docker run -it --rm -v [host/directory]:[container/directory]:ro <user-name>/<project-name>'.
|
||||||
# Example: 'docker run -it --rm -v ~/src/my-hcc-project:/root/my-hcc-project:ro kknox/my-hcc-project'.
|
|
||||||
|
|
||||||
# The application container can inherit from any other OS container
|
# The application container can inherit from any other OS container
|
||||||
FROM ubuntu:14.04
|
FROM ubuntu:14.04
|
||||||
MAINTAINER Kent Knox <kent.knox@amd>
|
MAINTAINER Kent Knox <kent.knox@amd>
|
||||||
|
|
||||||
# Change WORKPATH to a location where
|
|
||||||
ENV WORKPATH /opt/my-rocm-project
|
|
||||||
|
|
||||||
# The working directory is meant to be where build files are generated
|
|
||||||
WORKDIR ${WORKPATH}
|
|
||||||
|
|
||||||
# Default to a login shell
|
# Default to a login shell
|
||||||
ENTRYPOINT ["/bin/bash"]
|
ENTRYPOINT ["/bin/bash"]
|
||||||
CMD ["-l"]
|
CMD ["-l"]
|
||||||
|
|
||||||
# Initialize the image to install common and recommended dev tools
|
# Initialize the image to install recommended dev tools and ROCm packages
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl
|
||||||
|
|
||||||
|
# The following imports a key to the external AMD packages repository to make it trusted
|
||||||
|
RUN curl -sL http://packages.amd.com/rocm/apt/debian/rocm.gpg.key | apt-key add - && \
|
||||||
|
sh -c 'echo deb [arch=amd64] http://packages.amd.com/rocm/apt/debian/ trusty main > /etc/apt/sources.list.d/rocm.list'
|
||||||
|
|
||||||
|
# Initialize the image to install recommended dev tools and ROCm packages
|
||||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||||
build-essential \
|
build-essential \
|
||||||
clang-3.5 \
|
clang-3.5 \
|
||||||
libelf1 \
|
libelf1 \
|
||||||
curl \
|
rocm \
|
||||||
git \
|
git \
|
||||||
gdb \
|
gdb \
|
||||||
valgrind \
|
valgrind \
|
||||||
@@ -40,12 +38,14 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
|||||||
apt-get clean && \
|
apt-get clean && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# This is meant to be an interactive container; create a non-root user
|
||||||
|
RUN useradd --create-home --shell /bin/bash rocm-user
|
||||||
|
USER rocm-user
|
||||||
|
WORKDIR /home/rocm-user
|
||||||
|
|
||||||
# The following attempts to create a nice command line developer environment
|
# The following attempts to create a nice command line developer environment
|
||||||
# 1. Sets up an enhanced command line dev environment within VIM
|
# 1. Sets up an enhanced command line dev environment within VIM
|
||||||
# 2. Aliases GDB to use its native TUI mode by default
|
# 2. Aliases GDB to use its native TUI mode by default
|
||||||
RUN curl https://j.mp/spf13-vim3 -L | bash && \
|
RUN curl -sL https://j.mp/spf13-vim3 | bash && \
|
||||||
echo "\nalias gdb='gdb --tui'" >> ~/.bashrc && \
|
echo "\n PATH=${PATH}:/opt/rocm/bin\n" >> ~/.bashrc && \
|
||||||
echo "\nsource /opt/roct/setenv-roct.sh" >> ~/.bashrc && \
|
echo "alias gdb='gdb --tui'\n" >> ~/.bashrc
|
||||||
echo "\nsource /opt/hsa/setenv-rocr.sh" >> ~/.bashrc && \
|
|
||||||
echo "\nsource /opt/hcc/setenv-hcc.sh" >> ~/.bashrc && \
|
|
||||||
mkdir -p ${WORKPATH}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user