Skip to content

Commit cdbfe9a

Browse files
Shiva Kumarshivakunv
authored andcommitted
Support Data Center precompiled driver container for Arm (Ubuntu 24.04)
Signed-off-by: Shiva Kumar (SW-CLOUD) <[email protected]>
1 parent acf0357 commit cdbfe9a

File tree

12 files changed

+174
-133
lines changed

12 files changed

+174
-133
lines changed

.github/workflows/precompiled.yaml

Lines changed: 100 additions & 51 deletions
Large diffs are not rendered by default.

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"chatgpt.openOnStartup": true
3+
}

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ $(BASE_BUILD_TARGETS):
215215
DOCKER_BUILDKIT=1 \
216216
$(DOCKER) $(BUILDX) build --pull --no-cache \
217217
$(DOCKER_BUILD_OPTIONS) \
218+
$(DOCKER_BUILD_PLATFORM_OPTIONS) \
218219
--tag $(IMAGE) \
219220
--target $(TARGET) \
220221
--build-arg CUDA_VERSION="$(CUDA_VERSION)" \

base/generate-ci-config

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ export DEBIAN_FRONTEND=noninteractive
1616
apt-get update -y -qq > /dev/null
1717

1818
# Generate a list of all kernel versions which have NVIDIA precompiled driver packages available.
19-
SUPPORTED_KERNELS_LINUX_SIGNATURES_LIST=$(apt-cache search "linux-signatures-nvidia.*${LTS_KERNEL}.*${KERNEL_FLAVOR}" | awk '{print $1}' | sed -e "s/^.*${LTS_KERNEL}/${LTS_KERNEL}/" | sort -n -t'-' -k2| grep "${KERNEL_FLAVOR}$")
19+
# linux-signatures-nvidia (secure boot signatures) is not available for arm64
20+
if [ "$(uname -m)" = "aarch64" ]; then
21+
SUPPORTED_KERNELS_LINUX_LIST=$(apt-cache search "linux-objects-nvidia-${DRIVER_BRANCH}-server.*${LTS_KERNEL}.*${KERNEL_FLAVOR}" | awk '{print $1}' | grep -v "open" | sed -e "s/^.*${LTS_KERNEL}/${LTS_KERNEL}/" | sort -n -t'-' -k2)
22+
else
23+
SUPPORTED_KERNELS_LINUX_LIST=$(apt-cache search "linux-signatures-nvidia.*${LTS_KERNEL}.*${KERNEL_FLAVOR}" | awk '{print $1}' | sed -e "s/^.*${LTS_KERNEL}/${LTS_KERNEL}/" | sort -n -t'-' -k2| grep "${KERNEL_FLAVOR}$")
24+
fi
2025
# Generate a list of all kernel versions which have linux-image packages available.
2126
SUPPORTED_KERNELS_LINUX_IMAGE_LIST=$(apt-cache search linux-image-${LTS_KERNEL}.*-${KERNEL_FLAVOR} | awk '{print $1}' | sed -e "s/^.*${LTS_KERNEL}/${LTS_KERNEL}/" | sort -n -t'-' -k2 | grep "${KERNEL_FLAVOR}$")
2227

