Skip to content

Commit f5b7011

Browse files
committed
Add vulkan sample image
This change adds a sample image that can be used to demonstrate vulkan functionality. Signed-off-by: Evan Lezar <[email protected]>
1 parent 64c6c1e commit f5b7011

File tree

6 files changed

+183
-2
lines changed

6 files changed

+183
-2
lines changed

.common-ci.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ stages:
8181
LOWER_CASE_SAMPLE: simplemultigpu
8282
PUSH_SAMPLE_ONLY_TAG: "true"
8383

84+
# Define the sample targets
85+
.sample-vulkan:
86+
variables:
87+
SAMPLE: vulkan
88+
LOWER_CASE_SAMPLE: vulkan
89+
PUSH_SAMPLE_ONLY_TAG: "true"
90+
8491
# Make buildx available as a docker CLI plugin
8592
.buildx-setup:
8693
before_script:
@@ -184,3 +191,11 @@ release:staging-device-query-ubuntu22.04:
184191
needs:
185192
- image-device-query-ubuntu22.04
186193

194+
release:staging-vulkan:
195+
extends:
196+
- .release:staging
197+
- .dist-ubuntu22.04
198+
- .sample-vulkan
199+
needs:
200+
- image-vulkan-ubuntu22.04
201+

.github/workflows/image.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
- deviceQuery
4141
- nvbandwidth
4242
- simpleMultiGPU
43+
- vulkan
4344
exclude:
4445
- dist: ubi9
4546
sample: deviceQuery
@@ -49,6 +50,8 @@ jobs:
4950
sample: nvbandwidth
5051
- dist: ubi9
5152
sample: simpleMultiGPU
53+
- dist: ubi9
54+
sample: vulkan
5255

5356
steps:
5457
- uses: actions/checkout@v4

.nvidia-ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ image-simple-multi-gpu-ubuntu22.04:
9696
- .dist-ubuntu22.04
9797
- .sample-simple-multi-gpu
9898

99+
image-vulkan-ubuntu22.04:
100+
extends:
101+
- .image-pull
102+
- .dist-ubuntu22.04
103+
- .sample-vulkan
104+
99105
# The .scan step forms the base of the image scan operation performed before releasing
100106
# images.
101107
.scan:
@@ -223,6 +229,25 @@ scan-simple-multi-gpu-ubuntu22.04-arm64:
223229
- image-simple-multi-gpu-ubuntu22.04
224230
- scan-simple-multi-gpu-ubuntu22.04-amd64
225231

232+
scan-vulkan-ubuntu22.04-amd64:
233+
extends:
234+
- .scan
235+
- .sample-vulkan
236+
- .dist-ubuntu22.04
237+
- .platform-amd64
238+
needs:
239+
- image-vulkan-ubuntu22.04
240+
241+
scan-vulkan-ubuntu22.04-arm64:
242+
extends:
243+
- .scan
244+
- .sample-vulkan
245+
- .dist-ubuntu22.04
246+
- .platform-arm64
247+
needs:
248+
- image-vulkan-ubuntu22.04
249+
- scan-vulkan-ubuntu22.04-amd64
250+
226251
# Define external release helpers
227252
.release:ngc:
228253
extends:
@@ -264,3 +289,9 @@ release:ngc-simple-multi-gpu-ubuntu22.04:
264289
- .release:ngc
265290
- .dist-ubuntu22.04
266291
- .sample-simple-multi-gpu
292+
293+
release:ngc-vulkan-ubuntu22.04:
294+
extends:
295+
- .release:ngc
296+
- .dist-ubuntu22.04
297+
- .sample-vulkan

deployments/container/Makefile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,20 @@ TEST_TARGETS := $(patsubst %,test-%, $(DISTRIBUTIONS))
5050

5151
# Certain samples do not allow multi-arch images. We disable them here.
5252
# TODO: Does it make more sense to set this at a CI-level?
53-
ifeq ($(SAMPLE),nbody)
53+
AMD64_SAMPLES = vulkan
54+
ARM64_SAMPLES =
55+
SINGLE_ARCH_SAMPLES = nbody $(AMD64_SAMPLES) $(ARM64_SAMPLES)
56+
ifeq ($(SAMPLE),$(filter $(SAMPLE),$(SINGLE_ARCH_SAMPLES)))
57+
$(info Using single-architecture for $(SAMPLE))
5458
BUILD_MULTI_ARCH_IMAGES = false
59+
# Certain samples are only supported on AMD64.
60+
ifeq ($(SAMPLE),$(filter $(SAMPLE),$(AMD64_SAMPLES)))
61+
ARCH = amd64
62+
endif
63+
# Certain samples are only supported on AMD64.
64+
ifeq ($(SAMPLE),$(filter $(SAMPLE),$(ARM64_SAMPLES)))
65+
ARCH = arm64
66+
endif
5567
endif
5668

5769
ifneq ($(BUILD_MULTI_ARCH_IMAGES),true)
@@ -82,7 +94,7 @@ endif
8294

