Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OS_VARIANT=ubuntu-24.04
ROCM_VERSION=6.2
AMDGPU_VERSION=6.2
TERM_FLAVOR=-complete-sdk
XTERM_FLAVOR=-complete
UID=
RENDER_GID=109
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,74 @@
# ROCm-docker

This fork is almost completely re-written as:

- All images are built with docker-compose.
- Reuse pre-built image to reduce time and space.
- Re-wrote `docker-compose.yml`
- Remove (probably) obsolete services for building images from souce.
- Only a specific OS version is teated at a time.
- OS / version / variant are specified by `.env` file.
- `render` group id is set to same number as host.
- Use `gpg --dearmor` instead of `apt-key add` for ubuntu-20.04 or later.
- Add X11 enabled terminal image.
- Omit CentOS-7 stuff due to its EOL.
- Omit Ubuntu 18.04 stuffs.
- Add many image variants based on latest (6.1) [ROCm Programming Models][].

[ROCm Programming Models]: https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/native-install/package-manager-integration.html#components-of-rocm-programming-models

## How to build
### Build all images for all OSes
1. Check `build.sh` file and edit it if necessary.
- `ROCM_VERSION`
- `AMDGPU_VERSION`
- `TERM_FLAVOR`
- `COMPOSE`
2. Execute `build_all.sh`
```console
$ ./build_all.sh`
```

### Build all images for a specific OS
1. Check `build.sh` file and edit it if necessary.
- `ROCM_VERSION`
- `AMDGPU_VERSION`
- `TERM_FLAVOR`
- `COMPOSE`
2. Execute `build.sh` with `OS_VARIANT` environment value.
```console
$ OS_VARIANT=ubuntu-22.04 ./build.sh`
```

### Build manually
1. Confirm `render` group id of your host OS.
```console
$ getent group render
```
2. Confirm your user id of your host OS.
```console
$ id -u
```
3. Check `.env` file and edit it if necessary.
4. Build a service by `docker-compose` (or `docker compose`) command.
Following is exampe of "TERM_FLAVOR=-ml"
```console
$ docker-compose build base
$ docker-compose build hip
$ docker-compose build hip-libs
$ docker-compose build ml
$ docker-compose build term
```

## How to run
```console
$ docker-compose run --rm term
```

Original README follows:

-----

## Radeon Open Compute Platform for docker
This repository contains a framework for building the software layers defined in the Radeon Open Compute Platform into portable docker images. The following are docker dependencies, which should be installed on the target machine.

Expand Down
43 changes: 43 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/sh

OS=${OS:-ubuntu}
OS_VERSION=${OS_VERSION:-24.04}
OS_VARIANT=${OS_VARIANT:-${OS}-${OS_VERSION}}
ROCM_VERSION=${ROCM_VERSION:-6.2}
AMDGPU_VERSION=${AMDGPU_VERSION:-6.2}
#TERM_FLAVOR=""
TERM_FLAVOR="-complete-sdk"
XTERM_FLAVOR="-complete"
RENDER_GID=$(getent group render | cut --delimiter ':' --fields 3)

cat >.env <<EOF
OS_VARIANT=${OS_VARIANT}
ROCM_VERSION=${ROCM_VERSION}
AMDGPU_VERSION=${AMDGPU_VERSION}
TERM_FLAVOR=${TERM_FLAVOR}
XTERM_FLAVOR=${XTERM_FLAVOR}
UID=${UID:-$(id -u)}
RENDER_GID=${RENDER_GID}
EOF

# choose your compose tool
COMPOSE="docker-compose"
#COMPOSE="docker compose"

# build rocm/dev-${OS_VARIANT}:${ROCM_VERSION}
${COMPOSE} build base || exit $?
# docker tag rocm/dev-${OS_VARIANT}:${ROCM_VERSION} rocm/dev-${OS_VARIANT}:latest

# build rocm/dev-${OS_VARIANT}:${ROCM_VERSION}-${FLAVOR}
FLAVORS="openmp-sdk opencl opencl-sdk hip hip-sdk ml ml-sdk complete complete-sdk"
for flavor in ${FLAVORS}; do
${COMPOSE} build ${flavor} || exit $?
# docker tag rocm/dev-${OS_VARIANT}:${ROCM_VERSION}-${FLAVOR} rocm/dev-${OS_VARIANT}:latest-${FLAVOR}
done

# build rocm/rocm-terminal:${ROCM_VERSION}-${OS_VARIANT}${TERM_FLAVOR}
${COMPOSE} build term || exit $?
# docker tag rocm/rocm-terminal:${ROCM_VERSION}-${OS_VARIANT}${TERM_FLAVOR} rocm/rocm-terminal:latest-${OS_VARIANT}${TERM_FLAVOR}

${COMPOSE} build xterm || exit $?
# docker tag rocm/rocm-terminal:${ROCM_VERSION}-${OS_VARIANT}${TERM_FLAVOR}-x11 rocm/rocm-terminal:latest-${OS_VARIANT}${TERM_FLAVOR}-x11
32 changes: 4 additions & 28 deletions build_all.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
ROCM_VERSION=5.1.3
AMDGPU_VERSION=22.10.3
cp -r scripts rocm-terminal
cp -r scripts dev
#!/bin/sh

# build rocm-terminal
cd rocm-terminal/
sudo docker build . -f Dockerfile -t rocm/rocm-terminal:$ROCM_VERSION --build-arg=ROCM_VERSION=$ROCM_VERSION --build-arg=AMDGPU_VERSION=$AMDGPU_VERSION
sudo docker tag rocm/rocm-terminal:$ROCM_VERSION rocm/rocm-terminal:latest