@@ -26,7 +31,7 @@ DRIVER_VERSION=$(apt-cache show nvidia-utils-${DRIVER_BRANCH}-server |grep Versi
2631
# Get the latest kernel from linux-signatures-list and linux-images-list
2732
# As list is already sorted , compare the kernel version and find exact match
2833
# get the latest kernel version with tail
29-
SK=$(grep -Fxf <(echo "$SUPPORTED_KERNELS_LINUX_SIGNATURES_LIST") <(echo "$SUPPORTED_KERNELS_LINUX_IMAGE_LIST") | tail -n1)
34+
SK=$(grep -Fxf <(echo "$SUPPORTED_KERNELS_LINUX_LIST") <(echo "$SUPPORTED_KERNELS_LINUX_IMAGE_LIST") | tail -n1)
3035

3136
# Write to file
3237
echo "export KERNEL_VERSION=$SK DRIVER_VERSION=$DRIVER_VERSION DRIVER_VERSIONS=$DRIVER_VERSION" > /var/kernel_version.txt

multi-arch.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ $(DRIVER_PUSH_TARGETS): push-%:
2727
build-ubuntu18.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
2828
build-signed_ubuntu20.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
2929
build-signed_ubuntu22.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
30-
build-signed_ubuntu24.04%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
3130
build-sles%: DOCKER_BUILD_PLATFORM_OPTIONS = --platform=linux/amd64
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,9 @@ spec:
1111
instance:
1212
type: g4dn.xlarge
1313
region: us-west-1
14-
ingressIpRanges:
15-
- 18.190.12.32/32
16-
- 3.143.46.93/32
17-
- 52.15.119.136/32
18-
- 35.155.108.162/32
19-
- 35.162.190.51/32
20-
- 54.201.61.24/32
21-
- 52.24.205.48/32
22-
- 44.235.4.62/32
23-
- 44.230.241.223/32
14+
os: ubuntu-22.04
2415
image:
2516
architecture: amd64
26-
imageId: ami-0007a86be89339c9f
2717
containerRuntime:
2818
install: true
2919
name: containerd

tests/holodeck_ubuntu24.04.yaml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
get_kernel_versions_to_test() {
2-
if [[ "$#" -ne 4 ]]; then
3-
echo " Error:$0 must be called with KERNEL_FLAVORS DRIVER_BRANCHES DIST LTS_KERNEL" >&2
2+
if [[ "$#" -lt 4 || "$#" -gt 5 ]]; then
3+
echo " Error:$0 must be called with KERNEL_FLAVORS DRIVER_BRANCHES DIST LTS_KERNEL or KERNEL_FLAVORS DRIVER_BRANCHES DIST LTS_KERNEL PLATFORM_SUFFIX" >&2
44
exit 1
55
fi
66

77
local -a KERNEL_FLAVORS=("${!1}")
88
local -a DRIVER_BRANCHES=("${!2}")
99
local DIST="$3"
1010
local LTS_KERNEL="$4"
11-
11+
local PLATFORM_SUFFIX="$5"
1212
kernel_versions=()
1313
for kernel_flavor in "${KERNEL_FLAVORS[@]}"; do
1414
for DRIVER_BRANCH in "${DRIVER_BRANCHES[@]}"; do
15-
source ./tests/scripts/findkernelversion.sh "${kernel_flavor}" "$DRIVER_BRANCH" "$DIST" "$LTS_KERNEL" >&2
15+
source ./tests/scripts/findkernelversion.sh "${kernel_flavor}" "$DRIVER_BRANCH" "$DIST" "$LTS_KERNEL" "$PLATFORM_SUFFIX" >&2
1616
if [[ "$should_continue" == true ]]; then
1717
break
1818
fi
@@ -25,7 +25,7 @@ get_kernel_versions_to_test() {
2525
# Remove duplicates
2626
kernel_versions=($(printf "%s\n" "${kernel_versions[@]}" | sort -u))
2727
for i in "${!kernel_versions[@]}"; do
28-
kernel_versions[$i]="${kernel_versions[$i]}-$DIST"
28+
kernel_versions[$i]="${kernel_versions[$i]}-$DIST$PLATFORM_SUFFIX"
2929
done
3030
echo "${kernel_versions[@]}"
3131
}

tests/scripts/findkernelversion.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#!/bin/bash
22

3-
if [[ $# -ne 4 ]]; then
4-
echo " KERNEL_FLAVOR DRIVER_BRANCH DIST LTS_KERNEL are required"
3+
if [[ $# -lt 4 || $# -gt 5 ]]; then
4+
echo " KERNEL_FLAVOR DRIVER_BRANCH DIST LTS_KERNEL or KERNEL_FLAVOR DRIVER_BRANCH DIST LTS_KERNEL PLATFORM_SUFFIX are required"
55
exit 1
66
fi
77

88
export KERNEL_FLAVOR="${1}"
99
export DRIVER_BRANCH="${2}"
1010
export DIST="${3}"
1111
export LTS_KERNEL="${4}"
12+
export PLATFORM_SUFFIX="${5}"
1213

1314
export REGCTL_VERSION=v0.7.1
1415
mkdir -p bin
@@ -18,24 +19,24 @@ export PATH=$(pwd)/bin:${PATH}
1819

1920
# calculate kernel version of latest image
2021
prefix="kernel-version-${DRIVER_BRANCH}-${LTS_KERNEL}"
21-
suffix="${kernel_flavor}-${DIST}"
22+
suffix="${KERNEL_FLAVOR}-${DIST}${PLATFORM_SUFFIX}"
2223

2324
artifact_dir="./kernel-version-artifacts"
24-
artifact=$(find "$artifact_dir" -maxdepth 1 -type d -name "${prefix}*-${suffix}" | head -1)
25-
if [ -n "$artifact" ]; then
26-
artifact_name=$(basename "$artifact")
27-
if [ -f "$artifact/${artifact_name}.tar" ]; then
28-
tar -xf "$artifact/${artifact_name}.tar" -C ./
29-
export $(grep -oP 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
30-
rm -f kernel_version.txt
31-
fi
25+
artifact_file=$(find "$artifact_dir" -maxdepth 1 -type f -name "${prefix}*-${suffix}.tar" | head -1)
26+
if [ -n "$artifact_file" ]; then
27+
tar -xf "$artifact_file" -C ./
28+
export $(grep -oE 'KERNEL_VERSION=[^ ]+' ./kernel_version.txt)
29+
rm -f kernel_version.txt
3230
fi
3331

3432
# calculate driver tag
3533
status_nvcr=0
3634
status_ghcr=0
37-
regctl tag ls nvcr.io/nvidia/driver | grep "^${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST}$" || status_nvcr=$?
38-
regctl tag ls ghcr.io/nvidia/driver | grep "^${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST}$" || status_ghcr=$?
35+
PLATFORM=$(echo "${PLATFORM_SUFFIX}" | sed 's/-//')
36+
[ -z "$PLATFORM" ] && PLATFORM=amd64
37+
regctl manifest inspect nvcr.io/nvidia/driver:${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST} --platform=linux/${PLATFORM} > /dev/null 2>&1; status_nvcr=$?
38+
regctl manifest inspect ghcr.io/nvidia/driver:${DRIVER_BRANCH}-${KERNEL_VERSION}-${DIST} --platform=linux/${PLATFORM} > /dev/null 2>&1; status_ghcr=$?
39+
3940
if [[ $status_nvcr -eq 0 || $status_ghcr -eq 0 ]]; then
4041
export should_continue=false
4142
else

ubuntu24.04/precompiled/Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ ENV NVIDIA_VISIBLE_DEVICES=void
1717

1818
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
1919

20-
RUN dpkg --add-architecture i386 && \
20+
# Add i386 architecture only for amd64 builds (not available on ARM)
21+
RUN if [ "$TARGETARCH" = "amd64" ]; then dpkg --add-architecture i386; fi && \
2122
apt-get update && apt-get install -y --no-install-recommends \
2223
apt-utils \
2324
build-essential \
@@ -31,11 +32,12 @@ RUN dpkg --add-architecture i386 && \
3132
pkg-config && \
3233
rm -rf /var/lib/apt/lists/*
3334

34-
# Fetch GPG keys for CUDA repo
35-
RUN apt-key del 3bf863cc && \
35+
# Fetch GPG keys for CUDA repo (architecture-specific)
36+
RUN CUDA_ARCH=$([ "$TARGETARCH" = "arm64" ] && echo "sbsa" || echo "x86_64") && \
37+
apt-key del 3bf863cc && \
3638
rm /etc/apt/sources.list.d/cuda.list && \
37-
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/3bf863cc.pub | gpg --dearmor -o /etc/apt/keyrings/cuda.pub && \
38-
echo "deb [signed-by=/etc/apt/keyrings/cuda.pub] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64 /" > /etc/apt/sources.list.d/cuda.list
39+
curl -fsSL https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/${CUDA_ARCH}/3bf863cc.pub | gpg --dearmor -o /etc/apt/keyrings/cuda.pub && \
40+
echo "deb [signed-by=/etc/apt/keyrings/cuda.pub] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/${CUDA_ARCH} /" > /etc/apt/sources.list.d/cuda.list
3941

4042
RUN usermod -o -u 0 -g 0 _apt
4143

0 commit comments

Comments
 (0)