Skip to content

Commit 3df6fd5

Browse files
committed
Add vulkan sample image
Signed-off-by: Evan Lezar <[email protected]>
1 parent 64c6c1e commit 3df6fd5

File tree

4 files changed

+137
-2
lines changed

4 files changed

+137
-2
lines changed

.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

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)