Skip to content

Commit 24952c9

Browse files
authored
Merge pull request #25 from ROCm/dev/bhatturu/packaging-fixes
Cherry-picking packaging fixes
2 parents 6164da5 + bed6db9 commit 24952c9

4 files changed

Lines changed: 78 additions & 160 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ifeq (${UBUNTU_VERSION}, noble)
4646
UBUNTU_VERSION_NUMBER = 24.04
4747
endif
4848

49-
DEBIAN_VERSION := "1.2.0"
49+
DEBIAN_VERSION := "1.0.0"
5050

5151
DEBIAN_CONTROL = ${TOP_DIR}/build/debian/DEBIAN/control
5252
BUILD_VER_ENV = ${DEBIAN_VERSION}~$(UBUNTU_VERSION_NUMBER)
@@ -126,7 +126,7 @@ pkg-deb: pkg-deb-clean
126126
-v $(HOME)/.ssh:/home/$(shell whoami)/.ssh \
127127
-w $(CONTAINER_WORKDIR) \
128128
$(BUILD_CONTAINER) \
129-
bash -c "cd $(CONTAINER_WORKDIR) && source ~/.bashrc && git config --global --add safe.directory $(CONTAINER_WORKDIR) && make deb-pkg-build"
129+
bash -c "cd $(CONTAINER_WORKDIR) && source ~/.bashrc && git config --global --add safe.directory $(CONTAINER_WORKDIR) && make deb-pkg-build UBUNTU_VERSION=$(UBUNTU_VERSION)"
130130

131131
.PHONY: deb-pkg-build
132132
deb-pkg-build: all

README.md

Lines changed: 20 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -3,124 +3,25 @@ ROCm Container Toolkit offers tools to streamline the use of AMD GPUs with conta
33
- ```amd-container-runtime``` - The AMD Container Runtime
44
- ```amd-ctk``` - The AMD Container Toolkit CLI
55