#build dev dockers
cd ../dev
#centos-7
sudo docker build . -f Dockerfile-centos-7 -t rocm/dev-centos-7:$ROCM_VERSION --build-arg=ROCM_VERSION=$ROCM_VERSION --build-arg=AMDGPU_VERSION=$AMDGPU_VERSION
sudo docker tag rocm/dev-centos-7:$ROCM_VERSION rocm/dev-centos-7:latest

#ubuntu20.04
sudo docker build . -f Dockerfile-ubuntu-20.04 -t rocm/dev-ubuntu-20.04:$ROCM_VERSION --build-arg=ROCM_VERSION=$ROCM_VERSION --build-arg=AMDGPU_VERSION=$AMDGPU_VERSION
sudo docker tag rocm/dev-ubuntu-20.04:$ROCM_VERSION rocm/dev-ubuntu-20.04:latest

#ubuntu18.04
sudo docker build . -f Dockerfile-ubuntu-18.04 -t rocm/dev-ubuntu-18.04:$ROCM_VERSION --build-arg=ROCM_VERSION=$ROCM_VERSION --build-arg=AMDGPU_VERSION=$AMDGPU_VERSION
sudo docker tag rocm/dev-ubuntu-18.04:$ROCM_VERSION rocm/dev-ubuntu-18.04:latest

#ubuntu18.04 complete
sudo docker build . -f Dockerfile-ubuntu-18.04-complete -t rocm/dev-ubuntu-18.04:$ROCM_VERSION-complete --build-arg=ROCM_VERSION=$ROCM_VERSION --build-arg=AMDGPU_VERSION=$AMDGPU_VERSION

#ubuntu20.04 complete
sudo docker build . -f Dockerfile-ubuntu-20.04-complete -t rocm/dev-ubuntu-20.04:$ROCM_VERSION-complete --build-arg=ROCM_VERSION=$ROCM_VERSION --build-arg=AMDGPU_VERSION=$AMDGPU_VERSION
#OS_VARIANT=ubuntu-18.04 ROCM_VERSION=5.2.3 AMDGPU_VERSION=22.20.3 ./build.sh
OS_VARIANT=ubuntu-20.04 ./build.sh
OS_VARIANT=ubuntu-22.04 ./build.sh
93 changes: 0 additions & 93 deletions dev/Dockerfile-centos-7

This file was deleted.

26 changes: 0 additions & 26 deletions dev/Dockerfile-ubuntu-18.04

This file was deleted.

26 changes: 0 additions & 26 deletions dev/Dockerfile-ubuntu-18.04-complete

This file was deleted.

35 changes: 19 additions & 16 deletions dev/Dockerfile-ubuntu-20.04
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# This dockerfile is meant to serve as a rocm base image. It registers the debian rocm package repository, and
# installs the rocm-dev package.
# This dockerfile is meant to serve as a rocm base image.
# It registers the debian rocm package repository, and installs the rocm-language-runtime package.

FROM ubuntu:20.04
LABEL [email protected]

# Register the ROCM package repository, and install rocm-dev package
ARG ROCM_VERSION=5.1.3
ARG AMDGPU_VERSION=22.10.3
ARG ROCM_VERSION=5.4
ARG AMDGPU_VERSION=5.4

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/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \
&& printf "deb [arch=amd64] https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/ubuntu focal main" | tee /etc/apt/sources.list.d/amdgpu.list \
&& apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends apt-utils \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends ca-certificates curl gnupg \
&& curl -sL https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm.gpg \
&& echo "deb [arch=amd64] https://repo.radeon.com/rocm/apt/$ROCM_VERSION focal main" | tee /etc/apt/sources.list.d/rocm.list \
&& echo "deb [arch=amd64] https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/ubuntu focal main" | tee /etc/apt/sources.list.d/amdgpu.list \
&& DEBIAN_FRONTEND=noninteractive apt-get purge -y curl gnupg \
&& DEBIAN_FRONTEND=noninteractive apt-get --purge -y autoremove

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
libelf1 \
kmod \
file \
python3 \
python3-pip \
rocm-dev \
build-essential && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN groupadd -g 109 render
rocm-language-runtime \
rocminfo \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
36 changes: 12 additions & 24 deletions dev/Dockerfile-ubuntu-20.04-complete
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
# This dockerfile is meant to serve as a rocm base image. It registers the debian rocm package repository, and
# installs the rocm-dev package.
# This dockerfile is meant to serve as a rocm base image.
# Add rocm-lib package to rocm/dev-ubuntu-20.04 image

FROM ubuntu:20.04
LABEL [email protected]
ARG OS_VARIANT=ubuntu-20.04
ARG ROCM_VERSION=5.3

# Register the ROCM package repository, and install rocm-dev package
ARG ROCM_VERSION=5.1.3
ARG AMDGPU_VERSION=22.10.3
FROM rocm/dev-${OS_VARIANT}:${ROCM_VERSION}-ml

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/ ubuntu main" | tee /etc/apt/sources.list.d/rocm.list \
&& printf "deb [arch=amd64] https://repo.radeon.com/amdgpu/$AMDGPU_VERSION/ubuntu focal main" | tee /etc/apt/sources.list.d/amdgpu.list \
&& apt-get update \
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
sudo \
libelf1 \
kmod \
file \
python3 \
python3-pip \
rocm-dev \
rocm-libs \
build-essential && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN groupadd -g 109 render
rocm-opencl-runtime \
clinfo \
migraphx \
mivisionx \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
Loading