8395
build-%: DIST = $(*)
8496
# For the following samples, we use specific Dockerfiles:
85-
ifeq ($(SAMPLE),$(filter $(SAMPLE),nbody nvbandwidth))
97+
ifeq ($(SAMPLE),$(filter $(SAMPLE),nbody nvbandwidth vulkan))
8698
build-%: DOCKERFILE = $(CURDIR)/deployments/container/$(SAMPLE)/Dockerfile
8799
else
88100
build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile.$(DOCKERFILE_SUFFIX)
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
FROM nvcr.io/nvidia/cuda:12.8.1-base-ubuntu22.04 AS builder
17+
18+
ENV DEBIAN_FRONTEND=noninteractive
19+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
20+
wget \
21+
&& \
22+
rm -rf /var/lib/apt/lists/*
23+
24+
# See instructions from https://vulkan.lunarg.com/doc/sdk/1.4.309.0/linux/getting_started_ubuntu.html
25+
RUN wget -qO- https://packages.lunarg.com/lunarg-signing-key-pub.asc | tee /etc/apt/trusted.gpg.d/lunarg.asc \
26+
&& \
27+
wget -qO /etc/apt/sources.list.d/lunarg-vulkan-jammy.list http://packages.lunarg.com/vulkan/lunarg-vulkan-jammy.list \
28+
&& \
29+
apt update -y \
30+
&& \
31+
apt install -y --no-install-recommends vulkan-sdk \
32+
&& \
33+
rm -rf /var/lib/apt/lists/*
34+
35+
# TODO: Should we include this in the list above.
36+
RUN apt-get update && apt-get install -y --no-install-recommends \
37+
git \
38+
make \
39+
cmake \
40+
pkg-config \
41+
gcc \
42+
g++ \
43+
&& rm -rf /var/lib/apt/lists/*
44+
45+
WORKDIR /build
46+
47+
ARG BUILD_EXAMPLES="computeheadless renderheadless"
48+
ENV BUILD_EXAMPLES=$BUILD_EXAMPLES
49+
50+
RUN apt-get update && apt-get install -y --no-install-recommends \
51+
libglm-dev \
52+
&& rm -rf /var/lib/apt/lists/*
53+
54+
# TODO: We should update to the official samples
55+
RUN git clone --depth=1 https://github.com/SaschaWillems/Vulkan.git \
56+
&& cd Vulkan \
57+
sed -e 's|https://|git@|g' .gitmodules \
58+
&& \
59+
git submodule sync \
60+
&& \
61+
git submodule update \
62+
&& mkdir -p build && cd build \
63+
&& cmake -D RESOURCE_INSTALL_DIR=/cuda-samples .. \
64+
&& make ${BUILD_EXAMPLES}
65+
66+
FROM nvcr.io/nvidia/cuda:12.8.1-base-ubuntu22.04
67+
68+
LABEL io.k8s.display-name="NVIDIA CUDA Vulkan samples"
69+
LABEL name="NVIDIA CUDA Vulkan samples"
70+
LABEL vendor="NVIDIA"
71+
LABEL version="N/A"
72+
LABEL release="N/A"
73+
LABEL summary="NVIDIA container to validate GPU support for Vulkan"
74+
LABEL description="See summary"
75+
76+
COPY ./LICENSE ./licenses/LICENSE
77+
78+
RUN mkdir -p /cuda-samples
79+
80+
COPY --from=builder /build/Vulkan/build/bin/computeheadless /cuda-samples/bin/computeheadless
81+
COPY --from=builder /build/Vulkan/build/bin/renderheadless /cuda-samples/bin/renderheadless
82+
COPY --from=builder /build/Vulkan/shaders/glsl/computeheadless/ /cuda-samples/shaders/glsl/computeheadless/
83+
COPY --from=builder /build/Vulkan/shaders/glsl/renderheadless/ /cuda-samples/shaders/glsl/renderheadless/
84+
COPY --from=builder /build/Vulkan/shaders/hlsl/computeheadless/ /cuda-samples/shaders/hlsl/computeheadless/
85+
COPY --from=builder /build/Vulkan/shaders/hlsl/renderheadless/ /cuda-samples/shaders/hlsl/renderheadless/
86+
87+
COPY /deployments/container/vulkan/entrypoint.sh /cuda-samples/entrypoint.sh
88+
RUN ln -s /cuda-samples/entrypoint.sh /cuda-samples/sample
89+
90+
ENV DEBIAN_FRONTEND=noninteractive
91+
COPY --from=builder /etc/apt/sources.list.d/lunarg-vulkan-jammy.list /etc/apt/sources.list.d/lunarg-vulkan-jammy.list
92+
COPY --from=builder /etc/apt/trusted.gpg.d/lunarg.asc /etc/apt/trusted.gpg.d/lunarg.asc
93+
94+
RUN apt update -y && apt install -y --no-install-recommends \
95+
vulkan-sdk \
96+
&& \
97+
rm -rf /var/lib/apt/lists/*
98+
99+
CMD ["/cuda-samples/sample"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
EXAMPLES=/cuda-samples/bin/
18+
for i in $(ls ${EXAMPLES}); do
19+
echo 'y' | ${EXAMPLES}/$i
20+
echo "\n"
21+
done

0 commit comments

Comments
 (0)