6-
# Installation
7-
## Debian Package Install
8-
### System Requirements
9-
10-
Before installing the AMD Container Toolkit, you need to install the following:
11-
12-
* **Operating System**: Ubuntu 22.04 or Ubuntu 24.04
13-
14-
* **ROCm Version**: 6.3.x (specific to each .deb pkg)
15-
16-
Each Debian package release of the AMD Container Toolkit is dependent on a specific version of the ROCm amdgpu driver. Please see table below for more information:
17-
18-
| Container Toolkit Debian Version | ROCm Version | AMDGPU Driver Version |
19-
|----------------------------------|--------------|-----------------------|
20-
| amd-container-toolkit-1.2.0 | ROCm 6.3.x | 6.10.5 |
21-
22-
### Installation
23-
24-
#### Step 1: Install System Prerequisites
25-
26-
1. Update the system:
27-
28-
```text
29-
> sudo apt update
30-
> sudo apt install "linux-headers-$(uname \-r)" "linux-modules-extra-$(uname \-r)"
31-
```
32-
33-
2. Add user to required groups:
34-
35-
```text
36-
> sudo usermod \-a \-G render,video $LOGNAME
37-
```
38-
39-
#### Step 2: Install AMDGPU Driver
40-
41-
Note
42-
43-
For the most up-to-date information on installing dkms drivers please see the [ROCm Install Quick Start](https://rocm.docs.amd.com/projects/install-on-linux/en/latest/install/quick-start.html) page. The below instructions are the most current instructions as of ROCm 6.2.4.
44-
45-
1. Download the driver from the Radeon repository ([repo.radeon.com](https://repo.radeon.com/amdgpu-install)) for your operating system. For example if you want to get the latest ROCm 6.3.4 drivers for Ubuntu 22.04 you would run the following command:
46-
47-
```text
48-
> wget https://repo.radeon.com/amdgpu-install/6.3.4/ubuntu/jammy/amdgpu-install\_6.3.60304-1\_all.deb
49-
```
50-
51-
Please note that the above url will be different depending on what version of the drivers you will be installing and type of Operating System you are using.
52-
53-
2. Install the driver:
54-
55-
```text
56-
> sudo apt install ./amdgpu-install\_6.3.60304-1\_all.deb
57-
> sudo apt update
58-
> amdgpu-install \--usecase\=dkms
59-
```
60-
61-
3. Load the driver module:
62-
63-
```text
64-
> sudo modprobe amdgpu
65-
```
66-
67-
#### Step 3: Install the APT Prerequisites for Container Toolkit.
68-
69-
1. Update the package list and install necessary tools, keyrings and keys:
70-
71-
```text
72-
> sudo apt update
73-
> sudo apt install vim wget gpg
74-
75-
\# Create the keyrings directory with the appropriate permissions:
76-
> sudo mkdir \--parents \--mode\=0755 /etc/apt/keyrings
77-
78-
\# Download the ROCm GPG key and add it to the keyrings:
79-
> wget https://repo.radeon.com/rocm/rocm.gpg.key \-O \- | gpg \--dearmor | sudo tee /etc/apt/keyrings/rocm.gpg \> /dev/null
80-
```
81-
82-
2. Edit the sources list to add the Container Toolkit repository:
83-
84-
```text
85-
**For Ubuntu 22.04**, add the following line:
86-
87-
> deb \[arch\=amd64 signed-by\=/etc/apt/keyrings/rocm.gpg\] https://repo.radeon.com/amd-container-toolkit/apt/1.2.0 jammy main
88-
89-
**For Ubuntu 24.04**, add the following line:
90-
91-
> deb \[arch\=amd64 signed-by\=/etc/apt/keyrings/rocm.gpg\] https://repo.radeon.com/amd-container-toolkit/apt/1.2.0 noble main
92-
```
93-
94-
3. Update the package list again:
95-
96-
```text
97-
> sudo apt update
98-
```
99-
100-
#### Step 4: Install the Prerequisites for Container Toolkit
101-
102-
1. Install the Container toolkit.
103-
104-
```text
105-
> sudo apt install amd-container-toolkit
106-
```
107-
108-
2. Install docker version 25 or above.
109-
110-
## Debian Package Install
111-
112-
TBD
6+
# Requirements
7+
- Ubuntu 22.02 or 24.04
8+
- Docker version 25 or later
9+
10+
# Quick Start
11+
Install the Container toolkit.
12+
13+
```text
14+
> sudo apt install amd-container-toolkit
15+
```
11316

11417
# Configuring Docker
11518

116-
1. Configure the AMD container runtime for Docker as follows.
19+
1. Configure the AMD container runtime for Docker as follows. The following command modifies the docker configuration file, /etc/docker/daemon.json, so that Docker can use the AMD container runtime.
11720

11821
```text
11922
> sudo amd-ctk configure runtime
12023
```
12124
122-
The above command modifies the docker configuration file, /etc/docker/daemon.json, so that Docker can use the AMD container runtime.
123-
12425
2. Restart the Docker daemon.
12526
12627
``` text
@@ -187,9 +88,7 @@ amd.com/gpu=0
18788
/dev/dri/renderD128
18889
```
18990

190-
4. Make AMD container runtime default runtime.
191-
192-
Avoid specifying ```--runtime=amd``` option with the ```docker run``` command by setting the AMD container runtime as the default for Docker.
91+
4. Make AMD container runtime default runtime. Avoid specifying ```--runtime=amd``` option with the ```docker run``` command by setting the AMD container runtime as the default for Docker.
19392

19493
```text
19594
> amd-ctk runtime configure --runtime=docker --set-as-default
@@ -220,50 +119,9 @@ amd.com/gpu=0
220119
/dev/dri/renderD128
221120
```
222121

223-
# Architecture overview
224-
The Container Toolkit achieves the following.
225-
226-
1. Provide containers access to all or a subset of the GPUs available on the host system, via the environment variable, ```AMD_VISIBLE_DEVICES```. The AMD container runtime is a wrapper on the low level runtime ```runc``` that intercepts and updates the [OCI spec](https://github.com/opencontainers/runtime-spec/blob/main/spec.md) that is generated by the container daemon and passed to ```runc```. Specifically, it injects the GPU devices, requested by the container CLI, into the OCI spec. The diagram below illustrates this for Docker.
227-
228-
```text
229-
+------------+ +---------------+ +-----------------------+
230-
| | | | | |
231-
| Docker CLI | AMD_VISIBLE_DEVICES | Docker Daemon | OCI SPEC | AMD Container Runtime |
232-
| | --> | | --> | |
233-
+------------+ +---------------+ +-----------------------+
234-
|
235-
UPDATED OCI SPEC
236-
INJECTED GPU DEVICES
237-
|
238-
v
239-
+----------------------+
240-
| RUNC +
241-
+----------------------+
242-
|
243-
v
244-
+----------------------+
245-
| CONTAINER PROCESS +
246-
+----------------------+
247-
|
248-
v
249-
+----------------------+
250-
| GPU DRIVER +
251-
+----------------------+
252-
```
253-
254-
2. Generates the CDI spec for AMD GPUs available on the host system. This enables Users to specify the GPU devices needed in the container using the CDI style. Most containers today have native support for CDI.
255-
256-
3. Provides CLI to configure Docker to use CDI and ```AMD_VISIBLE_DEVICES``` environment variable.
257-
258-
# Troubleshooting
259-
260-
TBD
261-
262122
# Release notes
123+
1. Partitioned GPUs are not supported.
263124

264-
TBD
265-
266-
# Developer Guide
267125
## Building from Source
268126
To build debian package, use the following command.
269127

@@ -277,4 +135,10 @@ To build rpm package, use the following command.
277135
make pkg-rpm
278136
```
279137

280-
The packages will be generated in the ```bin``` folder.
138+
The packages will be generated in the ```bin``` folder.
139+
140+
# Documentation
141+
For detailed documentation including installation guides and configuration options, see the documentation.
142+
143+
# License
144+
This project is licensed under the Apache 2.0 License - see the [LICENSE](https://github.com/ROCm/container-toolkit/blob/main/LICENSE) file for details.

build/debian/DEBIAN/control

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ Section: utils
44
Maintainer: AMD Inc.
55
Architecture: amd64
66
Description: AMD Container Toolkit for Ubuntu
7-
Version: 1.2.0~22.04
7+
Version: BUILD_VER_ENV
8+
Depends: jq

build/debian/DEBIAN/prerm

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,55 @@
11
#!/bin/bash
2-
amd-ctk runtime configure --remove
2+
3+
# Remove default CDI directory if present
4+
CDI_DIR="/etc/cdi"
5+
if [ -d "$CDI_DIR" ]; then
6+
rm -rf "$CDI_DIR"
7+
fi
8+
9+
# Default Docker config file
10+
DOCKER_CONFIG="/etc/docker/daemon.json"
11+
12+
# Exit if Docker config file is not available
13+
if [[ ! -f "$DOCKER_CONFIG" ]]; then
14+
exit 0
15+
fi
16+
17+
# Exit if "jq is not available
18+
if ! type "jq" > /dev/null; then
19+
echo "jq is not available. Docker config file cannot be cleaned up."
20+
exit 0
21+
fi
22+
23+
update=false
24+
out=$(cat "$DOCKER_CONFIG")
25+
26+
# Unset AMD default runtime
27+
if $(echo "$out" | jq 'has("default-runtime") and ."default-runtime" == "amd"'); then
28+
out=$(jq 'del(.["default-runtime"])' "$DOCKER_CONFIG")
29+
update=true
30+
fi
31+
32+
# Remove AMD runtime
33+
if $(echo "$out" | jq '.runtimes | has("amd")'); then
34+
out=$(echo "$out" | jq -e 'del(.runtimes["amd"])')
35+
if $(echo "$out" | jq '.runtimes | length == 0'); then
36+
out=$(echo "$out" | jq -e 'del(.["runtimes"])')
37+
fi
38+
update=true
39+
fi
40+
41+
# Remove CDI feature
42+
if $(echo "$out" | jq '.features | has("cdi")'); then
43+
out=$(echo "$out" | jq -e 'del(.features["cdi"])')
44+
if $(echo "$out" | jq '.features | length == 0'); then
45+
out=$(echo "$out" | jq -e 'del(.["features"])')
46+
fi
47+
update=true
48+
fi
49+
50+
# Update Docker config file
51+
if [ "$update" == true ]; then
52+
echo "$out" > "$DOCKER_CONFIG"
53+
echo "Updated the docker config file"
54+
echo "Please restart docker daemon"
55+
fi

0 commit comments

Comments
 (0)